-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat: Add Perplexity support to universal chat model #9028
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: Add Perplexity support to universal chat model #9028
Conversation
- Add 'perplexity' to supported providers list - Add perplexity case to initChatModel switch statement - Update model provider inference for sonar* and pplx* models - Add integration test for perplexity support
🦋 Changeset detectedLatest commit: 7779308 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Thanks for the contribution!
- Add @ts-ignore comments for perplexity import to handle circular dependency - Update documentation to list perplexity as community import - Follows same pattern as fireworks and together imports
|
Hi @christian-bromann, I've pushed a fix for the circular dependency issue. The build should now pass. Could you please check? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mhm 🤔 the circular dependency is worrisome .. maybe it is worth creating a perplexity provider package ala @langchain/perplexity here before moving forward.
Thoughts @hntrl ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@christian-bromann yeah that would be an ideal state, but it's not high prio and if there's an immediate need for this I'm fine to merge. I'd be more worried if we didn't have other community models doing the same thing
| case "perplexity": { | ||
| // eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
| // @ts-ignore - Can not install as a proper dependency due to circular dependency | ||
| const { ChatPerplexity } = await import( | ||
| // We can not 'expect-error' because if you explicitly build `@langchain/community` | ||
| // this import will be able to be resolved, thus there will be no error. However | ||
| // this will never be the case in CI. | ||
| // eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
| // @ts-ignore - Can not install as a proper dependency due to circular dependency | ||
| "@langchain/community/chat_models/perplexity" | ||
| ); | ||
| return new ChatPerplexity({ model, ...passedParams }); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: can we move this down to the other community models?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks!
Move the perplexity case in the universal chat model switch statement to be grouped with other community models (fireworks, together) for better code organization, as requested in maintainer review.
|
Ported to v1 02ce0b4 |
Summary
Adds support for Perplexity AI models in the universal chat model factory.
Changes
_SUPPORTED_PROVIDERSarrayinitChatModel()switch statement_inferModelProvider()to recognizesonar*andpplx*model namesUsage
Testing