diff --git a/packages/ai/src/provider-error.ts b/packages/ai/src/provider-error.ts index 35b9cff7425..332600c0d91 100644 --- a/packages/ai/src/provider-error.ts +++ b/packages/ai/src/provider-error.ts @@ -26,6 +26,8 @@ const patterns = [ /tokens in request more than max tokens allowed/i, /maximum prompt length is \d+/i, /reduce the length of the messages/i, + // DeepInfra + /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, diff --git a/packages/ai/test/provider-error.test.ts b/packages/ai/test/provider-error.test.ts index 98a94c1b143..a27beca3e24 100644 --- a/packages/ai/test/provider-error.test.ts +++ b/packages/ai/test/provider-error.test.ts @@ -7,6 +7,7 @@ describe("provider error classification", () => { const messages = [ "tokens in request more than max tokens allowed", "Requested token count exceeds the model's maximum context length of 131072 tokens.", + "Requested input length 600010 exceeds maximum input length 131071", "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).",