mirror of
https://gitee.com/zhangsken/opencode.git
synced 2026-10-16 10:30:01 +08:00
fix(ai): classify Novita context length rejections as context overflow
This commit is contained in:
@@ -28,7 +28,8 @@ const patterns = [
|
|||||||
/reduce the length of the messages/i,
|
/reduce the length of the messages/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,
|
// 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 limit of \d+/i,
|
||||||
/exceeds the available context size/i,
|
/exceeds the available context size/i,
|
||||||
/greater than the context length/i,
|
/greater than the context length/i,
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ describe("provider error classification", () => {
|
|||||||
"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).",
|
||||||
|
"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",
|
"Prompt has 5,958,968 tokens, but the configured context size is 256,000 tokens",
|
||||||
"Range of input length should be [1, 129024]",
|
"Range of input length should be [1, 129024]",
|
||||||
"Too many tokens",
|
"Too many tokens",
|
||||||
|
|||||||
Reference in New Issue
Block a user