bingocode 1.1.123 → 1.1.124
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.
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"permissions": {
|
|
3
3
|
"allow": [
|
|
4
|
-
"Bash(node:*)"
|
|
4
|
+
"Bash(node:*)",
|
|
5
|
+
"WebSearch",
|
|
6
|
+
"Bash(curl -s \"https://docs.anthropic.com/en/api/messages\" --max-time 30 -A \"Mozilla/5.0\")",
|
|
7
|
+
"Bash(curl -s \"https://docs.anthropic.com/en/api/messages-streaming\" --max-time 30 -A \"Mozilla/5.0\")",
|
|
8
|
+
"Bash(curl -sv \"https://docs.anthropic.com/en/api/messages\" --max-time 30)",
|
|
9
|
+
"Bash(curl -sv \"https://raw.githubusercontent.com/anthropics/anthropic-sdk-python/main/api.md\" --max-time 30)",
|
|
10
|
+
"Bash(curl -s \"https://raw.githubusercontent.com/anthropics/anthropic-sdk-python/refs/heads/main/README.md\" --max-time 30)"
|
|
5
11
|
]
|
|
6
12
|
}
|
|
7
13
|
}
|
package/package.json
CHANGED
|
@@ -58,6 +58,12 @@ export function anthropicToOpenaiChat(body: AnthropicRequest): OpenAIChatRequest
|
|
|
58
58
|
if (body.temperature !== undefined) result.temperature = body.temperature
|
|
59
59
|
if (body.top_p !== undefined) result.top_p = body.top_p
|
|
60
60
|
|
|
61
|
+
// frequency_penalty: suppress repetition loops during multi-tool-call sequences.
|
|
62
|
+
// Anthropic API has no equivalent; inject for all OpenAI-compatible upstreams.
|
|
63
|
+
// Configurable via BINGO_FREQUENCY_PENALTY (default 0.1).
|
|
64
|
+
const fp = parseFloat(process.env.BINGO_FREQUENCY_PENALTY ?? '0.1')
|
|
65
|
+
if (!isNaN(fp) && fp !== 0) result.frequency_penalty = fp
|
|
66
|
+
|
|
61
67
|
// stop_sequences → stop
|
|
62
68
|
if (body.stop_sequences && body.stop_sequences.length > 0) {
|
|
63
69
|
result.stop = body.stop_sequences
|
|
@@ -131,11 +137,14 @@ function convertUserMessage(blocks: AnthropicContentBlock[], output: OpenAIChatM
|
|
|
131
137
|
contentParts.push({ type: 'image_url', image_url: { url } })
|
|
132
138
|
} else if (block.type === 'tool_result') {
|
|
133
139
|
// tool_result → separate tool message
|
|
134
|
-
const
|
|
140
|
+
const rawContent = typeof block.content === 'string'
|
|
135
141
|
? block.content
|
|
136
142
|
: Array.isArray(block.content)
|
|
137
143
|
? block.content.filter((b): b is Extract<AnthropicContentBlock, { type: 'text' }> => b.type === 'text').map((b) => b.text).join('\n')
|
|
138
144
|
: ''
|
|
145
|
+
const resultContent = block.is_error
|
|
146
|
+
? `<error>${rawContent}</error>`
|
|
147
|
+
: rawContent
|
|
139
148
|
output.push({
|
|
140
149
|
role: 'tool',
|
|
141
150
|
tool_call_id: block.tool_use_id,
|
|
@@ -47,6 +47,12 @@ export function anthropicToOpenaiResponses(body: AnthropicRequest): OpenAIRespon
|
|
|
47
47
|
if (body.temperature !== undefined) result.temperature = body.temperature
|
|
48
48
|
if (body.top_p !== undefined) result.top_p = body.top_p
|
|
49
49
|
|
|
50
|
+
// frequency_penalty: suppress repetition loops during multi-tool-call sequences.
|
|
51
|
+
// Anthropic API has no equivalent; inject for all OpenAI-compatible upstreams.
|
|
52
|
+
// Configurable via BINGO_FREQUENCY_PENALTY (default 0.1).
|
|
53
|
+
const fp = parseFloat(process.env.BINGO_FREQUENCY_PENALTY ?? '0.1')
|
|
54
|
+
if (!isNaN(fp) && fp !== 0) result.frequency_penalty = fp
|
|
55
|
+
|
|
50
56
|
// tools
|
|
51
57
|
if (body.tools && body.tools.length > 0) {
|
|
52
58
|
result.tools = body.tools
|
|
@@ -128,11 +134,14 @@ function convertMessageToInputItems(msg: AnthropicMessage, output: OpenAIRespons
|
|
|
128
134
|
})
|
|
129
135
|
} else if (block.type === 'tool_result') {
|
|
130
136
|
// Lift to function_call_output item
|
|
131
|
-
const
|
|
137
|
+
const rawContent = typeof block.content === 'string'
|
|
132
138
|
? block.content
|
|
133
139
|
: Array.isArray(block.content)
|
|
134
140
|
? block.content.filter((b): b is Extract<AnthropicContentBlock, { type: 'text' }> => b.type === 'text').map((b) => b.text).join('\n')
|
|
135
141
|
: ''
|
|
142
|
+
const resultContent = block.is_error
|
|
143
|
+
? `<error>${rawContent}</error>`
|
|
144
|
+
: rawContent
|
|
136
145
|
output.push({
|
|
137
146
|
type: 'function_call_output',
|
|
138
147
|
call_id: block.tool_use_id,
|
|
@@ -43,6 +43,7 @@ export type OpenAIChatRequest = {
|
|
|
43
43
|
max_completion_tokens?: number
|
|
44
44
|
temperature?: number
|
|
45
45
|
top_p?: number
|
|
46
|
+
frequency_penalty?: number
|
|
46
47
|
stop?: string | string[]
|
|
47
48
|
stream?: boolean
|
|
48
49
|
tools?: OpenAITool[]
|
|
@@ -113,6 +114,7 @@ export type OpenAIResponsesRequest = {
|
|
|
113
114
|
max_output_tokens?: number
|
|
114
115
|
temperature?: number
|
|
115
116
|
top_p?: number
|
|
117
|
+
frequency_penalty?: number
|
|
116
118
|
stream?: boolean
|
|
117
119
|
tools?: OpenAITool[]
|
|
118
120
|
tool_choice?: unknown
|