@hebo-ai/gateway 0.11.4 → 0.11.5
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/endpoints/chat-completions/converters.js +14 -8
- package/dist/endpoints/chat-completions/schema.d.ts +301 -281
- package/dist/endpoints/chat-completions/schema.js +40 -25
- package/dist/endpoints/conversations/handler.js +9 -2
- package/dist/endpoints/conversations/schema.d.ts +453 -453
- package/dist/endpoints/messages/converters.d.ts +2 -2
- package/dist/endpoints/messages/converters.js +12 -6
- package/dist/endpoints/messages/schema.d.ts +88 -70
- package/dist/endpoints/messages/schema.js +26 -13
- package/dist/endpoints/responses/converters.js +25 -19
- package/dist/endpoints/responses/otel.js +3 -1
- package/dist/endpoints/responses/schema.d.ts +543 -525
- package/dist/endpoints/responses/schema.js +49 -34
- package/dist/endpoints/shared/converters.d.ts +1 -1
- package/dist/endpoints/shared/converters.js +1 -1
- package/dist/endpoints/shared/schema.d.ts +2 -2
- package/dist/endpoints/shared/schema.js +1 -1
- package/package.json +48 -56
|
@@ -194,11 +194,11 @@ export function fromChatCompletionsContent(content) {
|
|
|
194
194
|
return content.map((part) => {
|
|
195
195
|
switch (part.type) {
|
|
196
196
|
case "image_url":
|
|
197
|
-
return fromImageUrlPart(part.image_url.url, part.cache_control);
|
|
197
|
+
return fromImageUrlPart(part.image_url.url, part.cache_control ?? undefined);
|
|
198
198
|
case "file":
|
|
199
|
-
return fromFilePart(part.file.data, part.file.media_type, part.file.filename, part.cache_control);
|
|
199
|
+
return fromFilePart(part.file.data, part.file.media_type, part.file.filename ?? undefined, part.cache_control ?? undefined);
|
|
200
200
|
case "input_audio":
|
|
201
|
-
return fromFilePart(part.input_audio.data, `audio/${part.input_audio.format}`, undefined, part.cache_control);
|
|
201
|
+
return fromFilePart(part.input_audio.data, `audio/${part.input_audio.format}`, undefined, part.cache_control ?? undefined);
|
|
202
202
|
case "text": {
|
|
203
203
|
const out = {
|
|
204
204
|
type: "text",
|
|
@@ -266,13 +266,19 @@ export const convertToToolSet = (tools) => {
|
|
|
266
266
|
}
|
|
267
267
|
const toolSet = {};
|
|
268
268
|
for (const t of tools) {
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
269
|
+
// Hosted/built-in tools (e.g. web_search) are accepted at the edge but
|
|
270
|
+
// not executed by the gateway; drop anything that isn't a function tool.
|
|
271
|
+
// FUTURE: log dropped hosted tools at warn level (once per request, batched)
|
|
272
|
+
if (t.type !== "function")
|
|
273
|
+
continue;
|
|
274
|
+
const fn = t;
|
|
275
|
+
toolSet[fn.function.name] = tool({
|
|
276
|
+
description: fn.function.description,
|
|
277
|
+
inputSchema: jsonSchema(fn.function.parameters),
|
|
278
|
+
strict: fn.function.strict,
|
|
273
279
|
});
|
|
274
280
|
}
|
|
275
|
-
return toolSet;
|
|
281
|
+
return Object.keys(toolSet).length > 0 ? toolSet : undefined;
|
|
276
282
|
};
|
|
277
283
|
export const convertToToolChoiceOptions = (toolChoice) => {
|
|
278
284
|
if (!toolChoice) {
|