Skip to content

feat: Support perplexity citations #574

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

morloderex
Copy link

What:

  • Bug Fix
  • New Feature

Description:

This adds support for the citations attribute that perplexity adds to their responses and the search_context_size sub attribute under the usage attribute.

Related:

No related

@iBotPeaches
Copy link
Collaborator

Hmm. I need to think on this. This might be first time we are introducing a parameter that is not backed by anything in OpenAI. Just a new field that a specific provider will use.

So if we move forward, folks will see the citation property (conditionally) and perhaps confusion. I was discussing this in another thread with someone - #568 (comment)

Is the answer different Response classes backed on the model/provider?

@morloderex
Copy link
Author

@iBotPeaches I haven't seen any other provider that adds these attributes.

The perplexity provider is a bit weird in regards to its response, and it's not probably documented.

@morloderex
Copy link
Author

It makes me think if we need some kind of extension or decorator pattern that people can hook into?

For custom response.

@iBotPeaches
Copy link
Collaborator

@morloderex - Yeah my idea was optional Response classes that are based from the OpenAI one, which then parse custom fields to their provider. Everything else would fallback to existing parsing on OpenAI response class.

@morloderex
Copy link
Author

@iBotPeaches do you want me to close this pr and open another one with the above in mind then?

@iBotPeaches
Copy link
Collaborator

@morloderex - Looking for more of a POC or a little pseudo code of how we expect this to work. Generally wondering on an elegant way that allows the library to return a different typed response depending on the provider.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants