@hebo-ai/gateway 0.11.4 → 0.11.6
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/README.md +8 -8
- 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/dist/lifecycle.js +2 -0
- package/dist/models/alibaba/presets.d.ts +96 -27
- package/dist/models/alibaba/presets.js +27 -2
- package/dist/models/anthropic/middleware.js +11 -4
- package/dist/models/anthropic/presets.d.ts +96 -15
- package/dist/models/anthropic/presets.js +23 -2
- package/dist/models/deepseek/presets.d.ts +106 -3
- package/dist/models/deepseek/presets.js +19 -2
- package/dist/models/google/presets.d.ts +47 -23
- package/dist/models/google/presets.js +9 -2
- package/dist/models/minimax/presets.d.ts +49 -6
- package/dist/models/minimax/presets.js +24 -1
- package/dist/models/moonshot/presets.d.ts +49 -2
- package/dist/models/moonshot/presets.js +14 -2
- package/dist/models/types.d.ts +1 -1
- package/dist/models/types.js +12 -0
- package/dist/models/xai/presets.d.ts +81 -1
- package/dist/models/xai/presets.js +14 -1
- package/dist/models/zai/presets.d.ts +44 -2
- package/dist/models/zai/presets.js +10 -2
- package/dist/providers/bedrock/canonical.js +2 -0
- package/dist/providers/bedrock/middleware.js +7 -11
- package/dist/providers/xai/canonical.js +2 -0
- package/dist/providers/zai/canonical.js +1 -0
- package/package.json +57 -65
package/README.md
CHANGED
|
@@ -214,33 +214,33 @@ const modelsFromFamily = defineModelCatalog(
|
|
|
214
214
|
Out-of-the-box model presets:
|
|
215
215
|
|
|
216
216
|
- **Alibaba** — `@hebo-ai/gateway/models/alibaba`
|
|
217
|
-
Qwen: `qwen` (`v3`, `v3.5`, `v3.6`, `v3.x`, `coder`, `vl`, `embedding`, `embeddings`, `latest`, `all`)
|
|
217
|
+
Qwen: `qwen` (`v3`, `v3.5`, `v3.6`, `v3.7`, `v3.x`, `coder`, `vl`, `embedding`, `embeddings`, `latest`, `all`)
|
|
218
218
|
|
|
219
219
|
- **Amazon** — `@hebo-ai/gateway/models/amazon`
|
|
220
220
|
Nova: `nova` (`v1`, `v2`, `v1.x`, `v2.x`, `latest`, `embeddings`, `all`)
|
|
221
221
|
|
|
222
222
|
- **Anthropic** — `@hebo-ai/gateway/models/anthropic`
|
|
223
|
-
Claude: `claude` (`v4.7`, `v4.6`, `v4.5`, `v4.1`, `v4`, `v3.7`, `v3.5`, `v3`, `v4.x`, `v3.x`, `haiku`, `sonnet`, `opus`, `latest`, `all`)
|
|
223
|
+
Claude: `claude` (`v4.8`, `v4.7`, `v4.6`, `v4.5`, `v4.1`, `v4`, `v3.7`, `v3.5`, `v3`, `v4.x`, `v3.x`, `fable`, `haiku`, `sonnet`, `opus`, `latest`, `all`)
|
|
224
224
|
|
|
225
225
|
- **Cohere** — `@hebo-ai/gateway/models/cohere`
|
|
226
226
|
Command: `command` (`A`, `R`, `latest`, `all`)
|
|
227
227
|
Embed: `embed` (`v4`, `v3`, `latest`, `all`)
|
|
228
228
|
|
|
229
229
|
- **DeepSeek** — `@hebo-ai/gateway/models/deepseek`
|
|
230
|
-
DeepSeek: `deepseek` (`v3.2`, `latest`, `all`)
|
|
230
|
+
DeepSeek: `deepseek` (`v3.2`, `v4`, `v4.x`, `latest`, `all`)
|
|
231
231
|
|
|
232
232
|
- **Google** — `@hebo-ai/gateway/models/google`
|
|
233
|
-
Gemini: `gemini` (`v2.5`, `v3-preview`, `v2.x`, `v3.x`, `embeddings`, `latest`, `preview`, `all`)
|
|
233
|
+
Gemini: `gemini` (`v2.5`, `v3.5`, `v3-preview`, `v2.x`, `v3.x`, `embeddings`, `latest`, `preview`, `all`)
|
|
234
234
|
Gemma: `gemma` (`v3`, `v4`, `v3.x`, `v4.x`, `latest`, `all`)
|
|
235
235
|
|
|
236
236
|
- **Meta** — `@hebo-ai/gateway/models/meta`
|
|
237
237
|
Llama: `llama` (`v3.1`, `v3.2`, `v3.3`, `v4`, `v3.x`, `v4.x`, `latest`, `all`)
|
|
238
238
|
|
|
239
239
|
- **MiniMax** — `@hebo-ai/gateway/models/minimax`
|
|
240
|
-
MiniMax: `minimax` (`v2`, `v2.x`, `latest`, `all`)
|
|
240
|
+
MiniMax: `minimax` (`v2`, `v3`, `v2.x`, `v3.x`, `latest`, `all`)
|
|
241
241
|
|
|
242
242
|
- **Moonshot** — `@hebo-ai/gateway/models/moonshot`
|
|
243
|
-
Kimi: `kimi` (`k2.5`, `k2.6`, `k2.x`, `latest`, `all`)
|
|
243
|
+
Kimi: `kimi` (`k2.5`, `k2.6`, `k2.7`, `k2.x`, `latest`, `all`)
|
|
244
244
|
|
|
245
245
|
- **OpenAI** — `@hebo-ai/gateway/models/openai`
|
|
246
246
|
GPT: `gpt` (`v5`, `v5.1`, `v5.2`, `v5.3`, `v5.4`, `v5.x`, `chat`, `codex`, `pro`, `latest`, `all`)
|
|
@@ -251,10 +251,10 @@ Out-of-the-box model presets:
|
|
|
251
251
|
Voyage: `voyage` (`v2`, `v3`, `v3.5`, `v4`, `v2.x`, `v3.x`, `v4.x`, `latest`, `all`)
|
|
252
252
|
|
|
253
253
|
- **xAI** — `@hebo-ai/gateway/models/xai`
|
|
254
|
-
Grok: `grok` (`v4.1`, `v4.2`, `v4.3`, `latest`, `all`)
|
|
254
|
+
Grok: `grok` (`v4.1`, `v4.2`, `v4.3`, `v4.20`, `latest`, `all`)
|
|
255
255
|
|
|
256
256
|
- **Z.ai** — `@hebo-ai/gateway/models/zai`
|
|
257
|
-
GLM: `glm` (`v5`, `v5.1`, `v5.x`, `latest`, `all`)
|
|
257
|
+
GLM: `glm` (`v5`, `v5.1`, `v5.2`, `v5.x`, `latest`, `all`)
|
|
258
258
|
|
|
259
259
|
#### User-defined Models
|
|
260
260
|
|
|
@@ -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) {
|