-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat: Add IBM watsonx AI provider support #8091
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
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,148 @@ | ||
| import type { ModelInfo } from "../model.js" | ||
|
|
||
| // IBM watsonx.ai models | ||
| // https://www.ibm.com/products/watsonx-ai | ||
| export type WatsonxModelId = keyof typeof watsonxModels | ||
|
|
||
| export const watsonxDefaultModelId: WatsonxModelId = "ibm/granite-3-8b-instruct" | ||
|
|
||
| export const watsonxModels = { | ||
| // Granite models - IBM's foundation models | ||
| "ibm/granite-3-8b-instruct": { | ||
| maxTokens: 8192, | ||
| contextWindow: 8192, | ||
| supportsImages: false, | ||
| supportsPromptCache: false, | ||
| inputPrice: 0.0002, | ||
| outputPrice: 0.0006, | ||
| description: "IBM Granite 3.0 8B Instruct - Optimized for enterprise tasks", | ||
| }, | ||
| "ibm/granite-3-2b-instruct": { | ||
| maxTokens: 4096, | ||
| contextWindow: 4096, | ||
| supportsImages: false, | ||
| supportsPromptCache: false, | ||
| inputPrice: 0.0001, | ||
| outputPrice: 0.0003, | ||
| description: "IBM Granite 3.0 2B Instruct - Lightweight model for simple tasks", | ||
| }, | ||
| "ibm/granite-20b-multilingual": { | ||
| maxTokens: 8192, | ||
| contextWindow: 8192, | ||
| supportsImages: false, | ||
| supportsPromptCache: false, | ||
| inputPrice: 0.0006, | ||
| outputPrice: 0.0018, | ||
| description: "IBM Granite 20B Multilingual - Supports multiple languages", | ||
| }, | ||
| "ibm/granite-13b-chat-v2": { | ||
| maxTokens: 8192, | ||
| contextWindow: 8192, | ||
| supportsImages: false, | ||
| supportsPromptCache: false, | ||
| inputPrice: 0.0004, | ||
| outputPrice: 0.0012, | ||
| description: "IBM Granite 13B Chat v2 - Optimized for conversational AI", | ||
| }, | ||
| "ibm/granite-13b-instruct-v2": { | ||
| maxTokens: 8192, | ||
| contextWindow: 8192, | ||
| supportsImages: false, | ||
| supportsPromptCache: false, | ||
| inputPrice: 0.0004, | ||
| outputPrice: 0.0012, | ||
| description: "IBM Granite 13B Instruct v2 - General purpose instruction following", | ||
| }, | ||
| "ibm/granite-7b-lab": { | ||
| maxTokens: 4096, | ||
| contextWindow: 4096, | ||
| supportsImages: false, | ||
| supportsPromptCache: false, | ||
| inputPrice: 0.0002, | ||
| outputPrice: 0.0006, | ||
| description: "IBM Granite 7B Lab - Experimental model for research", | ||
| }, | ||
| // Granite Code models - specialized for code generation | ||
| "ibm/granite-34b-code-instruct": { | ||
| maxTokens: 8192, | ||
| contextWindow: 8192, | ||
| supportsImages: false, | ||
| supportsPromptCache: false, | ||
| inputPrice: 0.001, | ||
| outputPrice: 0.003, | ||
| description: "IBM Granite 34B Code Instruct - Specialized for code generation and understanding", | ||
| }, | ||
| "ibm/granite-20b-code-instruct": { | ||
| maxTokens: 8192, | ||
| contextWindow: 8192, | ||
| supportsImages: false, | ||
| supportsPromptCache: false, | ||
| inputPrice: 0.0006, | ||
| outputPrice: 0.0018, | ||
| description: "IBM Granite 20B Code Instruct - Code generation model", | ||
| }, | ||
| "ibm/granite-8b-code-instruct": { | ||
| maxTokens: 4096, | ||
| contextWindow: 4096, | ||
| supportsImages: false, | ||
| supportsPromptCache: false, | ||
| inputPrice: 0.0002, | ||
| outputPrice: 0.0006, | ||
| description: "IBM Granite 8B Code Instruct - Lightweight code model", | ||
| }, | ||
| "ibm/granite-3b-code-instruct": { | ||
| maxTokens: 2048, | ||
| contextWindow: 2048, | ||
| supportsImages: false, | ||
| supportsPromptCache: false, | ||
| inputPrice: 0.0001, | ||
| outputPrice: 0.0003, | ||
| description: "IBM Granite 3B Code Instruct - Fast code completion", | ||
| }, | ||
| // Third-party models available on watsonx | ||
| "meta-llama/llama-3-70b-instruct": { | ||
| maxTokens: 8192, | ||
| contextWindow: 8192, | ||
| supportsImages: false, | ||
| supportsPromptCache: false, | ||
| inputPrice: 0.0029, | ||
| outputPrice: 0.0087, | ||
| description: "Meta Llama 3 70B Instruct on watsonx", | ||
| }, | ||
| "meta-llama/llama-3-8b-instruct": { | ||
| maxTokens: 8192, | ||
| contextWindow: 8192, | ||
| supportsImages: false, | ||
| supportsPromptCache: false, | ||
| inputPrice: 0.0002, | ||
| outputPrice: 0.0006, | ||
| description: "Meta Llama 3 8B Instruct on watsonx", | ||
| }, | ||
| "mistralai/mixtral-8x7b-instruct-v01": { | ||
| maxTokens: 4096, | ||
| contextWindow: 32768, | ||
| supportsImages: false, | ||
| supportsPromptCache: false, | ||
| inputPrice: 0.0005, | ||
| outputPrice: 0.0015, | ||
| description: "Mistral Mixtral 8x7B Instruct on watsonx", | ||
| }, | ||
| "mistralai/mistral-large": { | ||
| maxTokens: 8192, | ||
| contextWindow: 32768, | ||
| supportsImages: false, | ||
| supportsPromptCache: false, | ||
| inputPrice: 0.003, | ||
| outputPrice: 0.009, | ||
| description: "Mistral Large on watsonx", | ||
| }, | ||
| } as const satisfies Record<string, ModelInfo> | ||
|
|
||
| export const watsonxModelInfoSaneDefaults: ModelInfo = { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This export is defined but never used anywhere. The PR description mentions it was removed, but it's still here. Should we actually remove it? |
||
| maxTokens: 4096, | ||
| contextWindow: 8192, | ||
| supportsImages: false, | ||
| supportsPromptCache: false, | ||
| inputPrice: 0, | ||
| outputPrice: 0, | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
While watsonx is correctly added to dynamicProviders, it's worth noting (maybe in a comment) that unlike other dynamic providers, watsonx doesn't actually fetch models dynamically - it uses a static list. This is already documented in the getWatsonxModels function, but a note here might help future maintainers understand the distinction.