|
1 | 1 | import { Anthropic } from "@anthropic-ai/sdk" |
2 | 2 | import OpenAI from "openai" |
3 | 3 |
|
4 | | -import { |
5 | | - type ModelInfo, |
6 | | - type WatsonxModelId, |
7 | | - watsonxDefaultModelId, |
8 | | - watsonxModels, |
9 | | - watsonxModelInfoSaneDefaults, |
10 | | -} from "@roo-code/types" |
| 4 | +import { type ModelInfo, type WatsonxModelId, watsonxDefaultModelId, watsonxModels } from "@roo-code/types" |
11 | 5 |
|
12 | 6 | import type { ApiHandlerOptions } from "../../shared/api" |
13 | 7 |
|
@@ -157,25 +151,18 @@ export class WatsonxHandler extends BaseProvider implements SingleCompletionHand |
157 | 151 | } |
158 | 152 | } |
159 | 153 |
|
160 | | -// Helper function to get available watsonx models (if API endpoint is available) |
161 | | -export async function getWatsonxModels( |
162 | | - baseUrl?: string, |
163 | | - apiKey?: string, |
164 | | - projectId?: string, |
165 | | - region?: string, |
166 | | -): Promise<string[]> { |
167 | | - try { |
168 | | - if (!apiKey || !projectId) { |
169 | | - return Object.keys(watsonxModels) |
170 | | - } |
171 | | - |
172 | | - const actualRegion = region || "us-south" |
173 | | - const actualBaseUrl = baseUrl || `https://${actualRegion}.ml.cloud.ibm.com/ml/v1` |
174 | | - |
175 | | - // Note: This is a placeholder - IBM watsonx may have a different endpoint for listing models |
176 | | - // For now, return the static list |
177 | | - return Object.keys(watsonxModels) |
178 | | - } catch (error) { |
179 | | - return Object.keys(watsonxModels) |
180 | | - } |
| 154 | +/** |
| 155 | + * Helper function to get available watsonx models. |
| 156 | + * |
| 157 | + * Currently returns a static list of models defined in watsonxModels. |
| 158 | + * IBM watsonx doesn't provide a public API endpoint for dynamically listing available models, |
| 159 | + * so we maintain a curated list of supported models that are known to work with the watsonx platform. |
| 160 | + * |
| 161 | + * @returns Array of available model IDs |
| 162 | + */ |
| 163 | +export async function getWatsonxModels(): Promise<string[]> { |
| 164 | + // Return the static list of supported watsonx models |
| 165 | + // This list is maintained based on IBM's documentation and includes |
| 166 | + // both IBM Granite models and third-party models available on watsonx |
| 167 | + return Object.keys(watsonxModels) |
181 | 168 | } |
0 commit comments