diff --git a/packages/test-support/llm-replay/src/index.ts b/packages/test-support/llm-replay/src/index.ts index 103ff2d881..065b19a3e9 100644 --- a/packages/test-support/llm-replay/src/index.ts +++ b/packages/test-support/llm-replay/src/index.ts @@ -1151,6 +1151,13 @@ export interface Config { function validateConfiguredModels(providers: ReplayProviderConfig[] | undefined): void { for (const provider of providers ?? []) { for (const model of provider.models ?? []) { + if (model.floorReasoningEffort !== undefined + && !model.reasoningEfforts?.includes(model.floorReasoningEffort)) { + throw new Error( + `llm-replay: provider "${provider.id}" model "${model.id}" floorReasoningEffort ` + + 'must appear in reasoningEfforts', + ) + } const modalities: unknown = model.inputModalities if (modalities !== undefined && (!Array.isArray(modalities) || !modalities.every((modality: unknown) => modality === 'text' || modality === 'image'))) { diff --git a/packages/test-support/llm-replay/tests/llm-replay.spec.ts b/packages/test-support/llm-replay/tests/llm-replay.spec.ts index eeff300274..fef2eb23bc 100644 --- a/packages/test-support/llm-replay/tests/llm-replay.spec.ts +++ b/packages/test-support/llm-replay/tests/llm-replay.spec.ts @@ -2161,7 +2161,13 @@ describe('apply (the plugin entry)', () => { apply(ctx, { file, providers: [ - { id: 'm', models: [{ id: 'm', inputModalities: ['image'] }, { id: 'text' }] }, + { + id: 'm', + models: [ + { id: 'm', inputModalities: ['image'], reasoningEfforts: ['low'], floorReasoningEffort: 'low' }, + { id: 'text' }, + ], + }, { id: 'empty' }, ], paceMs: 1, @@ -2204,6 +2210,17 @@ describe('apply (the plugin entry)', () => { expect(ctx.llm.imageRequestPricing('deepseek', 'plain')).toBeUndefined() }) + it.each([undefined, [], ['high']])('rejects a floor absent from configured efforts %s', (reasoningEfforts) => { + const ctx = new Context() + const model = { + id: 'm', floorReasoningEffort: 'low', + ...reasoningEfforts === undefined ? {} : { reasoningEfforts }, + } + expect(() => { apply(ctx, { file, providers: [{ id: 'm', models: [model] }] }) }).toThrow( + 'llm-replay: provider "m" model "m" floorReasoningEffort must appear in reasoningEfforts', + ) + }) + it('rejects imageRequestTokens on a model without the image modality during load', () => { const ctx = new Context() const providers = [{ id: 'm', models: [{ id: 'm', imageRequestTokens: 384 }] }] as