Skip to content

Commit 24c7387

Browse files
committed
fix: detect tool calling support from API tool-use tag
- Add check for 'tool-use' tag in getRooModels() to set supportsNativeTools - Remove hardcoded supportsNativeTools() fallback method - Simplify getModel() to rely on API response data - Update tests to include supportsNativeTools field - Models now properly marked based on their actual capabilities from the API
1 parent 014db3f commit 24c7387

File tree

3 files changed

+8
-16
lines changed

3 files changed

+8
-16
lines changed

src/api/providers/fetchers/__tests__/roo.spec.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ describe("getRooModels", () => {
6868
supportsImages: true,
6969
supportsReasoningEffort: true,
7070
requiredReasoningEffort: false,
71+
supportsNativeTools: false,
7172
supportsPromptCache: true,
7273
inputPrice: 100, // 0.0001 * 1_000_000
7374
outputPrice: 200, // 0.0002 * 1_000_000
@@ -116,6 +117,7 @@ describe("getRooModels", () => {
116117
supportsImages: false,
117118
supportsReasoningEffort: true,
118119
requiredReasoningEffort: true,
120+
supportsNativeTools: false,
119121
supportsPromptCache: false,
120122
inputPrice: 100, // 0.0001 * 1_000_000
121123
outputPrice: 200, // 0.0002 * 1_000_000
@@ -162,6 +164,7 @@ describe("getRooModels", () => {
162164
supportsImages: false,
163165
supportsReasoningEffort: false,
164166
requiredReasoningEffort: false,
167+
supportsNativeTools: false,
165168
supportsPromptCache: false,
166169
inputPrice: 100, // 0.0001 * 1_000_000
167170
outputPrice: 200, // 0.0002 * 1_000_000

src/api/providers/fetchers/roo.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ export async function getRooModels(baseUrl: string, apiKey?: string): Promise<Mo
9292
// Determine if the model requires reasoning effort based on tags
9393
const requiredReasoningEffort = tags.includes("reasoning-required")
9494

95+
// Determine if the model supports native tool calling based on tags
96+
const supportsNativeTools = tags.includes("tool-use")
97+
9598
// Parse pricing (API returns strings, convert to numbers)
9699
const inputPrice = parseApiPrice(pricing.input)
97100
const outputPrice = parseApiPrice(pricing.output)
@@ -104,6 +107,7 @@ export async function getRooModels(baseUrl: string, apiKey?: string): Promise<Mo
104107
supportsImages,
105108
supportsReasoningEffort,
106109
requiredReasoningEffort,
110+
supportsNativeTools,
107111
supportsPromptCache: Boolean(cacheReadPrice !== undefined),
108112
inputPrice,
109113
outputPrice,

src/api/providers/roo.ts

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -249,17 +249,6 @@ export class RooHandler extends BaseOpenAiCompatibleProvider<string> {
249249
}
250250
}
251251

252-
/**
253-
* Check if a model ID supports native tool calling.
254-
* This is a fallback for models loaded dynamically that don't have explicit support flags.
255-
*/
256-
private supportsNativeTools(modelId: string): boolean {
257-
// List of model IDs known to support native tools
258-
const nativeToolModels = ["openai/gpt-5"]
259-
260-
return nativeToolModels.some((model) => modelId.includes(model))
261-
}
262-
263252
override getModel() {
264253
const modelId = this.options.apiModelId || rooDefaultModelId
265254

@@ -268,10 +257,6 @@ export class RooHandler extends BaseOpenAiCompatibleProvider<string> {
268257
const modelInfo = models[modelId]
269258

270259
if (modelInfo) {
271-
// If model info exists but doesn't have supportsNativeTools set, check our list
272-
if (modelInfo.supportsNativeTools === undefined) {
273-
modelInfo.supportsNativeTools = this.supportsNativeTools(modelId)
274-
}
275260
return { id: modelId, info: modelInfo }
276261
}
277262

@@ -284,7 +269,7 @@ export class RooHandler extends BaseOpenAiCompatibleProvider<string> {
284269
supportsImages: false,
285270
supportsReasoningEffort: false,
286271
supportsPromptCache: true,
287-
supportsNativeTools: this.supportsNativeTools(modelId),
272+
supportsNativeTools: false,
288273
inputPrice: 0,
289274
outputPrice: 0,
290275
},

0 commit comments

Comments
 (0)