@ai-sdk/openai-compatible 3.0.59 → 3.0.61
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/CHANGELOG.md +18 -0
- package/dist/index.d.ts +342 -330
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1419 -1834
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts +176 -168
- package/dist/internal/index.d.ts.map +1 -0
- package/dist/internal/index.js +254 -346
- package/dist/internal/index.js.map +1 -1
- package/docs/index.mdx +1 -1
- package/package.json +8 -8
package/dist/internal/index.js
CHANGED
|
@@ -1,359 +1,267 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
} from "@ai-sdk/provider";
|
|
5
|
-
import {
|
|
6
|
-
convertBase64ToUint8Array,
|
|
7
|
-
convertToBase64,
|
|
8
|
-
getTopLevelMediaType,
|
|
9
|
-
resolveFullMediaType
|
|
10
|
-
} from "@ai-sdk/provider-utils";
|
|
1
|
+
import { UnsupportedFunctionalityError } from "@ai-sdk/provider";
|
|
2
|
+
import { convertBase64ToUint8Array, convertToBase64, createLanguageModelResponseMetadata, createNullLanguageModelUsage, getTopLevelMediaType, resolveFullMediaType } from "@ai-sdk/provider-utils";
|
|
3
|
+
//#region src/chat/convert-to-openai-compatible-chat-messages.ts
|
|
11
4
|
function getOpenAIMetadata(message) {
|
|
12
|
-
|
|
5
|
+
return message?.providerOptions?.openaiCompatible ?? {};
|
|
13
6
|
}
|
|
14
7
|
function getAudioFormat(mediaType) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
default:
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
8
|
+
switch (mediaType) {
|
|
9
|
+
case "audio/wav": return "wav";
|
|
10
|
+
case "audio/mp3":
|
|
11
|
+
case "audio/mpeg": return "mp3";
|
|
12
|
+
default: return null;
|
|
13
|
+
}
|
|
24
14
|
}
|
|
25
15
|
function convertToOpenAICompatibleChatMessages(prompt, { providerOptionsKey = "google" } = {}) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
}
|
|
181
|
-
} : {}
|
|
182
|
-
});
|
|
183
|
-
break;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
messages.push({
|
|
188
|
-
role: "assistant",
|
|
189
|
-
content: toolCalls.length > 0 ? text || null : text,
|
|
190
|
-
...reasoning.length > 0 ? { reasoning_content: reasoning } : {},
|
|
191
|
-
tool_calls: toolCalls.length > 0 ? toolCalls : void 0,
|
|
192
|
-
...metadata
|
|
193
|
-
});
|
|
194
|
-
break;
|
|
195
|
-
}
|
|
196
|
-
case "tool": {
|
|
197
|
-
for (const toolResponse of content) {
|
|
198
|
-
if (toolResponse.type === "tool-approval-response") {
|
|
199
|
-
continue;
|
|
200
|
-
}
|
|
201
|
-
const output = toolResponse.output;
|
|
202
|
-
let contentValue;
|
|
203
|
-
switch (output.type) {
|
|
204
|
-
case "text":
|
|
205
|
-
case "error-text":
|
|
206
|
-
contentValue = output.value;
|
|
207
|
-
break;
|
|
208
|
-
case "execution-denied":
|
|
209
|
-
contentValue = output.reason ?? "Tool call execution denied.";
|
|
210
|
-
break;
|
|
211
|
-
case "content":
|
|
212
|
-
case "json":
|
|
213
|
-
case "error-json":
|
|
214
|
-
contentValue = JSON.stringify(output.value);
|
|
215
|
-
break;
|
|
216
|
-
}
|
|
217
|
-
const toolResponseMetadata = getOpenAIMetadata(toolResponse);
|
|
218
|
-
messages.push({
|
|
219
|
-
role: "tool",
|
|
220
|
-
tool_call_id: toolResponse.toolCallId,
|
|
221
|
-
content: contentValue,
|
|
222
|
-
...toolResponseMetadata
|
|
223
|
-
});
|
|
224
|
-
}
|
|
225
|
-
break;
|
|
226
|
-
}
|
|
227
|
-
default: {
|
|
228
|
-
const _exhaustiveCheck = role;
|
|
229
|
-
throw new Error(`Unsupported role: ${_exhaustiveCheck}`);
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
return messages;
|
|
16
|
+
const messages = [];
|
|
17
|
+
for (const { role, content, ...message } of prompt) {
|
|
18
|
+
const metadata = getOpenAIMetadata({ ...message });
|
|
19
|
+
switch (role) {
|
|
20
|
+
case "system":
|
|
21
|
+
messages.push({
|
|
22
|
+
role: "system",
|
|
23
|
+
content,
|
|
24
|
+
...metadata
|
|
25
|
+
});
|
|
26
|
+
break;
|
|
27
|
+
case "user":
|
|
28
|
+
if (content.length === 1 && content[0].type === "text") {
|
|
29
|
+
messages.push({
|
|
30
|
+
role: "user",
|
|
31
|
+
content: content[0].text,
|
|
32
|
+
...getOpenAIMetadata(content[0])
|
|
33
|
+
});
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
messages.push({
|
|
37
|
+
role: "user",
|
|
38
|
+
content: content.map((part) => {
|
|
39
|
+
const partMetadata = getOpenAIMetadata(part);
|
|
40
|
+
switch (part.type) {
|
|
41
|
+
case "text": return {
|
|
42
|
+
type: "text",
|
|
43
|
+
text: part.text,
|
|
44
|
+
...partMetadata
|
|
45
|
+
};
|
|
46
|
+
case "file": switch (part.data.type) {
|
|
47
|
+
case "reference": throw new UnsupportedFunctionalityError({ functionality: "file parts with provider references" });
|
|
48
|
+
case "text": throw new UnsupportedFunctionalityError({ functionality: "text file parts" });
|
|
49
|
+
case "url":
|
|
50
|
+
case "data": {
|
|
51
|
+
const topLevel = getTopLevelMediaType(part.mediaType);
|
|
52
|
+
if (topLevel === "image") return {
|
|
53
|
+
type: "image_url",
|
|
54
|
+
image_url: { url: part.data.type === "url" ? part.data.url.toString() : `data:${resolveFullMediaType({ part })};base64,${convertToBase64(part.data.data)}` },
|
|
55
|
+
...partMetadata
|
|
56
|
+
};
|
|
57
|
+
if (topLevel === "video") return {
|
|
58
|
+
type: "video_url",
|
|
59
|
+
video_url: { url: part.data.type === "url" ? part.data.url.toString() : `data:${resolveFullMediaType({ part })};base64,${convertToBase64(part.data.data)}` },
|
|
60
|
+
...partMetadata
|
|
61
|
+
};
|
|
62
|
+
if (topLevel === "audio") {
|
|
63
|
+
if (part.data.type === "url") throw new UnsupportedFunctionalityError({ functionality: "audio file parts with URLs" });
|
|
64
|
+
const fullMediaType = resolveFullMediaType({ part });
|
|
65
|
+
const format = getAudioFormat(fullMediaType);
|
|
66
|
+
if (format === null) throw new UnsupportedFunctionalityError({ functionality: `audio media type ${fullMediaType}` });
|
|
67
|
+
return {
|
|
68
|
+
type: "input_audio",
|
|
69
|
+
input_audio: {
|
|
70
|
+
data: convertToBase64(part.data.data),
|
|
71
|
+
format
|
|
72
|
+
},
|
|
73
|
+
...partMetadata
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
if (topLevel === "application") {
|
|
77
|
+
if (part.data.type === "url") throw new UnsupportedFunctionalityError({ functionality: "PDF file parts with URLs" });
|
|
78
|
+
const fullMediaType = resolveFullMediaType({ part });
|
|
79
|
+
if (fullMediaType !== "application/pdf") throw new UnsupportedFunctionalityError({ functionality: `file part media type ${fullMediaType}` });
|
|
80
|
+
return {
|
|
81
|
+
type: "file",
|
|
82
|
+
file: {
|
|
83
|
+
filename: part.filename ?? "document.pdf",
|
|
84
|
+
file_data: `data:application/pdf;base64,${convertToBase64(part.data.data)}`
|
|
85
|
+
},
|
|
86
|
+
...partMetadata
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
if (topLevel === "text") return {
|
|
90
|
+
type: "text",
|
|
91
|
+
text: part.data.type === "url" ? part.data.url.toString() : typeof part.data.data === "string" ? new TextDecoder().decode(convertBase64ToUint8Array(part.data.data)) : new TextDecoder().decode(part.data.data),
|
|
92
|
+
...partMetadata
|
|
93
|
+
};
|
|
94
|
+
throw new UnsupportedFunctionalityError({ functionality: `file part media type ${part.mediaType}` });
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}),
|
|
99
|
+
...metadata
|
|
100
|
+
});
|
|
101
|
+
break;
|
|
102
|
+
case "assistant": {
|
|
103
|
+
let text = "";
|
|
104
|
+
let reasoning = "";
|
|
105
|
+
const toolCalls = [];
|
|
106
|
+
for (const part of content) {
|
|
107
|
+
const partMetadata = getOpenAIMetadata(part);
|
|
108
|
+
switch (part.type) {
|
|
109
|
+
case "text":
|
|
110
|
+
text += part.text;
|
|
111
|
+
break;
|
|
112
|
+
case "reasoning":
|
|
113
|
+
reasoning += part.text;
|
|
114
|
+
break;
|
|
115
|
+
case "tool-call": {
|
|
116
|
+
const thoughtSignature = part.providerOptions?.[providerOptionsKey]?.thoughtSignature ?? part.providerOptions?.google?.thoughtSignature;
|
|
117
|
+
toolCalls.push({
|
|
118
|
+
id: part.toolCallId,
|
|
119
|
+
type: "function",
|
|
120
|
+
function: {
|
|
121
|
+
name: part.toolName,
|
|
122
|
+
arguments: JSON.stringify(part.input)
|
|
123
|
+
},
|
|
124
|
+
...partMetadata,
|
|
125
|
+
...thoughtSignature ? { extra_content: { google: { thought_signature: String(thoughtSignature) } } } : {}
|
|
126
|
+
});
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
messages.push({
|
|
132
|
+
role: "assistant",
|
|
133
|
+
content: toolCalls.length > 0 ? text || null : text,
|
|
134
|
+
...reasoning.length > 0 ? { reasoning_content: reasoning } : {},
|
|
135
|
+
tool_calls: toolCalls.length > 0 ? toolCalls : void 0,
|
|
136
|
+
...metadata
|
|
137
|
+
});
|
|
138
|
+
break;
|
|
139
|
+
}
|
|
140
|
+
case "tool":
|
|
141
|
+
for (const toolResponse of content) {
|
|
142
|
+
if (toolResponse.type === "tool-approval-response") continue;
|
|
143
|
+
const output = toolResponse.output;
|
|
144
|
+
let contentValue;
|
|
145
|
+
switch (output.type) {
|
|
146
|
+
case "text":
|
|
147
|
+
case "error-text":
|
|
148
|
+
contentValue = output.value;
|
|
149
|
+
break;
|
|
150
|
+
case "execution-denied":
|
|
151
|
+
contentValue = output.reason ?? "Tool call execution denied.";
|
|
152
|
+
break;
|
|
153
|
+
case "content":
|
|
154
|
+
case "json":
|
|
155
|
+
case "error-json": contentValue = JSON.stringify(output.value);
|
|
156
|
+
}
|
|
157
|
+
const toolResponseMetadata = getOpenAIMetadata(toolResponse);
|
|
158
|
+
messages.push({
|
|
159
|
+
role: "tool",
|
|
160
|
+
tool_call_id: toolResponse.toolCallId,
|
|
161
|
+
content: contentValue,
|
|
162
|
+
...toolResponseMetadata
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
break;
|
|
166
|
+
default: throw new Error(`Unsupported role: ${role}`);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return messages;
|
|
234
170
|
}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
import { createNullLanguageModelUsage } from "@ai-sdk/provider-utils";
|
|
171
|
+
//#endregion
|
|
172
|
+
//#region src/chat/convert-openai-compatible-chat-usage.ts
|
|
238
173
|
function convertOpenAICompatibleChatUsage(usage) {
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
raw: usage
|
|
259
|
-
};
|
|
174
|
+
if (usage == null) return createNullLanguageModelUsage();
|
|
175
|
+
const promptTokens = usage.prompt_tokens ?? 0;
|
|
176
|
+
const completionTokens = usage.completion_tokens ?? 0;
|
|
177
|
+
const cacheReadTokens = usage.prompt_tokens_details?.cached_tokens ?? 0;
|
|
178
|
+
const reasoningTokens = usage.completion_tokens_details?.reasoning_tokens ?? 0;
|
|
179
|
+
return {
|
|
180
|
+
inputTokens: {
|
|
181
|
+
total: promptTokens,
|
|
182
|
+
noCache: promptTokens - cacheReadTokens,
|
|
183
|
+
cacheRead: cacheReadTokens,
|
|
184
|
+
cacheWrite: void 0
|
|
185
|
+
},
|
|
186
|
+
outputTokens: {
|
|
187
|
+
total: completionTokens,
|
|
188
|
+
text: Math.max(0, completionTokens - reasoningTokens),
|
|
189
|
+
reasoning: reasoningTokens
|
|
190
|
+
},
|
|
191
|
+
raw: usage
|
|
192
|
+
};
|
|
260
193
|
}
|
|
261
|
-
|
|
262
|
-
|
|
194
|
+
//#endregion
|
|
195
|
+
//#region src/chat/map-openai-compatible-finish-reason.ts
|
|
263
196
|
function mapOpenAICompatibleFinishReason(finishReason) {
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
case "tool_calls":
|
|
273
|
-
return "tool-calls";
|
|
274
|
-
default:
|
|
275
|
-
return "other";
|
|
276
|
-
}
|
|
197
|
+
switch (finishReason) {
|
|
198
|
+
case "stop": return "stop";
|
|
199
|
+
case "length": return "length";
|
|
200
|
+
case "content_filter": return "content-filter";
|
|
201
|
+
case "function_call":
|
|
202
|
+
case "tool_calls": return "tool-calls";
|
|
203
|
+
default: return "other";
|
|
204
|
+
}
|
|
277
205
|
}
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
})
|
|
286
|
-
return createLanguageModelResponseMetadata({
|
|
287
|
-
id,
|
|
288
|
-
model,
|
|
289
|
-
// Some OpenAI-compatible providers use 0 as a placeholder timestamp.
|
|
290
|
-
created: created || void 0
|
|
291
|
-
});
|
|
206
|
+
//#endregion
|
|
207
|
+
//#region src/chat/get-response-metadata.ts
|
|
208
|
+
function getResponseMetadata({ id, model, created }) {
|
|
209
|
+
return createLanguageModelResponseMetadata({
|
|
210
|
+
id,
|
|
211
|
+
model,
|
|
212
|
+
created: created || void 0
|
|
213
|
+
});
|
|
292
214
|
}
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
},
|
|
342
|
-
toolWarnings
|
|
343
|
-
};
|
|
344
|
-
default: {
|
|
345
|
-
const _exhaustiveCheck = type;
|
|
346
|
-
throw new UnsupportedFunctionalityError2({
|
|
347
|
-
functionality: `tool choice type: ${_exhaustiveCheck}`
|
|
348
|
-
});
|
|
349
|
-
}
|
|
350
|
-
}
|
|
215
|
+
//#endregion
|
|
216
|
+
//#region src/chat/openai-compatible-prepare-tools.ts
|
|
217
|
+
function prepareTools({ tools, toolChoice }) {
|
|
218
|
+
tools = tools?.length ? tools : void 0;
|
|
219
|
+
const toolWarnings = [];
|
|
220
|
+
if (tools == null) return {
|
|
221
|
+
tools: void 0,
|
|
222
|
+
toolChoice: void 0,
|
|
223
|
+
toolWarnings
|
|
224
|
+
};
|
|
225
|
+
const openaiCompatTools = [];
|
|
226
|
+
for (const tool of tools) if (tool.type === "provider") toolWarnings.push({
|
|
227
|
+
type: "unsupported",
|
|
228
|
+
feature: `provider-defined tool ${tool.id}`
|
|
229
|
+
});
|
|
230
|
+
else openaiCompatTools.push({
|
|
231
|
+
type: "function",
|
|
232
|
+
function: {
|
|
233
|
+
name: tool.name,
|
|
234
|
+
description: tool.description,
|
|
235
|
+
parameters: tool.inputSchema,
|
|
236
|
+
...tool.strict != null ? { strict: tool.strict } : {}
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
if (toolChoice == null) return {
|
|
240
|
+
tools: openaiCompatTools,
|
|
241
|
+
toolChoice: void 0,
|
|
242
|
+
toolWarnings
|
|
243
|
+
};
|
|
244
|
+
const type = toolChoice.type;
|
|
245
|
+
switch (type) {
|
|
246
|
+
case "auto":
|
|
247
|
+
case "none":
|
|
248
|
+
case "required": return {
|
|
249
|
+
tools: openaiCompatTools,
|
|
250
|
+
toolChoice: type,
|
|
251
|
+
toolWarnings
|
|
252
|
+
};
|
|
253
|
+
case "tool": return {
|
|
254
|
+
tools: openaiCompatTools,
|
|
255
|
+
toolChoice: {
|
|
256
|
+
type: "function",
|
|
257
|
+
function: { name: toolChoice.toolName }
|
|
258
|
+
},
|
|
259
|
+
toolWarnings
|
|
260
|
+
};
|
|
261
|
+
default: throw new UnsupportedFunctionalityError({ functionality: `tool choice type: ${type}` });
|
|
262
|
+
}
|
|
351
263
|
}
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
getResponseMetadata,
|
|
356
|
-
mapOpenAICompatibleFinishReason,
|
|
357
|
-
prepareTools
|
|
358
|
-
};
|
|
264
|
+
//#endregion
|
|
265
|
+
export { convertOpenAICompatibleChatUsage, convertToOpenAICompatibleChatMessages, getResponseMetadata, mapOpenAICompatibleFinishReason, prepareTools };
|
|
266
|
+
|
|
359
267
|
//# sourceMappingURL=index.js.map
|