fix(ai): classify DeepInfra input length rejections as context overflow

This commit is contained in:
Aiden Cline
2026-09-29 13:12:42 -05:00
parent 599bdc982e
commit 812e2c1599
2 changed files with 3 additions and 0 deletions
+2
View File
@@ -26,6 +26,8 @@ const patterns = [
/tokens in request more than max tokens allowed/i, /tokens in request more than max tokens allowed/i,
/maximum prompt length is \d+/i, /maximum prompt length is \d+/i,
/reduce the length of the messages/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, /maximum context length is \d+ tokens/i,
/exceeds (?:the )?maximum allowed input length of [\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, /input \(\d+ tokens\) is longer than the model'?s context length \(\d+ tokens\)/i,
+1
View File
@@ -7,6 +7,7 @@ describe("provider error classification", () => {
const messages = [ const messages = [
"tokens in request more than max tokens allowed", "tokens in request more than max tokens allowed",
"Requested token count exceeds the model's maximum context length of 131072 tokens.", "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 (265330) exceeds model's maximum context length (262144).",
"Input length 131393 exceeds the maximum allowed input length of 131040 tokens.", "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 (516368 tokens) is longer than the model's context length (262144 tokens).",