|
1 | 1 | import { describe, expect, test } from "bun:test" |
| 2 | +import { Effect } from "effect" |
2 | 3 | import { ProviderTransform } from "@/provider/transform" |
| 4 | +import { LLMRequestPrep } from "@/session/llm/request" |
3 | 5 | import { ProviderV2 } from "@opencode-ai/core/provider" |
4 | 6 | import { ModelV2 } from "@opencode-ai/core/model" |
5 | 7 |
|
@@ -294,6 +296,78 @@ describe("ProviderTransform.options - gpt-5 textVerbosity", () => { |
294 | 296 | expect(result.textVerbosity).toBe("low") |
295 | 297 | }) |
296 | 298 |
|
| 299 | + test("openai-compatible gpt-5 models omit Responses-only reasoningSummary", () => { |
| 300 | + const model = { |
| 301 | + ...createGpt5Model("gpt-5.4"), |
| 302 | + id: "cortecs/gpt-5.4", |
| 303 | + providerID: "cortecs", |
| 304 | + api: { |
| 305 | + id: "gpt-5.4", |
| 306 | + url: "https://api.cortecs.ai/v1", |
| 307 | + npm: "@ai-sdk/openai-compatible", |
| 308 | + }, |
| 309 | + } |
| 310 | + const result = ProviderTransform.options({ model, sessionID, providerOptions: {} }) |
| 311 | + expect(result.reasoningEffort).toBe("medium") |
| 312 | + expect(result.reasoningSummary).toBeUndefined() |
| 313 | + expect(result.include).toBeUndefined() |
| 314 | + }) |
| 315 | + |
| 316 | + test("azure chat completions omit Responses-only reasoning options after variants merge", async () => { |
| 317 | + const model = { |
| 318 | + ...createGpt5Model("gpt-5.4"), |
| 319 | + id: "azure/gpt-5.4", |
| 320 | + providerID: "azure", |
| 321 | + api: { |
| 322 | + id: "gpt-5.4", |
| 323 | + url: "https://azure.com", |
| 324 | + npm: "@ai-sdk/azure", |
| 325 | + }, |
| 326 | + variants: { |
| 327 | + high: { |
| 328 | + reasoningEffort: "high", |
| 329 | + reasoningSummary: "auto", |
| 330 | + include: ["reasoning.encrypted_content"], |
| 331 | + }, |
| 332 | + }, |
| 333 | + } |
| 334 | + const result = await Effect.runPromise( |
| 335 | + LLMRequestPrep.prepare({ |
| 336 | + user: { |
| 337 | + id: "msg_user-test", |
| 338 | + sessionID, |
| 339 | + role: "user", |
| 340 | + time: { created: Date.now() }, |
| 341 | + agent: "test", |
| 342 | + model: { providerID: "azure", modelID: "gpt-5.4", variant: "high" }, |
| 343 | + } as any, |
| 344 | + sessionID, |
| 345 | + model, |
| 346 | + agent: { |
| 347 | + name: "test", |
| 348 | + mode: "primary", |
| 349 | + options: {}, |
| 350 | + permission: [], |
| 351 | + } as any, |
| 352 | + system: [], |
| 353 | + messages: [{ role: "user", content: "Hello" }], |
| 354 | + tools: {}, |
| 355 | + provider: { id: "azure", options: { useCompletionUrls: true } } as any, |
| 356 | + auth: undefined, |
| 357 | + plugin: { |
| 358 | + trigger: (_name: string, _input: unknown, output: unknown) => Effect.succeed(output), |
| 359 | + list: () => Effect.succeed([]), |
| 360 | + init: () => Effect.void, |
| 361 | + } as any, |
| 362 | + flags: { outputTokenMax: 32_000, client: "test" } as any, |
| 363 | + isWorkflow: false, |
| 364 | + }), |
| 365 | + ) |
| 366 | + expect(result.params.options.reasoningEffort).toBe("high") |
| 367 | + expect(result.params.options.reasoningSummary).toBeUndefined() |
| 368 | + expect(result.params.options.include).toBeUndefined() |
| 369 | + }) |
| 370 | + |
297 | 371 | test("gpt-5.1 should have textVerbosity set to low", () => { |
298 | 372 | const model = createGpt5Model("gpt-5.1") |
299 | 373 | const result = ProviderTransform.options({ model, sessionID, providerOptions: {} }) |
|
0 commit comments