File size: 7,265 Bytes
e249c6d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | import {
type FailoverClassificationCorpusRow,
billingSource,
contextOverflow,
errorsSource,
messageRows,
failoverSignalRows,
patternsSource,
structuredSource,
} from "./failover-classification.corpus.test-support.js";
export const overflowCases = [
// Context overflow.
...failoverSignalRows(billingSource, contextOverflow, [
["billing-context-request-too-large", { message: "request_too_large" }],
["billing-context-maximum-size", { message: "Request exceeds the maximum size" }],
["billing-context-length-exceeded", { message: "context length exceeded" }],
["billing-context-maximum-length", { message: "Maximum context length" }],
[
"billing-context-prompt-token-count",
{ message: "prompt is too long: 208423 tokens > 200000 maximum" },
],
["billing-context-compaction-failed", { message: "Context overflow: Summarization failed" }],
["billing-context-413", { message: "413 Request Entity Too Large" }],
[
"billing-context-anthropic-json",
{
provider: "anthropic",
message:
'{"type":"error","error":{"type":"invalid_request_error","message":"Request size exceeds model context window"}}',
},
],
[
"billing-context-anthropic-400-json",
{
provider: "anthropic",
message:
'400 {"type":"error","error":{"type":"invalid_request_error","message":"Request size exceeds model context window"}}',
},
],
[
"billing-context-kimi-limit",
{
message:
"Invalid request: Your request exceeded model token limit: 262144 (requested: 291351)",
},
],
[
"billing-context-kimi-status",
{
message:
"error, status code: 400, message: Invalid request: Your request exceeded model token limit: 262144 (requested: 291351)",
},
],
[
"billing-context-max-tokens-sum",
{
message: "input length and max_tokens exceed context limit (i.e 156321 + 48384 > 200000)",
},
],
[
"billing-context-model-maximum",
{ message: "This request exceeds the model's maximum context length" },
],
[
"billing-context-max-tokens-window",
{ message: "LLM request rejected: max_tokens would exceed context window" },
],
[
"billing-context-input-budget",
{ message: "input length would exceed context budget for this model" },
],
// FIXED(refactor-06): PR 2 removed the embedded-429 false positive; the provider wording is overflow.
[
"billing-context-input-length-model-limit",
{ message: "input length 14295 tokens exceeds the model limit" },
],
[
"billing-context-stop-reason",
{ message: "Unhandled stop reason: model_context_window_exceeded" },
],
["billing-context-chinese-too-long", { message: "错误:上下文过长,请减少输入" }],
["billing-context-chinese-compress", { message: "请压缩上下文后重试" }],
[
"billing-context-404-vertex",
{ message: "HTTP 404: INVALID_ARGUMENT: input exceeds the maximum number of tokens" },
],
]),
...failoverSignalRows(patternsSource, contextOverflow, [
[
"patterns-context-bedrock-validation",
{ message: "ValidationException: The input is too long for the model" },
],
[
"patterns-context-bedrock-token-count",
{
message:
"ValidationException: Input token count exceeds the maximum number of input tokens",
},
],
[
"patterns-context-bedrock-stream",
{ message: "ModelStreamErrorException: Input is too long for this model" },
],
[
"patterns-context-vertex",
{ message: "INVALID_ARGUMENT: input exceeds the maximum number of tokens" },
],
[
"patterns-context-ollama",
{ message: "ollama error: context length exceeded, too many tokens" },
],
["patterns-context-mistral", { message: "mistral: input is too long for this model" }],
[
"patterns-context-cohere",
{ message: "total tokens exceeds the model's maximum limit of 4096" },
],
["patterns-context-llamacpp-exceeded", { message: "Context size has been exceeded." }],
["patterns-context-llamacpp-exceeded-400", { message: "400 Context size has been exceeded." }],
["patterns-context-llamacpp-exceeded-500", { message: "500 Context size has been exceeded." }],
[
"patterns-context-llamacpp-available",
{
message:
"400 request (66202 tokens) exceeds the available context size (65536 tokens), try increasing it",
},
],
[
"patterns-context-llamacpp-no-the",
{ message: "request (130000 tokens) exceeds available context size (131072 tokens)" },
],
[
"patterns-context-llamacpp-prompt",
{
message:
"prompt (8500 tokens) exceeds the available context size (8192 tokens), try increasing it",
},
],
[
"patterns-context-ds4",
{
message: "400 Prompt has 256468 tokens, but the configured context size is 256000 tokens",
},
],
]),
...failoverSignalRows(structuredSource, contextOverflow, [
[
"structured-context-raw-invalid-request",
{
provider: "anthropic",
message:
'{"type":"error","error":{"type":"invalid_request_error","message":"Request size exceeds model context window"}}',
},
],
[
"structured-context-typed-invalid-request",
{
provider: "anthropic",
errorType: "invalid_request_error",
message: "Request size exceeds model context window",
},
],
]),
{
id: "errors-context-codex-prompt-window",
source: errorsSource,
signal: {
message:
"Codex ran out of room in the model's context window. Start a new thread or clear earlier history before retrying.",
},
expected: contextOverflow,
},
...messageRows(billingSource, contextOverflow, [
{
id: "billing-context-model-token-limit-short",
message: "Your request exceeded model token limit",
},
{
id: "billing-context-window-limit",
message: "The request size exceeds model context window limit",
},
{ id: "billing-context-window-code", message: "context_window_exceeded" },
{ id: "billing-context-chinese-exceeds", message: "上下文超出限制" },
{ id: "billing-context-chinese-model-max", message: "上下文长度超出模型最大限制" },
{ id: "billing-context-chinese-maximum", message: "超出最大上下文长度" },
{
id: "billing-context-compaction-json",
message: 'Context overflow: Summarization failed: 400 {"message":"prompt is too long"}',
},
{ id: "billing-context-compaction-prompt", message: "Compaction failed: prompt is too long" },
]),
...messageRows(patternsSource, contextOverflow, [
{ id: "patterns-context-generic-input", message: "input is too long for model gpt-5.4" },
{ id: "patterns-context-ollama-short", message: "ollama error: context length exceeded" },
{
id: "patterns-context-prompt-token-limit",
message: "prompt is too long: 150000 tokens > 128000 maximum",
},
]),
] satisfies readonly FailoverClassificationCorpusRow[];
|