-
-
Notifications
You must be signed in to change notification settings - Fork 12.2k
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: support anthropic as model provider #1409
Conversation
@danielglh is attempting to deploy a commit to the LobeHub Team on Vercel. A member of the Team first needs to authorize it. |
๐ @danielglh Thank you for raising your pull request and contributing to our Community |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1409 +/- ##
==========================================
- Coverage 92.48% 92.37% -0.12%
==========================================
Files 227 230 +3
Lines 12022 12278 +256
Branches 1457 1483 +26
==========================================
+ Hits 11119 11342 +223
- Misses 903 936 +33 โ View full report in Codecov by Sentry. |
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 for your PR! A really nice work. Most of codes are LGTM. Please rebase the main branch and add a test for this provider~ (you can refer to MoonshotAI 's test)
9c22cfd
to
5b108d7
Compare
Cool. I've rebased main branch and made necessary changes. Regarding test, Anthropic API is not compatible with OpenAI API so it probably takes more time to work on it. I noticed that other providers that are not compatible with OpenAI API don't have tests either. Not sure where to find a better reference. |
@danielglh I will add the google provider test soon. And you can use the simmliar method to add tests: |
@arvinxx sure will take a look |
3f6461b
to
e75b380
Compare
Hmm probably need to take some time to check how the streaming should be implemented. For some reason it's quite unstable. |
@danielglh what's the mean of the streaming is unstable? |
@arvinxx for some reason the response stream was cut randomly when it was deployed to Vercel for preview |
@arvinxx I think it might be limitations of the edge servers Vercel uses for preview. The streaming works perfectly fine when I run lobe-chat locally and on a remote dev server I have. |
@danielglh I know there is a timeout of stream on vercel, but I don't know the accurate value. |
@@ -21,6 +21,14 @@ | |||
"sessionWithName": "ะะฐัััะพะนะบะธ ัะตะฐะฝัะฐ ยท {{name}}" | |||
}, | |||
"llm": { | |||
"Anthropic": { | |||
"title": "ะะฝััะพะฟะฝัะน", |
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.
I think it's not worth translating, but leaving the Anthropic
. So that it doesn't seem like it's a machine translation
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.
I agree
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.
@shigomany I agree but this seems to be a general issue to solve in the i18n project. Other providers' titles were mostly translated already
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.
I consider to fix it later
4ad0a01
to
4bce423
Compare
@arvinxx tests added for Anthropic, plz check again |
4bce423
to
ab8249b
Compare
Now claude-3.0 is released |
@ckt1031 yes, @danielglh can we support Anthropic's new model in the PR? |
I believe not only adding the new model, but also support vision feature by Claude 3.0 ๐ . |
ab8249b
to
5af03f6
Compare
I have supported the vision |
@danielglh can you fix the test of anthropic test? I think the rest is well done enough to ship. |
The latest updates on your projects. Learn more about Vercel for Git โ๏ธ
|
da692a1
to
206fb76
Compare
@arvinxx tests fixed |
@arvinxx I'm testing this on Vercel and still experiencing weird streaming problems: Any suggestions? Cannot reproduce the issue in the local dev environment. It runs perfectly fine locally. |
Found it ... not sure if it is a Vercel issue or an Anthropic SDK issue yet. anthropics/anthropic-sdk-typescript#292 I would suggest that we go ahead and ship this first. Not everyone uses Vercel. We just need to make it clear that there's a known issue with Vercel (maybe include it in the document?). |
@danielglh I agree. |
@arvinxx documents updated regarding the known issue with Anthropic SDK on Vercel/Cloudflare edge runtime. |
โค๏ธ Great PR @danielglh โค๏ธ The growth of project is inseparable from user feedback and contribution, thanks for your contribution! If you are interesting with the lobehub developer community, please join our discord and then dm @arvinxx or @canisminor1990. They will invite you to our private developer channel. We are talking about the lobe-chat development or sharing ai newsletter around the world. |
## [Version 0.132.0](v0.131.0...v0.132.0) <sup>Released on **2024-03-05**</sup> #### โจ Features - **misc**: Support anthropic as model provider. <br/> <details> <summary><kbd>Improvements and Fixes</kbd></summary> #### What's improved * **misc**: Support anthropic as model provider, closes [#1409](#1409) ([a42cf8c](a42cf8c)) </details> <div align="right"> [](#readme-top) </div>
๐ This PR is included in version 0.132.0 ๐ The release is available on: Your semantic-release bot ๐ฆ๐ |
* โจ feat: support anthropic as model provider * โจ feat: support anthropic with vision * โ test: fix some with test * ๐ fix: anthropic error handling * โ chore: fix broken tests * ๐ fix: remove unused imports * ๐ doc: add note for anthropic with vercel/cloudflare * ๐ docs: update docs * ๐ docs: update docs * ๐ style: update claude icons * ๐ style: update tags --------- Co-authored-by: arvinxx <[email protected]>
## [Version 0.132.0](lobehub/lobe-chat@v0.131.0...v0.132.0) <sup>Released on **2024-03-05**</sup> #### โจ Features - **misc**: Support anthropic as model provider. <br/> <details> <summary><kbd>Improvements and Fixes</kbd></summary> #### What's improved * **misc**: Support anthropic as model provider, closes [lobehub#1409](lobehub#1409) ([a42cf8c](lobehub@a42cf8c)) </details> <div align="right"> [](#readme-top) </div>
## [Version 1.14.0](v1.13.0...v1.14.0) <sup>Released on **2024-03-05**</sup> #### โจ Features - **misc**: Support anthropic as model provider. <br/> <details> <summary><kbd>Improvements and Fixes</kbd></summary> #### What's improved * **misc**: Support anthropic as model provider, closes [lobehub#1409](https://github.com/bentwnghk/lobe-chat/issues/1409) ([a42cf8c](a42cf8c)) </details> <div align="right"> [](#readme-top) </div>
## [Version 0.132.0](lobehub/lobe-chat@v0.131.0...v0.132.0) <sup>Released on **2024-03-05**</sup> #### โจ Features - **misc**: Support anthropic as model provider. <br/> <details> <summary><kbd>Improvements and Fixes</kbd></summary> #### What's improved * **misc**: Support anthropic as model provider, closes [#1409](lobehub/lobe-chat#1409) ([a42cf8c](lobehub/lobe-chat@a42cf8c)) </details> <div align="right"> [](#readme-top) </div>
๐ป ๅๆด็ฑปๅ | Change Type
๐ ๅๆด่ฏดๆ | Description of Change
Added a new model provider, Anthropic, along with the 3 models it currently provides.
close #1401
๐ ่กฅๅ ไฟกๆฏ | Additional Information
Anthropic API Geographic Restrictions
Here is a list of locations that Anthropic API supports: https://docs.anthropic.com/claude/reference/supported-regions.
If a lobe-chat service happens to be deployed to a location that it doesn't support, it will not work and it will return 403 errors. For example, you may notice that it doesn't always work on Vercel.ai because Vercel deploys code to its edge server around the world and usually uses the edge server that is closest to your location to serve your requests, and some of its edge servers may not be allowed to make requests to Anthropic API.
Different API Parameters
As far as I know, Anthropic API doesn't seem to support these parameters:
presence_penalty, frequency_penalty
. Therefore these settings do not affect Anthropic models.