fix(anthropic-effort): skip effort injection for Haiku models (#3308)
Haiku models do not support the effort parameter and return API errors when it is passed. The hook now explicitly checks for Haiku model patterns and skips effort injection, preventing silent title generation failures. Added EFFORT_UNSUPPORTED_PATTERN and isEffortUnsupportedModel() to detect and skip Haiku models. Fixes #3308
This commit is contained in:
@@ -147,6 +147,30 @@ describe("createAnthropicEffortHook", () => {
|
||||
|
||||
expect(output.options.effort).toBeUndefined()
|
||||
})
|
||||
|
||||
describe("#given haiku models (effort unsupported)", () => {
|
||||
const haikuModels = [
|
||||
"claude-haiku-4-5",
|
||||
"claude-haiku-4.6",
|
||||
"claude-haiku",
|
||||
"claude-haiku-20240307",
|
||||
]
|
||||
|
||||
for (const modelID of haikuModels) {
|
||||
it(`skips effort injection for ${modelID}`, async () => {
|
||||
// given
|
||||
const hook = createAnthropicEffortHook()
|
||||
const { input, output } = createMockParams({ modelID })
|
||||
|
||||
// when
|
||||
await hook["chat.params"](input, output)
|
||||
|
||||
// then
|
||||
expect(output.options.effort).toBeUndefined()
|
||||
expect(input.message.variant).toBe("max")
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
describe("existing options", () => {
|
||||
|
||||
Reference in New Issue
Block a user