Skip to content

Commit 9051a21

Browse files
committed
feat: add model reasoning efforts configuration and integrate into message translation
1 parent 32cb10a commit 9051a21

2 files changed

Lines changed: 20 additions & 3 deletions

File tree

src/lib/config.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { PATHS } from "./paths"
66
export interface AppConfig {
77
extraPrompts?: Record<string, string>
88
smallModel?: string
9+
modelReasoningEfforts?: Record<string, "minimal" | "low" | "medium" | "high">
910
}
1011

1112
const defaultConfig: AppConfig = {
@@ -29,6 +30,9 @@ When using the TodoWrite tool, follow these rules:
2930
`,
3031
},
3132
smallModel: "gpt-5-mini",
33+
modelReasoningEfforts: {
34+
"gpt-5-mini": "low",
35+
},
3236
}
3337

3438
let cachedConfig: AppConfig | null = null
@@ -71,7 +75,7 @@ function readConfigFromDisk(): AppConfig {
7175

7276
export function getConfig(): AppConfig {
7377
if (!cachedConfig) {
74-
cachedConfig = readConfigFromDisk()
78+
cachedConfig ??= readConfigFromDisk()
7579
}
7680
return cachedConfig
7781
}
@@ -85,3 +89,10 @@ export function getSmallModel(): string {
8589
const config = getConfig()
8690
return config.smallModel ?? "gpt-5-mini"
8791
}
92+
93+
export function getReasoningEffortForModel(
94+
model: string,
95+
): "minimal" | "low" | "medium" | "high" {
96+
const config = getConfig()
97+
return config.modelReasoningEfforts?.[model] ?? "high"
98+
}

src/routes/messages/responses-translation.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import consola from "consola"
22

3-
import { getExtraPromptForModel } from "~/lib/config"
3+
import {
4+
getExtraPromptForModel,
5+
getReasoningEffortForModel,
6+
} from "~/lib/config"
47
import {
58
type ResponsesPayload,
69
type ResponseInputContent,
@@ -73,7 +76,10 @@ export const translateAnthropicMessagesToResponsesPayload = (
7376
stream: payload.stream ?? null,
7477
store: false,
7578
parallel_tool_calls: true,
76-
reasoning: { effort: "high", summary: "detailed" },
79+
reasoning: {
80+
effort: getReasoningEffortForModel(payload.model),
81+
summary: "detailed",
82+
},
7783
include: ["reasoning.encrypted_content"],
7884
}
7985

0 commit comments

Comments
 (0)