Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/benchmarks/benchmark-config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,14 @@ describe("benchmark config", () => {
assertLeft(result);
});

it("requires reasoningEffort in model benchmark configs", () => {
it("accepts model benchmark configs without reasoningEffort", () => {
const result = parseSchema(BenchmarkRunConfigSchema, {
benchmarkId: "gpqa_diamond",
model: "openai/gpt-5",
});

assertLeft(result);
assertRight(result);
expect(result.right).not.toHaveProperty("reasoningEffort");
});

it("parses injected benchmark configs with opaque options", () => {
Expand Down
2 changes: 1 addition & 1 deletion src/benchmarks/benchmark-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export type GeminiMediaResolution = ValueOf<typeof GEMINI_MEDIA_RESOLUTIONS>;
export const InferenceOverrideSchema = z.object({
temperature: z.number().optional(),
maxTokens: z.number().optional(),
reasoningEffort: z.enum(REASONING_EFFORTS),
reasoningEffort: z.enum(REASONING_EFFORTS).optional(),
costTier: z.enum(COST_TIERS).optional(),
timeoutMs: z.number().optional(),
sort: z.nativeEnum(ProviderSort).optional(),
Expand Down
4 changes: 4 additions & 0 deletions src/benchmarks/search/core/request.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,10 @@ describe("buildSearchRequestBody", () => {
expect(body.temperature).toBe(0);
expect(body.reasoning).toEqual({ effort: "high" });
});
it("omits reasoning when no effort is requested", () => {
const body = buildSearchRequestBody({ ...BASE, lane: lane({}) });
expect(body).not.toHaveProperty("reasoning");
});
it("threads the candidate models list and omits it by default", () => {
const routed = buildSearchRequestBody({
...BASE,
Expand Down
7 changes: 5 additions & 2 deletions src/benchmarks/search/core/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export interface SearchRequestOptions {
readonly lane: SearchLaneConfig;
readonly maxOutputTokens?: number;
readonly temperature?: number;
readonly reasoningEffort: ReasoningEffort;
readonly reasoningEffort?: ReasoningEffort;
readonly sort?: ProviderSort;
readonly providerOrder?: readonly string[];
readonly providerOnly?: readonly string[];
Expand Down Expand Up @@ -127,7 +127,10 @@ export function buildSearchRequestBody(
models: opts.models === undefined ? undefined : [...opts.models],
maxOutputTokens: opts.maxOutputTokens,
temperature: opts.temperature,
reasoning: { effort: opts.reasoningEffort },
reasoning:
opts.reasoningEffort !== undefined
? { effort: opts.reasoningEffort }
: undefined,
provider:
opts.sort !== undefined ||
opts.providerOrder !== undefined ||
Expand Down
2 changes: 1 addition & 1 deletion src/benchmarks/search/core/solver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export interface SearchSolverOptions {
readonly timeoutMs?: number;
readonly maxOutputTokens?: number;
readonly temperature?: number;
readonly reasoningEffort: ReasoningEffort;
readonly reasoningEffort?: ReasoningEffort;
readonly endpointId?: string;
readonly sort?: ProviderSort;
readonly providerOrder?: readonly string[];
Expand Down
22 changes: 22 additions & 0 deletions src/cli/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,28 @@ describe("bench-harness CLI", () => {
);
});

it("leaves reasoning effort unset for --reasoning-effort default", () => {
const args = parseArgs([
"--benchmark",
"gpqa_diamond",
"--model",
"openrouter/jev",
"--reasoning-effort",
"default",
]);
expect(args.reasoningEffort).toBeUndefined();
const config = buildBenchmarkConfig({
benchmarkId: "gpqa_diamond",
model: "openrouter/jev",
panelConfig: undefined,
artifactDir: undefined,
endpointId: undefined,
imageDetail: undefined,
reasoningEffort: args.reasoningEffort,
});
expect(config).not.toHaveProperty("reasoningEffort");
});

it("rejects an invalid --reasoning-effort value", () => {
expect(() => parseArgs(["--reasoning-effort", "invalid"])).toThrow(
"--reasoning-effort must be one of"
Expand Down
20 changes: 14 additions & 6 deletions src/cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ interface CliArgs {
readonly resumeId?: string;
readonly imageDetail?: ImageDetail;
readonly costTier?: CostTier;
readonly reasoningEffort: ReasoningEffort;
readonly reasoningEffort: ReasoningEffort | undefined;
}

export function parseArgs(argv: readonly string[]): CliArgs {
Expand Down Expand Up @@ -190,7 +190,7 @@ function main(): Promise<void> {
reasoningEffort: args.reasoningEffort,
});
process.stderr.write(
`Running ${args.benchmark}${args.model !== undefined ? ` on ${args.model}` : ""}${args.solverConfig !== undefined ? ` (solver-config=${args.solverConfig})` : ""}${artifactDir !== undefined ? ` (artifact-dir=${artifactDir})` : ""} (epochs=${epochs}, concurrency=${args.concurrency}, reasoning-effort=${args.reasoningEffort}${range !== undefined ? `, range=${range.start ?? 0}..${range.end ?? "end"}` : ""}, session=${sessionId})...\n`
`Running ${args.benchmark}${args.model !== undefined ? ` on ${args.model}` : ""}${args.solverConfig !== undefined ? ` (solver-config=${args.solverConfig})` : ""}${artifactDir !== undefined ? ` (artifact-dir=${artifactDir})` : ""} (epochs=${epochs}, concurrency=${args.concurrency}, reasoning-effort=${args.reasoningEffort ?? MODEL_DEFAULT_REASONING_EFFORT}${range !== undefined ? `, range=${range.start ?? 0}..${range.end ?? "end"}` : ""}, session=${sessionId})...\n`
);
const total = yield* promise(() =>
resolveTotalEvaluations(args.benchmark, range, epochs)
Expand Down Expand Up @@ -304,13 +304,20 @@ function validateCostTier(raw: string | undefined): CostTier | undefined {
return raw;
}

function validateReasoningEffort(raw: string | undefined): ReasoningEffort {
const MODEL_DEFAULT_REASONING_EFFORT = "default";

function validateReasoningEffort(
raw: string | undefined
): ReasoningEffort | undefined {
if (raw === undefined) {
return DEFAULT_REASONING_EFFORT;
}
if (raw === MODEL_DEFAULT_REASONING_EFFORT) {
return undefined;
}
if (!isMember(raw, REASONING_EFFORTS)) {
throw new Error(
`--reasoning-effort must be one of: ${REASONING_EFFORTS.join(", ")} (got "${raw}")`
`--reasoning-effort must be one of: ${[...REASONING_EFFORTS, MODEL_DEFAULT_REASONING_EFFORT].join(", ")} (got "${raw}")`
);
}
return raw;
Expand All @@ -330,7 +337,7 @@ function buildSchemaValidatedConfig(opts: {
panelConfig: unknown;
imageDetail?: ImageDetail;
costTier?: CostTier;
reasoningEffort: ReasoningEffort;
reasoningEffort: ReasoningEffort | undefined;
}): BenchmarkRunConfig {
const {
benchmarkId,
Expand Down Expand Up @@ -372,6 +379,7 @@ function buildSchemaValidatedConfig(opts: {
: undefined;
if (
optionsSchema !== undefined &&
reasoningEffort !== undefined &&
Object.hasOwn(optionsSchema.shape, "agentReasoningEffort") &&
!(
typeof panelConfig === "object" &&
Expand Down Expand Up @@ -410,7 +418,7 @@ export function buildBenchmarkConfig(opts: {
endpointId: string | undefined;
imageDetail: ImageDetail | undefined;
costTier?: CostTier;
reasoningEffort: ReasoningEffort;
reasoningEffort: ReasoningEffort | undefined;
}): BenchmarkRunConfig {
const {
benchmarkId,
Expand Down
2 changes: 1 addition & 1 deletion src/harness/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export interface GenerateConfig {
readonly maxTokens?: number;
readonly endpointId?: string;
readonly tools?: readonly ToolDefinition[];
readonly reasoningEffort: ReasoningEffort;
readonly reasoningEffort?: ReasoningEffort;
readonly costTier?: CostTier;
readonly timeoutMs?: number;
readonly sort?: ProviderSort;
Expand Down
1 change: 1 addition & 0 deletions src/providers/responses-model.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ describe("responses-model", () => {
},
]);
expect(sentOptions?.extraBody).toBeUndefined();
expect(sentBody).not.toHaveProperty("reasoning");
expect(exit.value.outputItems).toEqual([
{
type: "function_call",
Expand Down
5 changes: 4 additions & 1 deletion src/providers/responses-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,11 @@ export function generate(
? [...genConfig.tools]
: undefined,
}),
reasoning: { effort: genConfig.reasoningEffort },
...definedValues({
reasoning:
genConfig.reasoningEffort !== undefined
? { effort: genConfig.reasoningEffort }
: undefined,
provider: sendProvider ? providerPreferences : undefined,
}),
...definedValues({
Expand Down
Loading