@jeffusion/bungee-llms 3.3.0 → 4.0.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/dist/index.js +844 -633
- package/dist/plugin-api.js +3924 -3713
- package/dist/protocol-converters/anthropic-to-openai.converter.d.ts +22 -18
- package/package.json +2 -2
|
@@ -16,33 +16,31 @@ export declare class AnthropicToOpenAIConverter implements AIConverter {
|
|
|
16
16
|
readonly from = "anthropic";
|
|
17
17
|
readonly to = "openai";
|
|
18
18
|
private configuredApiMode?;
|
|
19
|
-
private readonly protocolConversion;
|
|
20
|
-
private readonly runtime;
|
|
21
|
-
constructor();
|
|
22
19
|
setApiMode(mode: unknown): void;
|
|
23
20
|
setRuntimeOptions(options: unknown): void;
|
|
24
|
-
private parseIntegerOption;
|
|
25
|
-
private resolveReasoningMaxCompletionTokens;
|
|
26
21
|
private resolveTargetApiMode;
|
|
27
22
|
/**
|
|
28
23
|
* 修改请求:转换为 OpenAI Chat Completions 格式
|
|
29
24
|
*/
|
|
30
25
|
onBeforeRequest(ctx: MutableRequestContext): Promise<void>;
|
|
31
|
-
private canUseRuntimeRequestConversion;
|
|
32
26
|
private isAnthropicCountTokensPath;
|
|
33
27
|
private buildOpenAICountTokensRequest;
|
|
34
28
|
/**
|
|
35
29
|
* 构建 OpenAI 请求
|
|
36
30
|
*/
|
|
37
31
|
private buildOpenAIRequest;
|
|
38
|
-
private
|
|
39
|
-
private resolveAnthropicThinkingEffort;
|
|
40
|
-
private resolveOutputConfigEffort;
|
|
41
|
-
private normalizeOpenAIReasoningEffort;
|
|
42
|
-
private supportsXHighReasoningEffort;
|
|
32
|
+
private isOpenAINumericOSeriesModel;
|
|
43
33
|
private buildOpenAIResponsesRequest;
|
|
34
|
+
private convertAnthropicSystemToInstructions;
|
|
35
|
+
private convertAnthropicMessagesToResponsesInput;
|
|
36
|
+
private convertAnthropicImageSourceToUrl;
|
|
37
|
+
private mapAnthropicToolChoiceToResponses;
|
|
38
|
+
private resolveAnthropicReasoningEffort;
|
|
39
|
+
private supportsReasoningEffort;
|
|
44
40
|
private convertSystemMessages;
|
|
45
|
-
private
|
|
41
|
+
private sanitizeSystemText;
|
|
42
|
+
private extractTextFromOpenAIContent;
|
|
43
|
+
private normalizeOpenAISystemMessages;
|
|
46
44
|
/**
|
|
47
45
|
* 转换 User 消息
|
|
48
46
|
*/
|
|
@@ -53,10 +51,10 @@ export declare class AnthropicToOpenAIConverter implements AIConverter {
|
|
|
53
51
|
* 转换 Assistant 消息
|
|
54
52
|
*/
|
|
55
53
|
private convertAssistantMessage;
|
|
56
|
-
private
|
|
57
|
-
private mapAnthropicToolChoiceToOpenAI;
|
|
58
|
-
private parseOpenAIImageUrlSource;
|
|
54
|
+
private normalizeOpenAIMessageContent;
|
|
59
55
|
private normalizeToolParametersSchema;
|
|
56
|
+
private cleanOpenAIToolSchema;
|
|
57
|
+
private resolvePromptCacheKey;
|
|
60
58
|
private normalizeJsonSchema;
|
|
61
59
|
/**
|
|
62
60
|
* 处理非流式响应:OpenAI → Anthropic
|
|
@@ -70,25 +68,31 @@ export declare class AnthropicToOpenAIConverter implements AIConverter {
|
|
|
70
68
|
private isLikelyOpenAISuccessBody;
|
|
71
69
|
private isResponsesApiBody;
|
|
72
70
|
private extractReasoningSummaryTexts;
|
|
73
|
-
private
|
|
74
|
-
private appendParsedContent;
|
|
75
|
-
private extractChatCompletionReasoningTexts;
|
|
71
|
+
private extractStrictResponsesReasoningText;
|
|
76
72
|
private extractReasoningTextFromDeltaContentPart;
|
|
77
73
|
private extractChatThinkingDelta;
|
|
78
74
|
private getChatUsedIndices;
|
|
79
75
|
private allocateChatContentBlockIndex;
|
|
80
76
|
private ensureChatTextBlockStarted;
|
|
81
77
|
private ensureChatThinkingBlockStarted;
|
|
78
|
+
private closeChatNonToolBlock;
|
|
82
79
|
private resolveChatToolIndex;
|
|
83
80
|
private resolveResponsesReasoningIndex;
|
|
81
|
+
private nextResponsesContentIndex;
|
|
82
|
+
private resolveResponsesContentIndex;
|
|
83
|
+
private ensureResponsesTextBlockStarted;
|
|
84
|
+
private resolveResponsesToolIndex;
|
|
84
85
|
private ensureResponsesThinkingBlockStarted;
|
|
85
86
|
private emitResponsesThinkingDelta;
|
|
86
87
|
private extractResponsesReasoningDeltaText;
|
|
87
88
|
private convertOpenAIResponsesToAnthropic;
|
|
89
|
+
private mapResponsesStopReason;
|
|
90
|
+
private buildAnthropicUsageFromResponses;
|
|
88
91
|
/**
|
|
89
92
|
* 转换 OpenAI 响应为 Anthropic 格式
|
|
90
93
|
*/
|
|
91
94
|
private convertOpenAIResponseToAnthropic;
|
|
95
|
+
private parseToolArguments;
|
|
92
96
|
/**
|
|
93
97
|
* 处理流式响应:OpenAI chunk → Anthropic SSE
|
|
94
98
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jeffusion/bungee-llms",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "Extensible LLM adapters and protocol conversion package for Bungee",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"prepublishOnly": "bun run build"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@jeffusion/bungee-types": "^
|
|
14
|
+
"@jeffusion/bungee-types": "^4.0.0"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"bun-types": "^1.3.2",
|