Skip to content
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

Support citations in Perplexity provider #3554

Open
wong2 opened this issue Nov 8, 2024 · 5 comments
Open

Support citations in Perplexity provider #3554

wong2 opened this issue Nov 8, 2024 · 5 comments
Labels
ai/core enhancement New feature or request

Comments

@wong2
Copy link
Contributor

wong2 commented Nov 8, 2024

Feature Description

Perplexity just announced that "Citations" are now enabled for everyone via the API: https://docs.perplexity.ai/changelog/changelog#citations-public-release-and-increased-default-rate-limits

They are returned alongside choices in the SSE response.

@lgrammel lgrammel added enhancement New feature or request ai/core ai/provider and removed ai/provider labels Nov 11, 2024
@RostyslavManko
Copy link

@lgrammel, any updates on this?

@sylviangth
Copy link

@lgrammel Hi any update please?

@egoist
Copy link
Contributor

egoist commented Dec 10, 2024

For a temporary workaround, you can apply this diff using pnpm patch:

diff --git a/dist/index.mjs b/dist/index.mjs
index 66cc5faa76025ed6a5ac56881a31fc0b60913cb6..908c893569d1e8dffacd3f6c724f89196d59c927 100644
--- a/dist/index.mjs
+++ b/dist/index.mjs
@@ -659,7 +659,8 @@ var OpenAIChatLanguageModel = class {
             if (delta.content != null) {
               controller.enqueue({
                 type: "text-delta",
-                textDelta: delta.content
+                textDelta: delta.content,
+                citations: value.citations
               });
             }
             const mappedLogprobs = mapOpenAIChatLogProbsOutput(
@@ -840,6 +841,7 @@ var openaiChatChunkSchema = z2.union([
     id: z2.string().nullish(),
     created: z2.number().nullish(),
     model: z2.string().nullish(),
+    citations: z2.any().nullish(),
     choices: z2.array(
       z2.object({
         delta: z2.object({

Then you can get citations in fullStream

@ybelakov
Copy link

ybelakov commented Jan 4, 2025

can we move this forward please?

@ybelakov
Copy link

#4366

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ai/core enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants