llm-proxy 1.8.0 → 1.8.1
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.
|
@@ -13,20 +13,23 @@ class InputFormatAdapter {
|
|
|
13
13
|
case types_1.Providers.OPENAI_COMPATIBLE_PROVIDER:
|
|
14
14
|
return {
|
|
15
15
|
// @ts-ignore: Ignore the any type in the msg
|
|
16
|
-
adaptedMessages: messages.map(msg => {
|
|
16
|
+
adaptedMessages: messages.map((msg) => {
|
|
17
17
|
var _a, _b;
|
|
18
18
|
if (msg.role === "function") {
|
|
19
19
|
return {
|
|
20
20
|
role: msg.role,
|
|
21
21
|
content: (_a = msg.content) !== null && _a !== void 0 ? _a : "",
|
|
22
|
-
|
|
22
|
+
...(msg.thought_signature && {
|
|
23
|
+
thought_signature: msg.thought_signature,
|
|
24
|
+
}),
|
|
25
|
+
name: msg.name,
|
|
23
26
|
};
|
|
24
27
|
}
|
|
25
28
|
return {
|
|
26
29
|
role: msg.role,
|
|
27
|
-
content: (_b = msg.content) !== null && _b !== void 0 ? _b :
|
|
30
|
+
content: (_b = msg.content) !== null && _b !== void 0 ? _b : msg.function_call,
|
|
28
31
|
};
|
|
29
|
-
})
|
|
32
|
+
}),
|
|
30
33
|
};
|
|
31
34
|
case types_1.Providers.ANTHROPIC_BEDROCK: {
|
|
32
35
|
if (!messages.length) {
|
|
@@ -40,7 +43,7 @@ class InputFormatAdapter {
|
|
|
40
43
|
const systemPrompt = (_a = firstMessage.content) !== null && _a !== void 0 ? _a : "";
|
|
41
44
|
const adaptedMessages = [];
|
|
42
45
|
// @ts-ignore: Ignore the any type in the msg
|
|
43
|
-
restMessages.forEach(msg => {
|
|
46
|
+
restMessages.forEach((msg) => {
|
|
44
47
|
var _a, _b;
|
|
45
48
|
if (msg.role !== "user" && msg.role !== "assistant") {
|
|
46
49
|
// Add the "empty" message before the current one
|
|
@@ -49,9 +52,9 @@ class InputFormatAdapter {
|
|
|
49
52
|
content: [
|
|
50
53
|
{
|
|
51
54
|
type: types_1.BedrockAnthropicContentType.TEXT,
|
|
52
|
-
text: ":"
|
|
53
|
-
}
|
|
54
|
-
]
|
|
55
|
+
text: ":",
|
|
56
|
+
},
|
|
57
|
+
],
|
|
55
58
|
});
|
|
56
59
|
// Change the role to "assistant" for the current message
|
|
57
60
|
adaptedMessages.push({
|
|
@@ -59,9 +62,9 @@ class InputFormatAdapter {
|
|
|
59
62
|
content: [
|
|
60
63
|
{
|
|
61
64
|
type: types_1.BedrockAnthropicContentType.TEXT,
|
|
62
|
-
text: (_a = msg.content) !== null && _a !== void 0 ? _a : ""
|
|
63
|
-
}
|
|
64
|
-
]
|
|
65
|
+
text: (_a = msg.content) !== null && _a !== void 0 ? _a : "",
|
|
66
|
+
},
|
|
67
|
+
],
|
|
65
68
|
});
|
|
66
69
|
}
|
|
67
70
|
else {
|
|
@@ -71,9 +74,9 @@ class InputFormatAdapter {
|
|
|
71
74
|
content: [
|
|
72
75
|
{
|
|
73
76
|
type: types_1.BedrockAnthropicContentType.TEXT,
|
|
74
|
-
text: (_b = msg.content) !== null && _b !== void 0 ? _b : msg.function_call.arguments
|
|
75
|
-
}
|
|
76
|
-
]
|
|
77
|
+
text: (_b = msg.content) !== null && _b !== void 0 ? _b : msg.function_call.arguments,
|
|
78
|
+
},
|
|
79
|
+
],
|
|
77
80
|
});
|
|
78
81
|
}
|
|
79
82
|
});
|
|
@@ -86,9 +89,9 @@ class InputFormatAdapter {
|
|
|
86
89
|
content: [
|
|
87
90
|
{
|
|
88
91
|
type: types_1.BedrockAnthropicContentType.TEXT,
|
|
89
|
-
text: ":"
|
|
90
|
-
}
|
|
91
|
-
]
|
|
92
|
+
text: ":",
|
|
93
|
+
},
|
|
94
|
+
],
|
|
92
95
|
});
|
|
93
96
|
i += 1; // Skip the inserted message
|
|
94
97
|
}
|
|
@@ -98,7 +101,7 @@ class InputFormatAdapter {
|
|
|
98
101
|
case types_1.Providers.LLAMA_3_1_BEDROCK: {
|
|
99
102
|
const adaptedMessages = (0, openAIToLlamaMessage_1.default)(messages);
|
|
100
103
|
return {
|
|
101
|
-
adaptedMessages
|
|
104
|
+
adaptedMessages,
|
|
102
105
|
};
|
|
103
106
|
}
|
|
104
107
|
default:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputFormatAdapter.js","sourceRoot":"","sources":["../../src/middleware/InputFormatAdapter.ts"],"names":[],"mappings":";;;;;AAAA,oCAMkB;AAClB,iHAAyF;AAEzF,MAAqB,kBAAkB;IACrC,MAAM,CAAC,aAAa,CAClB,QAAa,EACb,QAAmB;;QAKnB,QAAQ,QAAQ,EAAE,CAAC;YACjB,KAAK,iBAAS,CAAC,MAAM,CAAC;YACtB,KAAK,iBAAS,CAAC,0BAA0B;gBACvC,OAAO;oBACL,6CAA6C;oBAC7C,eAAe,EAAE,QAAQ,CAAC,GAAG,CAAC,GAAG,
|
|
1
|
+
{"version":3,"file":"InputFormatAdapter.js","sourceRoot":"","sources":["../../src/middleware/InputFormatAdapter.ts"],"names":[],"mappings":";;;;;AAAA,oCAMkB;AAClB,iHAAyF;AAEzF,MAAqB,kBAAkB;IACrC,MAAM,CAAC,aAAa,CAClB,QAAa,EACb,QAAmB;;QAKnB,QAAQ,QAAQ,EAAE,CAAC;YACjB,KAAK,iBAAS,CAAC,MAAM,CAAC;YACtB,KAAK,iBAAS,CAAC,0BAA0B;gBACvC,OAAO;oBACL,6CAA6C;oBAC7C,eAAe,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;;wBACpC,IAAI,GAAG,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;4BAC5B,OAAO;gCACL,IAAI,EAAE,GAAG,CAAC,IAAI;gCACd,OAAO,EAAE,MAAA,GAAG,CAAC,OAAO,mCAAI,EAAE;gCAC1B,GAAG,CAAC,GAAG,CAAC,iBAAiB,IAAI;oCAC3B,iBAAiB,EAAE,GAAG,CAAC,iBAAiB;iCACzC,CAAC;gCAC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ACJ,CAAC;YAED;gBACE,MAAM,IAAI,KAAK,CAAC,2BAA2B,QAAQ,EAAE,CAAC,CAAC;QAC3D,CAAC;IACH,CAAC;CACF;AAnHD,qCAmHC"}
|
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const openai_1 = __importDefault(require("openai"));
|
|
7
|
+
const uuid_1 = require("uuid");
|
|
7
8
|
function normalizeTools(tools) {
|
|
8
9
|
if (!Array.isArray(tools))
|
|
9
10
|
return undefined;
|
|
@@ -27,6 +28,124 @@ function normalizeTools(tools) {
|
|
|
27
28
|
throw new Error(`Invalid tool definition encountered: ${JSON.stringify(tool, null, 2)}`);
|
|
28
29
|
});
|
|
29
30
|
}
|
|
31
|
+
function reformatMessagesWithThoughtSignature(messages) {
|
|
32
|
+
var _a, _b, _c;
|
|
33
|
+
const reformatted = [];
|
|
34
|
+
let i = 0;
|
|
35
|
+
while (i < messages.length) {
|
|
36
|
+
const message = messages[i];
|
|
37
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
38
|
+
const msg = message;
|
|
39
|
+
// Check if this is an assistant message with content as an object containing name and arguments
|
|
40
|
+
const isAssistantWithToolContent = msg.role === "assistant" &&
|
|
41
|
+
typeof msg.content === "object" &&
|
|
42
|
+
msg.content !== null &&
|
|
43
|
+
!Array.isArray(msg.content) &&
|
|
44
|
+
msg.content.name &&
|
|
45
|
+
msg.content.arguments;
|
|
46
|
+
if (isAssistantWithToolContent) {
|
|
47
|
+
// Look ahead to find the corresponding function message
|
|
48
|
+
const nextMessage = i + 1 < messages.length ? messages[i + 1] : null;
|
|
49
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
50
|
+
const nextMsg = nextMessage;
|
|
51
|
+
// Generate a unique ID for the tool call
|
|
52
|
+
const toolCallId = `function-call-${(0, uuid_1.v4)()}`;
|
|
53
|
+
// Extract thought_signature from the next function message if it exists
|
|
54
|
+
const thoughtSignature = (nextMsg === null || nextMsg === void 0 ? void 0 : nextMsg.role) === "function" && (nextMsg === null || nextMsg === void 0 ? void 0 : nextMsg.thought_signature)
|
|
55
|
+
? nextMsg.thought_signature
|
|
56
|
+
: undefined;
|
|
57
|
+
// Convert assistant message to have tool_calls
|
|
58
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
59
|
+
const assistantMessage = {
|
|
60
|
+
role: "assistant",
|
|
61
|
+
tool_calls: [
|
|
62
|
+
{
|
|
63
|
+
id: toolCallId,
|
|
64
|
+
type: "function",
|
|
65
|
+
function: {
|
|
66
|
+
name: msg.content.name,
|
|
67
|
+
arguments: msg.content.arguments,
|
|
68
|
+
},
|
|
69
|
+
...(thoughtSignature && {
|
|
70
|
+
extra_content: {
|
|
71
|
+
google: {
|
|
72
|
+
thought_signature: thoughtSignature,
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
}),
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
};
|
|
79
|
+
reformatted.push(assistantMessage);
|
|
80
|
+
// If there's a corresponding function message, convert it to a tool message
|
|
81
|
+
if ((nextMsg === null || nextMsg === void 0 ? void 0 : nextMsg.role) === "function" && (nextMsg === null || nextMsg === void 0 ? void 0 : nextMsg.name) === msg.content.name) {
|
|
82
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
83
|
+
const toolMessage = {
|
|
84
|
+
role: "tool",
|
|
85
|
+
name: nextMsg.name,
|
|
86
|
+
tool_call_id: toolCallId,
|
|
87
|
+
content: nextMsg.content,
|
|
88
|
+
};
|
|
89
|
+
reformatted.push(toolMessage);
|
|
90
|
+
i += 2; // Skip both the assistant and function messages
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
i += 1;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
// Check if this is a function message that wasn't already processed
|
|
98
|
+
const prevMsg = reformatted[reformatted.length - 1];
|
|
99
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
100
|
+
const prevToolCalls = (_c = (_b = (_a = prevMsg === null || prevMsg === void 0 ? void 0 : prevMsg.tool_calls) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.function) === null || _c === void 0 ? void 0 : _c.name;
|
|
101
|
+
const isUnprocessedFunction = msg.role === "function" &&
|
|
102
|
+
!((prevMsg === null || prevMsg === void 0 ? void 0 : prevMsg.role) === "assistant" && prevToolCalls === msg.name);
|
|
103
|
+
if (isUnprocessedFunction) {
|
|
104
|
+
// Check if message has thought_signature and function_call (old format - legacy support)
|
|
105
|
+
if (msg.thought_signature && msg.function_call) {
|
|
106
|
+
const { thought_signature, function_call, ...rest } = msg;
|
|
107
|
+
// Convert to new tool_calls format
|
|
108
|
+
reformatted.push({
|
|
109
|
+
...rest,
|
|
110
|
+
role: "assistant",
|
|
111
|
+
tool_calls: [
|
|
112
|
+
{
|
|
113
|
+
id: `function-call-${(0, uuid_1.v4)()}`,
|
|
114
|
+
type: "function",
|
|
115
|
+
function: {
|
|
116
|
+
name: function_call.name,
|
|
117
|
+
arguments: function_call.arguments,
|
|
118
|
+
},
|
|
119
|
+
extra_content: {
|
|
120
|
+
google: {
|
|
121
|
+
thought_signature,
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
],
|
|
126
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
127
|
+
});
|
|
128
|
+
i += 1;
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
// Return message as-is if it doesn't need reformatting
|
|
132
|
+
if (message) {
|
|
133
|
+
reformatted.push(message);
|
|
134
|
+
}
|
|
135
|
+
i += 1;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
// Return message as-is if it doesn't need reformatting
|
|
140
|
+
if (message) {
|
|
141
|
+
reformatted.push(message);
|
|
142
|
+
}
|
|
143
|
+
i += 1;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return reformatted;
|
|
148
|
+
}
|
|
30
149
|
class OpenAICompatibleService {
|
|
31
150
|
constructor(apiKey, baseUrl) {
|
|
32
151
|
this.openai = new openai_1.default({
|
|
@@ -39,9 +158,10 @@ class OpenAICompatibleService {
|
|
|
39
158
|
return Promise.reject(new Error("Model ID is required for OpenAIService."));
|
|
40
159
|
}
|
|
41
160
|
try {
|
|
161
|
+
const reformattedMessages = reformatMessagesWithThoughtSignature(messages);
|
|
42
162
|
const response = await this.openai.chat.completions.create({
|
|
43
163
|
model,
|
|
44
|
-
messages,
|
|
164
|
+
messages: reformattedMessages,
|
|
45
165
|
max_tokens,
|
|
46
166
|
temperature,
|
|
47
167
|
functions: tools,
|
|
@@ -56,25 +176,21 @@ class OpenAICompatibleService {
|
|
|
56
176
|
if (!model) {
|
|
57
177
|
throw new Error("Model ID is required for OpenAIService.");
|
|
58
178
|
}
|
|
179
|
+
const reformattedMessages = reformatMessagesWithThoughtSignature(messages);
|
|
59
180
|
const normalizedTools = normalizeTools(tools);
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
yield chunk;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
catch (error) {
|
|
77
|
-
throw error;
|
|
181
|
+
const stream = await this.openai.chat.completions.create({
|
|
182
|
+
model,
|
|
183
|
+
messages: reformattedMessages,
|
|
184
|
+
max_tokens,
|
|
185
|
+
temperature,
|
|
186
|
+
...(normalizedTools && { tools: normalizedTools }),
|
|
187
|
+
stream: true,
|
|
188
|
+
stream_options: {
|
|
189
|
+
include_usage: true,
|
|
190
|
+
},
|
|
191
|
+
});
|
|
192
|
+
for await (const chunk of stream) {
|
|
193
|
+
yield chunk;
|
|
78
194
|
}
|
|
79
195
|
}
|
|
80
196
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenAICompatibleService.js","sourceRoot":"","sources":["../../src/services/OpenAICompatibleService.ts"],"names":[],"mappings":";;;;;AAAA,oDAA4B;
|
|
1
|
+
{"version":3,"file":"OpenAICompatibleService.js","sourceRoot":"","sources":["../../src/services/OpenAICompatibleService.ts"],"names":[],"mappings":";;;;;AAAA,oDAA4B;AAC5B,+BAAkC;AAIlC,SAAS,cAAc,CAAC,KAAa;IACnC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IAE5C,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACxB,kBAAkB;QAClB,IAAI,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI,MAAK,UAAU,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAC/C,OAAO,IAAI,CAAC;QACd,CAAC;QAED,qBAAqB;QACrB,IAAI,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI,MAAK,UAAU,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YAC9D,OAAO;gBACL,IAAI,EAAE,UAAU;gBAChB,QAAQ,EAAE;oBACR,IAAI,EAAE,IAAI,CAAC,IAAI;oBACf,WAAW,EAAE,IAAI,CAAC,WAAW;oBAC7B,UAAU,EAAE,IAAI,CAAC,UAAU;iBAC5B;aACF,CAAC;QACJ,CAAC;QAED,mCAAmC;QACnC,MAAM,IAAI,KAAK,CACb,wCAAwC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CACxE,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,oCAAoC,CAC3C,QAAwB;;IAExB,MAAM,WAAW,GAAmB,EAAE,CAAC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AAM,EAAE,IAAI;YACZ,cAAc,EAAE;gBACd,aAAa,EAAE,IAAI;aACpB;SACF,CAAC,CAAC;QAEH,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YACjC,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF;AAlFD,0CAkFC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "llm-proxy",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.1",
|
|
4
4
|
"description": "An LLM Proxy that allows the user to interact with different language models from different providers using unified request and response formats.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"axios": "^1.7.7",
|
|
36
36
|
"dotenv": "^16.4.5",
|
|
37
37
|
"llm-proxy": "^1.4.15",
|
|
38
|
-
"openai": "^4.69.0"
|
|
38
|
+
"openai": "^4.69.0",
|
|
39
|
+
"uuid": "^13.0.0"
|
|
39
40
|
}
|
|
40
41
|
}
|