Add modelReasoningEffort option to TypeScript SDK (#6237)
## Summary - Adds `ModelReasoningEffort` type to TypeScript SDK with values: `minimal`, `low`, `medium`, `high` - Adds `modelReasoningEffort` option to `ThreadOptions` - Forwards the option to the codex CLI via `--config model_reasoning_effort="<value>"` - Includes test coverage for the new option ## Changes - `sdk/typescript/src/threadOptions.ts`: Define `ModelReasoningEffort` type and add to `ThreadOptions` - `sdk/typescript/src/index.ts`: Export `ModelReasoningEffort` type - `sdk/typescript/src/exec.ts`: Forward `modelReasoningEffort` to CLI as config flag - `sdk/typescript/src/thread.ts`: Pass option through to exec (+ debug logging) - `sdk/typescript/tests/run.test.ts`: Add test for `modelReasoningEffort` flag forwarding --------- Co-authored-by: Eric Traut <etraut@openai.com>
This commit is contained in:
@@ -223,6 +223,37 @@ describe("Codex", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("passes modelReasoningEffort to exec", async () => {
|
||||
const { url, close } = await startResponsesTestProxy({
|
||||
statusCode: 200,
|
||||
responseBodies: [
|
||||
sse(
|
||||
responseStarted("response_1"),
|
||||
assistantMessage("Reasoning effort applied", "item_1"),
|
||||
responseCompleted("response_1"),
|
||||
),
|
||||
],
|
||||
});
|
||||
|
||||
const { args: spawnArgs, restore } = codexExecSpy();
|
||||
|
||||
try {
|
||||
const client = new Codex({ codexPathOverride: codexExecPath, baseUrl: url, apiKey: "test" });
|
||||
|
||||
const thread = client.startThread({
|
||||
modelReasoningEffort: "high",
|
||||
});
|
||||
await thread.run("apply reasoning effort");
|
||||
|
||||
const commandArgs = spawnArgs[0];
|
||||
expect(commandArgs).toBeDefined();
|
||||
expectPair(commandArgs, ["--config", 'model_reasoning_effort="high"']);
|
||||
} finally {
|
||||
restore();
|
||||
await close();
|
||||
}
|
||||
});
|
||||
|
||||
it("writes output schema to a temporary file and forwards it", async () => {
|
||||
const { url, close, requests } = await startResponsesTestProxy({
|
||||
statusCode: 200,
|
||||
|
||||
Reference in New Issue
Block a user