-
Notifications
You must be signed in to change notification settings - Fork 3.2k
feat(provider/google & provider/anthropic): support for custom provider name for anthropic and google #10091
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/google & provider/anthropic): support for custom provider name for anthropic and google #10091
Conversation
gr2m
left a comment
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.
Yet another great PR 🥇 thank you Ankit!
| * Custom provider name | ||
| * Defaults to 'anthropic.messages'. | ||
| */ | ||
| name?: string; |
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.
👍🏼 Aligns with what we implemented for OpenAI
ai/packages/openai/src/openai-provider.ts
Line 126 in 0c3b58b
| name?: string; |
| const createChatModel = (modelId: AnthropicMessagesModelId) => | ||
| new AnthropicMessagesLanguageModel(modelId, { | ||
| provider: 'anthropic.messages', | ||
| provider: providerName, |
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.
should we do provider: ${providerName}.messages` to align with what we do in the OpenAI provider?
ai/packages/openai/src/openai-provider.ts
Line 168 in 0c3b58b
| provider: `${providerName}.chat`, |
I'd say no because unlike OpenAI, Anthropic only has the messages model
…er name for anthropic and google (#10091) ## Background With the baseURL of createAnthropic and createGoogleGenerativeAI, we can use some providers that offer Anthropic or Gemini-compatible APIs. Therefore, we hope to pass in a custom provider name to make it easier to identify specific providers in logging and error tracking. ## Summary Added support for custom provider name in google and anthropic ## Manual Verification Wrote eg with telemetery for both google and anthropic to test the custom provider names ## Related Issues Fixes #9911 Co-authored-by: Gregor Martynus <[email protected]>
|
✅ Backport PR created: #10107 |
…tom provider name for anthropic and google (#10107) This is an automated backport of #10091 to the release-v5.0 branch. Co-authored-by: ANKIT VARSHNEY <[email protected]> Co-authored-by: Gregor Martynus <[email protected]>
Background
With the baseURL of createAnthropic and createGoogleGenerativeAI, we can use some providers that offer Anthropic or Gemini-compatible APIs. Therefore, we hope to pass in a custom provider name to make it easier to identify specific providers in logging and error tracking.
Summary
Added support for custom provider name in google and anthropic
Manual Verification
Wrote eg with telemetery for both google and anthropic to test the custom provider names
Checklist
pnpm changesetin the project root)Related Issues
Fixes #9911