@oh-my-pi/pi-ai 11.4.1 → 11.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/utils/overflow.ts +3 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oh-my-pi/pi-ai",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.5.0",
|
|
4
4
|
"description": "Unified LLM API with automatic model discovery and provider configuration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"@connectrpc/connect-node": "^2.1.1",
|
|
64
64
|
"@google/genai": "^1.39.0",
|
|
65
65
|
"@mistralai/mistralai": "^1.13.0",
|
|
66
|
-
"@oh-my-pi/pi-utils": "11.
|
|
66
|
+
"@oh-my-pi/pi-utils": "11.5.0",
|
|
67
67
|
"@sinclair/typebox": "^0.34.48",
|
|
68
68
|
"@smithy/node-http-handler": "^4.4.9",
|
|
69
69
|
"ajv": "^8.17.1",
|
package/src/utils/overflow.ts
CHANGED
|
@@ -19,6 +19,7 @@ import type { AssistantMessage } from "../types";
|
|
|
19
19
|
* - GitHub Copilot: "prompt token count of X exceeds the limit of Y"
|
|
20
20
|
* - MiniMax: "invalid params, context window exceeds limit"
|
|
21
21
|
* - Kimi For Coding: "Your request exceeded model token limit: X (requested: Y)"
|
|
22
|
+
* - Anthropic 413: "request_too_large" / "Request exceeds the maximum size" (payload too large)
|
|
22
23
|
* - Cerebras: Returns "400/413 status code (no body)" - handled separately below
|
|
23
24
|
* - Mistral: Returns "400/413 status code (no body)" - handled separately below
|
|
24
25
|
* - z.ai: Does NOT error, accepts overflow silently - handled via usage.input > contextWindow
|
|
@@ -40,6 +41,7 @@ const OVERFLOW_PATTERNS = [
|
|
|
40
41
|
/context[_ ]length[_ ]exceeded/i, // Generic fallback
|
|
41
42
|
/too many tokens/i, // Generic fallback
|
|
42
43
|
/token limit exceeded/i, // Generic fallback
|
|
44
|
+
/request_too_large/i, // Anthropic 413 (request body too large)
|
|
43
45
|
];
|
|
44
46
|
|
|
45
47
|
/**
|
|
@@ -65,6 +67,7 @@ const OVERFLOW_PATTERNS = [
|
|
|
65
67
|
* - llama.cpp: "exceeds the available context size"
|
|
66
68
|
* - LM Studio: "greater than the context length"
|
|
67
69
|
* - Kimi For Coding: "exceeded model token limit: X (requested: Y)"
|
|
70
|
+
* - Anthropic 413: "request_too_large" (request body exceeds size limit)
|
|
68
71
|
*
|
|
69
72
|
* **Unreliable detection:**
|
|
70
73
|
* - z.ai: Sometimes accepts overflow silently (detectable via usage.input > contextWindow),
|