feat(provider): load catalog request variants

This commit is contained in:
Aiden Cline 2026-07-21 22:58:11 -05:00
commit 75ab5ceae9
11 changed files with 207 additions and 243 deletions

View file

@ -55,7 +55,6 @@ const PROTOCOL_BODY_OVERLAY_DENYLIST = new Set([
"systemInstruction",
"system_instruction",
"temperature",
"thinking",
"toolChoice",
"toolConfig",
"tool_choice",

View file

@ -156,6 +156,32 @@ describe("request option precedence", () => {
}),
)
it.effect("allows provider thinking body overlays", () =>
LLMClient.generate(
LLM.request({
model: OpenAIChat.route
.with({
endpoint: { baseURL: "https://api.provider.test/v1/" },
auth: Auth.bearer("test"),
http: { body: { thinking: { type: "adaptive" } } },
})
.model({ id: "minimax-m3" }),
prompt: "Say hello.",
}),
).pipe(
Effect.provide(
dynamicResponse((input) => {
expect(decodeJson(input.text)).toMatchObject({ thinking: { type: "adaptive" } })
return Effect.succeed(
input.respond(sseEvents(deltaChunk({}, "stop")), {
headers: { "content-type": "text/event-stream" },
}),
)
}),
),
),
)
it.effect("uses model output limits after route limits and before call maxTokens", () =>
Effect.gen(function* () {
const route = AnthropicMessages.route.with({