diff --git a/packages/ai/src/provider-error.ts b/packages/ai/src/provider-error.ts index 39f9875086d..c622bb48bf6 100644 --- a/packages/ai/src/provider-error.ts +++ b/packages/ai/src/provider-error.ts @@ -30,7 +30,8 @@ const patterns = [ /requested input length \d+ exceeds maximum input length/i, /maximum context length is \d+ tokens/i, /exceeds (?:the )?maximum allowed input length of [\d,]+ tokens?/i, - /input \(\d+ tokens\) is longer than the model'?s context length \(\d+ tokens\)/i, + // Novita omits the token counts. + /input(?: \(\d+ tokens\))? is longer than the model'?s context length/i, /exceeds the limit of \d+/i, /exceeds the available context size/i, /greater than the context length/i, diff --git a/packages/ai/test/provider-error.test.ts b/packages/ai/test/provider-error.test.ts index a6857c49b97..df8f396b825 100644 --- a/packages/ai/test/provider-error.test.ts +++ b/packages/ai/test/provider-error.test.ts @@ -11,6 +11,7 @@ describe("provider error classification", () => { "Input length (265330) exceeds model's maximum context length (262144).", "Input length 131393 exceeds the maximum allowed input length of 131040 tokens.", "The input (516368 tokens) is longer than the model's context length (262144 tokens).", + "The input is longer than the model's context length trace_id: 39d8c3a5c6c91dbc8dd9055f0b37e084", "Prompt has 5,958,968 tokens, but the configured context size is 256,000 tokens", "Range of input length should be [1, 129024]", "Too many tokens",