bingocode 1.1.203 → 1.1.204
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
CHANGED
|
@@ -15,6 +15,23 @@ import type {
|
|
|
15
15
|
OpenAITool,
|
|
16
16
|
} from './types.js'
|
|
17
17
|
|
|
18
|
+
// Params broadly supported by OpenAI-compatible chat completion upstreams.
|
|
19
|
+
// Anything outside this set (e.g. reasoning_effort) is dropped when
|
|
20
|
+
// BINGO_DROP_PARAMS is enabled to avoid upstream 400 rejections.
|
|
21
|
+
const OPENAI_CHAT_ALLOWED_PARAMS = new Set<keyof OpenAIChatRequest>([
|
|
22
|
+
'model',
|
|
23
|
+
'messages',
|
|
24
|
+
'max_tokens',
|
|
25
|
+
'max_completion_tokens',
|
|
26
|
+
'stream',
|
|
27
|
+
'temperature',
|
|
28
|
+
'top_p',
|
|
29
|
+
'stop',
|
|
30
|
+
'tools',
|
|
31
|
+
'tool_choice',
|
|
32
|
+
'frequency_penalty',
|
|
33
|
+
])
|
|
34
|
+
|
|
18
35
|
/**
|
|
19
36
|
* Convert Anthropic Messages request to OpenAI Chat Completions request.
|
|
20
37
|
*/
|
|
@@ -103,6 +120,16 @@ export function anthropicToOpenaiChat(body: AnthropicRequest): OpenAIChatRequest
|
|
|
103
120
|
}
|
|
104
121
|
}
|
|
105
122
|
|
|
123
|
+
// Drop params that upstreams (e.g. LiteLLM-routed providers) may reject.
|
|
124
|
+
// Default ON because many LiteLLM backends (together_ai, etc.) hard-fail on
|
|
125
|
+
// unknown params. Set BINGO_DROP_PARAMS=0/false to keep all params.
|
|
126
|
+
const dropParams = !/^(0|false|no)$/i.test(process.env.BINGO_DROP_PARAMS ?? '1')
|
|
127
|
+
if (dropParams) {
|
|
128
|
+
for (const key of Object.keys(result) as Array<keyof OpenAIChatRequest>) {
|
|
129
|
+
if (!OPENAI_CHAT_ALLOWED_PARAMS.has(key)) delete result[key]
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
106
133
|
return result
|
|
107
134
|
}
|
|
108
135
|
|
package/src/utils/context.ts
CHANGED
|
@@ -6,7 +6,9 @@ import { getCanonicalName } from './model/model.js'
|
|
|
6
6
|
import { getModelCapability } from './model/modelCapabilities.js'
|
|
7
7
|
|
|
8
8
|
// Model context window size (200k tokens for all models right now)
|
|
9
|
-
|
|
9
|
+
// Sized so the default auto-compact threshold lands at 786,432 tokens:
|
|
10
|
+
// 819,432 - 20,000 (summary reserve) - 13,000 (autocompact buffer) = 786,432
|
|
11
|
+
export const MODEL_CONTEXT_WINDOW_DEFAULT = 819_432
|
|
10
12
|
|
|
11
13
|
// Maximum output tokens for compact operations
|
|
12
14
|
export const COMPACT_MAX_OUTPUT_TOKENS = 20_000
|