Skip to content

Commit ee483b8

Browse files
committed
Support reasoning
1 parent d83b5b9 commit ee483b8

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/api/providers/chutes.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ export class ChutesHandler extends RouterProvider implements SingleCompletionHan
5353
params.temperature = this.options.modelTemperature ?? info.temperature
5454
}
5555

56+
// Add thinking parameter if reasoning is enabled and model supports it
57+
if (this.options.enableReasoningEffort && info.supportsReasoningBinary) {
58+
;(params as any).thinking = { type: "enabled" }
59+
}
60+
5661
return params
5762
}
5863

@@ -111,6 +116,10 @@ export class ChutesHandler extends RouterProvider implements SingleCompletionHan
111116
yield { type: "text", text: delta.content }
112117
}
113118

119+
if (delta && "reasoning_content" in delta && delta.reasoning_content) {
120+
yield { type: "reasoning", text: (delta.reasoning_content as string | undefined) || "" }
121+
}
122+
114123
if (chunk.usage) {
115124
yield {
116125
type: "usage",

src/api/providers/fetchers/chutes.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const ChutesModelSchema = z.object({
1414
context_length: z.number(),
1515
max_model_len: z.number(),
1616
input_modalities: z.array(z.string()),
17+
supported_features: z.array(z.string()).optional(),
1718
})
1819

1920
const ChutesModelsResponseSchema = z.object({ data: z.array(ChutesModelSchema) })
@@ -35,12 +36,14 @@ export async function getChutesModels(apiKey?: string): Promise<Record<string, M
3536
const contextWindow = m.context_length
3637
const maxTokens = m.max_model_len
3738
const supportsImages = m.input_modalities.includes("image")
39+
const supportsReasoningBinary = m.supported_features?.includes("reasoning") ?? false
3840

3941
const info: ModelInfo = {
4042
maxTokens,
4143
contextWindow,
4244
supportsImages,
4345
supportsPromptCache: false,
46+
supportsReasoningBinary,
4447
inputPrice: 0,
4548
outputPrice: 0,
4649
description: `Chutes AI model: ${m.id}`,

0 commit comments

Comments
 (0)