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

feat(provider/perplexity): add support for return_images #4621

Closed
wants to merge 2 commits into from

Conversation

kevinwolfcr
Copy link
Contributor

Adds support for return_images to the Perplexity Provider

Note

As per @shaper's recommendation, I'm temporarily adding the logic to extract and pass the options to the underlying request in openai-compatible-chat-language-model.ts, since the Perplexity provider extends it.

@shaper
Copy link
Contributor

shaper commented Jan 31, 2025

Hi there, thank you for the contribution! I just sent #4618 which should allow us to do the input part of this PR as:

  const result = await generateText({
    model: perplexity('sonar-pro'),
    prompt: 'Invent a new holiday and describe its traditions.',
    providerOptions: {
      perplexity: {
        request_images: true,
      },
    },
  });

and similar for streamText. This should mean no changes needed for openai-compatible. I see you've kindly also done the extractor logic and tests, so I will work with you to get this landed once the other change is in (likely tomorrow).

Goal is to get you operational ASAP!

@kevinwolfcr
Copy link
Contributor Author

@shaper changes done. I removed the returnImages option from the openai-compatible-chat-language-model.ts and added it to the providerOptions object in the perplexity-with-images example for streamText and generateText.

@shaper
Copy link
Contributor

shaper commented Feb 1, 2025

@shaper changes done. I removed the returnImages option from the openai-compatible-chat-language-model.ts and added it to the providerOptions object in the perplexity-with-images example for streamText and generateText.

Thanks, I am looking at this

@shaper
Copy link
Contributor

shaper commented Feb 1, 2025

Continuing this work (inclusive of your commits to track credit) in #4651

@shaper shaper closed this Feb 1, 2025
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