Skip to content

Commit dcfbb45

Browse files
committed
Cleanup getModel to fix test
1 parent 10cb6d8 commit dcfbb45

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/api/providers/xai.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,19 @@ export class XAIHandler extends BaseProvider implements SingleCompletionHandler
2222
}
2323

2424
override getModel() {
25-
const modelId = this.options.apiModelId
25+
// Determine which model ID to use (specified or default)
26+
const id =
27+
this.options.apiModelId && this.options.apiModelId in xaiModels
28+
? (this.options.apiModelId as XAIModelId)
29+
: xaiDefaultModelId
2630

27-
if (modelId && modelId in xaiModels) {
28-
const id = modelId as XAIModelId
29-
return { id, info: xaiModels[id] }
30-
}
31+
// Check if reasoning effort applies to this model
32+
const supportsReasoning = REASONING_MODELS.has(id)
3133

3234
return {
33-
id: xaiDefaultModelId,
34-
info: xaiModels[xaiDefaultModelId],
35-
reasoningEffort: REASONING_MODELS.has(xaiDefaultModelId) ? this.options.reasoningEffort : undefined,
35+
id,
36+
info: xaiModels[id],
37+
reasoningEffort: supportsReasoning ? this.options.reasoningEffort : undefined,
3638
}
3739
}
3840

0 commit comments

Comments
 (0)