Skip to content

Commit b0ff385

Browse files
committed
fix: address review feedback for watsonx provider
- Remove unused watsonxModelInfoSaneDefaults import - Document getWatsonxModels function explaining static model list - Simplify function signature as parameters were unused
1 parent c69452c commit b0ff385

File tree

1 file changed

+15
-28
lines changed

1 file changed

+15
-28
lines changed

src/api/providers/watsonx.ts

Lines changed: 15 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
import { Anthropic } from "@anthropic-ai/sdk"
22
import OpenAI from "openai"
33

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"
115

126
import type { ApiHandlerOptions } from "../../shared/api"
137

@@ -157,25 +151,18 @@ export class WatsonxHandler extends BaseProvider implements SingleCompletionHand
157151
}
158152
}
159153

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)
181168
}

0 commit comments

Comments
 (0)