@ai-sdk/gateway 4.0.103 → 4.0.104
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 +12 -0
- package/dist/index.d.ts +117 -105
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +27 -20
- package/dist/index.js.map +1 -1
- package/docs/00-ai-gateway.mdx +6 -6
- package/package.json +3 -3
- package/src/gateway-decision-model-settings.ts +6 -0
- package/src/{gateway-evaluation-model.ts → gateway-decision-model.ts} +20 -15
- package/src/gateway-language-model-settings.ts +1 -1
- package/src/gateway-model-entry.ts +2 -0
- package/src/gateway-provider-options.ts +24 -24
- package/src/gateway-provider.ts +22 -12
- package/src/gateway-video-model-settings.ts +1 -0
- package/src/index.ts +11 -2
- package/src/gateway-evaluation-model-settings.ts +0 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @ai-sdk/gateway
|
|
2
2
|
|
|
3
|
+
## 4.0.104
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 131532b: chore(provider/gateway): update gateway model settings files
|
|
8
|
+
- 2959d35: feat: rename `evaluate` to `decide`
|
|
9
|
+
- 6ac923a: chore(provider/gateway): update gateway model settings files
|
|
10
|
+
- Updated dependencies [2959d35]
|
|
11
|
+
- Updated dependencies [59116e6]
|
|
12
|
+
- @ai-sdk/provider@4.0.22
|
|
13
|
+
- @ai-sdk/provider-utils@5.0.54
|
|
14
|
+
|
|
3
15
|
## 4.0.103
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,109 @@
|
|
|
1
1
|
import { FetchFunction, InferSchema, WebSocketConstructor } from "@ai-sdk/provider-utils";
|
|
2
|
-
import { APICallError, EmbeddingModelV4, Experimental_BatchV4,
|
|
2
|
+
import { APICallError, EmbeddingModelV4, Experimental_BatchV4, Experimental_DecisionModelV4, Experimental_RealtimeFactoryV4, Experimental_VideoModelV4, ImageModelV4, JSONValue, LanguageModelV4, ProviderV4, RerankingModelV4, SpeechModelV4, TranscriptionModelV4, TypeValidationError } from "@ai-sdk/provider";
|
|
3
|
+
//#region src/gateway-decision-model-settings.d.ts
|
|
4
|
+
type GatewayDecisionModelId = 'convaiinnovations/laya' | 'convaiinnovations/laya-free' | 'liquid/d1' | 'typesafe-ai/jev' | (string & {});
|
|
5
|
+
//#endregion
|
|
6
|
+
//#region src/gateway-provider-options.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* A condition on the primary model's answers. `QUESTION_ID` narrows
|
|
9
|
+
* `question` to your question IDs. Without `question`, `confidenceBelow`
|
|
10
|
+
* checks every Choice and Score question and `probabilityBetween` every
|
|
11
|
+
* Boolean question. Groups nest at most five levels deep, which the SDK
|
|
12
|
+
* checks at runtime.
|
|
13
|
+
*/
|
|
14
|
+
type DecisionFallbackCondition<QUESTION_ID extends string = string> = ExclusiveCondition<{
|
|
15
|
+
question?: QUESTION_ID;
|
|
16
|
+
confidenceBelow: number;
|
|
17
|
+
}> | ExclusiveCondition<{
|
|
18
|
+
question?: QUESTION_ID;
|
|
19
|
+
probabilityBetween: [number, number];
|
|
20
|
+
}> | ExclusiveCondition<{
|
|
21
|
+
any: DecisionFallbackConditionList<QUESTION_ID>;
|
|
22
|
+
}> | ExclusiveCondition<{
|
|
23
|
+
all: DecisionFallbackConditionList<QUESTION_ID>;
|
|
24
|
+
}> | ExclusiveCondition<{
|
|
25
|
+
atLeast: {
|
|
26
|
+
count: number;
|
|
27
|
+
conditions: DecisionFallbackConditionList<QUESTION_ID>;
|
|
28
|
+
};
|
|
29
|
+
}>;
|
|
30
|
+
type GatewayModelFallback<QUESTION_ID extends string = string> = string | {
|
|
31
|
+
model: string;
|
|
32
|
+
when: DecisionFallbackCondition<QUESTION_ID>;
|
|
33
|
+
};
|
|
34
|
+
type GatewayProviderOptions<QUESTION_ID extends string = string> = {
|
|
35
|
+
/**
|
|
36
|
+
* Service-owned options may be added by the Gateway without requiring an SDK
|
|
37
|
+
* release. The Gateway service validates and applies the runtime schema.
|
|
38
|
+
*/
|
|
39
|
+
[key: string]: unknown;
|
|
40
|
+
/** Request-scoped BYOK credentials to use instead of cached credentials. */
|
|
41
|
+
byok?: Record<string, Array<Record<string, unknown>>>;
|
|
42
|
+
/** Enables automatic caching behavior when supported by the Gateway. */
|
|
43
|
+
caching?: 'auto';
|
|
44
|
+
/** Filter to providers that do not train on prompt data. */
|
|
45
|
+
disallowPromptTraining?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Restrict routing to provider models that satisfy every given entry.
|
|
48
|
+
*
|
|
49
|
+
* Entries are capability tags (`'implicit-caching'`, `'reasoning'`,
|
|
50
|
+
* `'tool-use'`, `'vision'` (image input), `'structured-output'`
|
|
51
|
+
* (schema-constrained output)) or weight-format conditions:
|
|
52
|
+
* `'quantization:fp8'` requires the serving provider to report that weight
|
|
53
|
+
* format, `'!quantization:fp8'` excludes it (providers with no recorded
|
|
54
|
+
* format still pass an exclusion). Format values are an open space but must
|
|
55
|
+
* match `[a-zA-Z0-9._-]{1,32}` and compare case-insensitively. Unknown
|
|
56
|
+
* capability names are rejected by the Gateway with a 400.
|
|
57
|
+
*/
|
|
58
|
+
has?: Array<'implicit-caching' | 'reasoning' | 'structured-output' | 'tool-use' | 'vision' | `quantization:${string}` | `!quantization:${string}`>;
|
|
59
|
+
/**
|
|
60
|
+
* Idempotency key for `experimental_startBatch`: retries with the same
|
|
61
|
+
* key replay the original batch instead of creating a duplicate.
|
|
62
|
+
*/
|
|
63
|
+
idempotencyKey?: string;
|
|
64
|
+
/**
|
|
65
|
+
* Fallback models to try in order. On decision requests, the first entry
|
|
66
|
+
* can be a conditional `{ model, when }` fallback that reruns the decision
|
|
67
|
+
* when `when` matches the primary answers. Other request types reject a
|
|
68
|
+
* conditional entry. Pass your question IDs as `QUESTION_ID` to check the
|
|
69
|
+
* `question` names in `when`.
|
|
70
|
+
*/
|
|
71
|
+
models?: GatewayModelFallbackList<QUESTION_ID>;
|
|
72
|
+
/** Array of provider slugs that are the only ones allowed to be used. */
|
|
73
|
+
only?: string[];
|
|
74
|
+
/** Array of provider slugs specifying the provider attempt order. */
|
|
75
|
+
order?: string[];
|
|
76
|
+
/** Per-provider timeouts for BYOK credentials in milliseconds. */
|
|
77
|
+
providerTimeouts?: {
|
|
78
|
+
byok?: Record<string, number>;
|
|
79
|
+
};
|
|
80
|
+
/** Entity identifier against which quota is tracked. */
|
|
81
|
+
quotaEntityId?: string;
|
|
82
|
+
/** Unified service tier intent. */
|
|
83
|
+
serviceTier?: 'flex' | 'priority';
|
|
84
|
+
/** Sort providers by a performance or cost metric before routing. */
|
|
85
|
+
sort?: 'cost' | 'tps' | 'ttft';
|
|
86
|
+
/** User-specified tags for reporting and filtering usage. */
|
|
87
|
+
tags?: string[];
|
|
88
|
+
/** End-user identifier for spend tracking and attribution. */
|
|
89
|
+
user?: string;
|
|
90
|
+
/** Filter to providers with zero data retention agreements. */
|
|
91
|
+
zeroDataRetention?: boolean;
|
|
92
|
+
};
|
|
93
|
+
type DecisionFallbackConditionList<QUESTION_ID extends string> = [DecisionFallbackCondition<QUESTION_ID>, ...DecisionFallbackCondition<QUESTION_ID>[]];
|
|
94
|
+
type ConditionKey = 'question' | 'confidenceBelow' | 'probabilityBetween' | 'any' | 'all' | 'atLeast';
|
|
95
|
+
type ExclusiveCondition<CONDITION> = CONDITION & { [KEY in Exclude<ConditionKey, keyof CONDITION>]?: never; };
|
|
96
|
+
type ConditionalGatewayModelFallback<QUESTION_ID extends string> = Exclude<GatewayModelFallback<QUESTION_ID>, string>;
|
|
97
|
+
type GatewayModelFallbackList<QUESTION_ID extends string> = string[] | [ConditionalGatewayModelFallback<QUESTION_ID>, ...string[]];
|
|
98
|
+
//#endregion
|
|
3
99
|
//#region src/gateway-embedding-model-settings.d.ts
|
|
4
100
|
type GatewayEmbeddingModelId = 'alibaba/qwen3-embedding-0.6b' | 'alibaba/qwen3-embedding-4b' | 'alibaba/qwen3-embedding-8b' | 'amazon/titan-embed-text-v2' | 'cohere/embed-v4.0' | 'google/gemini-embedding-001' | 'google/gemini-embedding-2' | 'google/text-embedding-005' | 'google/text-multilingual-embedding-002' | 'mistral/codestral-embed' | 'mistral/mistral-embed' | 'openai/text-embedding-3-large' | 'openai/text-embedding-3-small' | 'openai/text-embedding-ada-002' | 'perplexity/pplx-embed-v1-0.6b' | 'perplexity/pplx-embed-v1-4b' | 'voyage/voyage-3-large' | 'voyage/voyage-3.5' | 'voyage/voyage-3.5-lite' | 'voyage/voyage-4' | 'voyage/voyage-4-large' | 'voyage/voyage-4-lite' | 'voyage/voyage-code-2' | 'voyage/voyage-code-3' | 'voyage/voyage-finance-2' | 'voyage/voyage-law-2' | (string & {});
|
|
5
101
|
//#endregion
|
|
6
|
-
//#region src/gateway-evaluation-model-settings.d.ts
|
|
7
|
-
type GatewayEvaluationModelId = 'liquid/d1' | 'typesafe-ai/jev' | (string & {});
|
|
8
|
-
//#endregion
|
|
9
102
|
//#region src/gateway-image-model-settings.d.ts
|
|
10
103
|
type GatewayImageModelId = 'bfl/flux-2-flex' | 'bfl/flux-2-klein-4b' | 'bfl/flux-2-klein-9b' | 'bfl/flux-2-max' | 'bfl/flux-2-pro' | 'bfl/flux-kontext-max' | 'bfl/flux-kontext-pro' | 'bfl/flux-pro-1.0-fill' | 'bfl/flux-pro-1.1' | 'bfl/flux-pro-1.1-ultra' | 'bytedance/seedream-4.0' | 'bytedance/seedream-4.5' | 'bytedance/seedream-5.0-lite' | 'bytedance/seedream-5.0-pro' | 'meta/muse-image-1.0' | 'openai/gpt-image-1' | 'openai/gpt-image-1-mini' | 'openai/gpt-image-1.5' | 'openai/gpt-image-2' | 'openai/gpt-image-2.5-flare' | 'openai/gpt-image-2.5-sunburst' | 'prodia/flux-fast-schnell' | 'quiverai/arrow-1.1' | 'recraft/recraft-v2' | 'recraft/recraft-v3' | 'recraft/recraft-v4' | 'recraft/recraft-v4-pro' | 'recraft/recraft-v4.1' | 'recraft/recraft-v4.1-flash' | 'recraft/recraft-v4.1-pro' | 'recraft/recraft-v4.1-utility' | 'recraft/recraft-v4.1-utility-pro' | 'spacexai/grok-imagine-image' | 'spacexai/grok-imagine-image-2.0' | (string & {});
|
|
11
104
|
//#endregion
|
|
12
105
|
//#region src/gateway-language-model-settings.d.ts
|
|
13
|
-
type GatewayModelId = 'alibaba/qwen-3-14b' | 'alibaba/qwen-3-235b' | 'alibaba/qwen-3-30b' | 'alibaba/qwen-3-32b' | 'alibaba/qwen-3.6-max-preview' | 'alibaba/qwen3-235b-a22b-thinking' | 'alibaba/qwen3-coder' | 'alibaba/qwen3-coder-30b-a3b' | 'alibaba/qwen3-coder-next' | 'alibaba/qwen3-coder-plus' | 'alibaba/qwen3-max' | 'alibaba/qwen3-max-preview' | 'alibaba/qwen3-max-thinking' | 'alibaba/qwen3-next-80b-a3b-instruct' | 'alibaba/qwen3-next-80b-a3b-thinking' | 'alibaba/qwen3-vl-235b-a22b-instruct' | 'alibaba/qwen3-vl-instruct' | 'alibaba/qwen3-vl-thinking' | 'alibaba/qwen3.5-flash' | 'alibaba/qwen3.5-plus' | 'alibaba/qwen3.6-27b' | 'alibaba/qwen3.6-plus' | 'alibaba/qwen3.7-flash' | 'alibaba/qwen3.7-max' | 'alibaba/qwen3.7-plus' | 'alibaba/qwen3.8-2.4t-a95b' | 'alibaba/qwen3.8-27b' | 'alibaba/qwen3.8-flash' | 'alibaba/qwen3.8-max' | 'alibaba/qwen3.8-max-0902' | 'alibaba/qwen3.8-max-prime' | 'alibaba/qwen3.8-omni-flash' | 'amazon/nova-2-lite' | 'amazon/nova-lite' | 'amazon/nova-micro' | 'amazon/nova-pro' | 'anthropic/claude-3-haiku' | 'anthropic/claude-fable-5' | 'anthropic/claude-fable-5.1' | 'anthropic/claude-haiku-4.5' | 'anthropic/claude-opus-4' | 'anthropic/claude-opus-4.5' | 'anthropic/claude-opus-4.6' | 'anthropic/claude-opus-4.7' | 'anthropic/claude-opus-4.8' | 'anthropic/claude-opus-4.8-fast' | 'anthropic/claude-opus-5' | 'anthropic/claude-opus-5-fast' | 'anthropic/claude-opus-5.5' | 'anthropic/claude-opus-5.5-fast' | 'anthropic/claude-sonnet-4' | 'anthropic/claude-sonnet-4.5' | 'anthropic/claude-sonnet-4.6' | 'anthropic/claude-sonnet-5' | 'anthropic/claude-sonnet-5.5' | 'arcee-ai/trinity-large-thinking' | 'bytedance/seed-1.6' | 'bytedance/seed-1.8' | 'bytedance/seed-2.1-turbo' | 'cohere/command-a' | 'deepseek/deepseek-r1' | 'deepseek/deepseek-v3.1' | 'deepseek/deepseek-v3.1-terminus' | 'deepseek/deepseek-v3.2' | 'deepseek/deepseek-v3.2-thinking' | 'deepseek/deepseek-v4-flash' | 'deepseek/deepseek-v4-flash-0731' | 'deepseek/deepseek-v4-flash-vision-exp' | 'deepseek/deepseek-v4-pro' | 'deepseek/deepseek-v4-pro-0813' | 'deepseek/deepseek-v4.1-flash' | 'fireworks/ember-1' | 'google/gemini-2.5-flash' | 'google/gemini-2.5-flash-image' | 'google/gemini-2.5-flash-lite' | 'google/gemini-2.5-pro' | 'google/gemini-3-flash' | 'google/gemini-3-pro-image' | 'google/gemini-3.1-flash-image' | 'google/gemini-3.1-flash-image-preview' | 'google/gemini-3.1-flash-lite' | 'google/gemini-3.1-flash-lite-image' | 'google/gemini-3.1-pro-preview' | 'google/gemini-3.5-flash' | 'google/gemini-3.5-flash-lite' | 'google/gemini-3.6-flash' | 'google/gemini-3.7-flash' | 'google/gemini-3.8-flash' | 'google/gemini-omni-flash-preview' | 'google/gemma-4-26b-a4b-it' | 'google/gemma-4-31b-it' | 'inception/mercury-2' | 'inception/mercury-2.5' | 'inception/mercury-coder-small' | 'inclusionai/ling-3.0-flash' | 'inclusionai/ling-3.0-flash-fin' | 'inclusionai/ling-3.0-flash-sante' | 'inclusionai/ling-3.0-flash-
|
|
106
|
+
type GatewayModelId = 'alibaba/qwen-3-14b' | 'alibaba/qwen-3-235b' | 'alibaba/qwen-3-30b' | 'alibaba/qwen-3-32b' | 'alibaba/qwen-3.6-max-preview' | 'alibaba/qwen3-235b-a22b-thinking' | 'alibaba/qwen3-coder' | 'alibaba/qwen3-coder-30b-a3b' | 'alibaba/qwen3-coder-next' | 'alibaba/qwen3-coder-plus' | 'alibaba/qwen3-max' | 'alibaba/qwen3-max-preview' | 'alibaba/qwen3-max-thinking' | 'alibaba/qwen3-next-80b-a3b-instruct' | 'alibaba/qwen3-next-80b-a3b-thinking' | 'alibaba/qwen3-vl-235b-a22b-instruct' | 'alibaba/qwen3-vl-instruct' | 'alibaba/qwen3-vl-thinking' | 'alibaba/qwen3.5-flash' | 'alibaba/qwen3.5-plus' | 'alibaba/qwen3.6-27b' | 'alibaba/qwen3.6-plus' | 'alibaba/qwen3.7-flash' | 'alibaba/qwen3.7-max' | 'alibaba/qwen3.7-plus' | 'alibaba/qwen3.8-2.4t-a95b' | 'alibaba/qwen3.8-27b' | 'alibaba/qwen3.8-flash' | 'alibaba/qwen3.8-max' | 'alibaba/qwen3.8-max-0902' | 'alibaba/qwen3.8-max-prime' | 'alibaba/qwen3.8-omni-flash' | 'amazon/nova-2-lite' | 'amazon/nova-lite' | 'amazon/nova-micro' | 'amazon/nova-pro' | 'anthropic/claude-3-haiku' | 'anthropic/claude-fable-5' | 'anthropic/claude-fable-5.1' | 'anthropic/claude-haiku-4.5' | 'anthropic/claude-opus-4' | 'anthropic/claude-opus-4.5' | 'anthropic/claude-opus-4.6' | 'anthropic/claude-opus-4.7' | 'anthropic/claude-opus-4.8' | 'anthropic/claude-opus-4.8-fast' | 'anthropic/claude-opus-5' | 'anthropic/claude-opus-5-fast' | 'anthropic/claude-opus-5.5' | 'anthropic/claude-opus-5.5-fast' | 'anthropic/claude-sonnet-4' | 'anthropic/claude-sonnet-4.5' | 'anthropic/claude-sonnet-4.6' | 'anthropic/claude-sonnet-5' | 'anthropic/claude-sonnet-5.5' | 'arcee-ai/trinity-large-thinking' | 'bytedance/seed-1.6' | 'bytedance/seed-1.8' | 'bytedance/seed-2.1-turbo' | 'cohere/command-a' | 'deepseek/deepseek-r1' | 'deepseek/deepseek-v3.1' | 'deepseek/deepseek-v3.1-terminus' | 'deepseek/deepseek-v3.2' | 'deepseek/deepseek-v3.2-thinking' | 'deepseek/deepseek-v4-flash' | 'deepseek/deepseek-v4-flash-0731' | 'deepseek/deepseek-v4-flash-vision-exp' | 'deepseek/deepseek-v4-pro' | 'deepseek/deepseek-v4-pro-0813' | 'deepseek/deepseek-v4.1-flash' | 'deepseek/deepseek-v4.1-flash-fast' | 'fireworks/ember-1' | 'google/gemini-2.5-flash' | 'google/gemini-2.5-flash-image' | 'google/gemini-2.5-flash-lite' | 'google/gemini-2.5-pro' | 'google/gemini-3-flash' | 'google/gemini-3-pro-image' | 'google/gemini-3.1-flash-image' | 'google/gemini-3.1-flash-image-preview' | 'google/gemini-3.1-flash-lite' | 'google/gemini-3.1-flash-lite-image' | 'google/gemini-3.1-pro-preview' | 'google/gemini-3.5-flash' | 'google/gemini-3.5-flash-lite' | 'google/gemini-3.6-flash' | 'google/gemini-3.7-flash' | 'google/gemini-3.8-flash' | 'google/gemini-omni-flash-preview' | 'google/gemma-4-26b-a4b-it' | 'google/gemma-4-31b-it' | 'inception/mercury-2' | 'inception/mercury-2.5' | 'inception/mercury-coder-small' | 'inclusionai/ling-3.0-flash' | 'inclusionai/ling-3.0-flash-fin' | 'inclusionai/ling-3.0-flash-sante' | 'inclusionai/ling-3.0-flash-vl' | 'inclusionai/ling-3.1-flash' | 'inclusionai/ling-3.1-flash-free' | 'inference-net/schematron-v2-small' | 'inference-net/schematron-v2-turbo' | 'interfaze/interfaze-beta' | 'meituan/longcat-2.5-preview' | 'meta/llama-3.1-70b' | 'meta/llama-3.1-8b' | 'meta/llama-3.3-70b' | 'meta/llama-4-maverick' | 'meta/llama-4-scout' | 'meta/muse-glimmer-30b' | 'meta/muse-spark-1.1' | 'meta/muse-spark-1.2' | 'meta/muse-spark-1.2-contributor' | 'meta/muse-spark-1.3' | 'meta/muse-spark-1.3-contributor' | 'minimax/minimax-m2' | 'minimax/minimax-m2.1' | 'minimax/minimax-m2.1-lightning' | 'minimax/minimax-m2.5' | 'minimax/minimax-m2.5-highspeed' | 'minimax/minimax-m2.7' | 'minimax/minimax-m2.7-highspeed' | 'minimax/minimax-m3' | 'mistral/codestral' | 'mistral/ministral-14b' | 'mistral/ministral-3b' | 'mistral/ministral-8b' | 'mistral/mistral-large-3' | 'mistral/mistral-medium-3.5' | 'mistral/mistral-nemo' | 'mistral/mistral-small' | 'mixedbread/toast-1' | 'moonshotai/kimi-k2' | 'moonshotai/kimi-k2-thinking' | 'moonshotai/kimi-k2.5' | 'moonshotai/kimi-k2.6' | 'moonshotai/kimi-k2.7-code' | 'moonshotai/kimi-k2.7-code-highspeed' | 'moonshotai/kimi-k3' | 'moonshotai/kimi-k3-fast' | 'morph/morph-v3-fast' | 'morph/morph-v3-large' | 'nvidia/nemotron-3-nano-30b-a3b' | 'nvidia/nemotron-3-super-120b-a12b' | 'nvidia/nemotron-3-ultra-550b-a55b' | 'nvidia/nemotron-3.5-lightning' | 'nvidia/nemotron-nano-12b-v2-vl' | 'nvidia/nemotron-nano-9b-v2' | 'openai/gpt-3.5-turbo' | 'openai/gpt-4-turbo' | 'openai/gpt-4.1' | 'openai/gpt-4.1-fast' | 'openai/gpt-4.1-mini' | 'openai/gpt-4.1-mini-fast' | 'openai/gpt-4.1-nano' | 'openai/gpt-4.1-nano-fast' | 'openai/gpt-4o' | 'openai/gpt-4o-fast' | 'openai/gpt-4o-mini' | 'openai/gpt-4o-mini-fast' | 'openai/gpt-5' | 'openai/gpt-5-codex' | 'openai/gpt-5-fast' | 'openai/gpt-5-mini' | 'openai/gpt-5-mini-fast' | 'openai/gpt-5-nano' | 'openai/gpt-5-pro' | 'openai/gpt-5.1-codex' | 'openai/gpt-5.1-codex-max' | 'openai/gpt-5.1-codex-mini' | 'openai/gpt-5.1-thinking' | 'openai/gpt-5.1-thinking-fast' | 'openai/gpt-5.2' | 'openai/gpt-5.2-codex' | 'openai/gpt-5.2-fast' | 'openai/gpt-5.2-pro' | 'openai/gpt-5.3-codex' | 'openai/gpt-5.3-codex-fast' | 'openai/gpt-5.4' | 'openai/gpt-5.4-fast' | 'openai/gpt-5.4-mini' | 'openai/gpt-5.4-mini-fast' | 'openai/gpt-5.4-nano' | 'openai/gpt-5.4-pro' | 'openai/gpt-5.5' | 'openai/gpt-5.5-fast' | 'openai/gpt-5.5-pro' | 'openai/gpt-5.6-luna' | 'openai/gpt-5.6-luna-fast' | 'openai/gpt-5.6-sol' | 'openai/gpt-5.6-sol-fast' | 'openai/gpt-5.6-terra' | 'openai/gpt-5.6-terra-fast' | 'openai/gpt-6-astra' | 'openai/gpt-6-astra-fast' | 'openai/gpt-6-luna' | 'openai/gpt-6-luna-fast' | 'openai/gpt-6-sol' | 'openai/gpt-6-sol-fast' | 'openai/gpt-6.1-sol' | 'openai/gpt-6.1-sol-fast' | 'openai/gpt-oss-120b' | 'openai/gpt-oss-20b' | 'openai/gpt-oss-safeguard-120b' | 'openai/gpt-oss-safeguard-20b' | 'openai/o1' | 'openai/o3' | 'openai/o3-fast' | 'openai/o3-mini' | 'openai/o3-pro' | 'openai/o4-mini' | 'openai/o4-mini-fast' | 'perplexity/sonar' | 'poolside/laguna-s-2.1' | 'poolside/laguna-s-2.1-free' | 'quiverai/arrow-2' | 'quiverai/arrow-2-telos' | 'sakana/fugu-max' | 'sakana/fugu-ultra' | 'sakana/fugu-ultra-v2' | 'sakana/namazu' | 'spacexai/grok-4.1-fast-non-reasoning' | 'spacexai/grok-4.1-fast-reasoning' | 'spacexai/grok-4.20-multi-agent' | 'spacexai/grok-4.20-multi-agent-beta' | 'spacexai/grok-4.20-non-reasoning' | 'spacexai/grok-4.20-non-reasoning-beta' | 'spacexai/grok-4.20-reasoning' | 'spacexai/grok-4.20-reasoning-beta' | 'spacexai/grok-4.3' | 'spacexai/grok-4.5' | 'spacexai/grok-4.6' | 'spacexai/grok-4.7' | 'spacexai/grok-build-0.1' | 'stepfun/step-3.5-flash' | 'stepfun/step-3.7-flash' | 'stepfun/step-5-preview' | 'tencent/hy-mt2-lite' | 'tencent/hy-mt2-plus' | 'tencent/hy-mt2-pro' | 'tencent/hy3' | 'tencent/hy4-preview' | 'thinkingmachines/inkling' | 'thinkingmachines/inkling-small' | 'xiaomi/mimo-v2.5' | 'xiaomi/mimo-v2.5-pro' | 'xiaomi/mimo-v2.6-flash' | 'xiaomi/mimo-v2.6-pro' | 'xiaomi/mimo-v2.6-pro-ultraspeed' | 'zai/glm-4.5' | 'zai/glm-4.5-air' | 'zai/glm-4.5v' | 'zai/glm-4.6' | 'zai/glm-4.7' | 'zai/glm-4.7-flash' | 'zai/glm-4.7-flashx' | 'zai/glm-5' | 'zai/glm-5-turbo' | 'zai/glm-5.1' | 'zai/glm-5.2' | 'zai/glm-5.2-fast' | 'zai/glm-5.3' | 'zai/glm-5.3-fast' | 'zai/glm-5.3-flash' | 'zai/glm-5.3-flashx' | 'zai/glm-5v-turbo' | (string & {});
|
|
14
107
|
//#endregion
|
|
15
108
|
//#region src/gateway-realtime-auth.d.ts
|
|
16
109
|
/**
|
|
@@ -93,10 +186,10 @@ type GatewaySpeechModelId = 'fish-audio/s1' | 'fish-audio/s2-pro' | 'fish-audio/
|
|
|
93
186
|
type GatewayTranscriptionModelId = 'fish-audio/transcribe-1' | 'google/gemini-3.5-transcribe' | 'google/gemini-3.5-transcribe-live' | 'microsoft/mai-transcribe-1.5' | 'microsoft/mai-transcribe-2' | 'microsoft/mai-transcribe-2-streaming' | 'openai/gpt-4o-mini-transcribe' | 'openai/gpt-4o-transcribe' | 'openai/gpt-realtime-whisper' | 'openai/whisper-1' | 'spacexai/grok-stt' | (string & {});
|
|
94
187
|
//#endregion
|
|
95
188
|
//#region src/gateway-video-model-settings.d.ts
|
|
96
|
-
type GatewayVideoModelId = 'alibaba/wan-v2.5-t2v-preview' | 'alibaba/wan-v2.6-i2v' | 'alibaba/wan-v2.6-i2v-flash' | 'alibaba/wan-v2.6-r2v' | 'alibaba/wan-v2.6-r2v-flash' | 'alibaba/wan-v2.6-t2v' | 'alibaba/wan-v2.7-r2v' | 'alibaba/wan-v2.7-t2v' | 'alibaba/wan-v3.0-video' | 'alibaba/wan-v3.0-video-prime' | 'bfl/flux-3-video' | 'bytedance/seedance-2.0' | 'bytedance/seedance-2.0-fast' | 'bytedance/seedance-2.0-mini' | 'bytedance/seedance-2.5' | 'bytedance/seedance-v1.0-pro' | 'bytedance/seedance-v1.0-pro-fast' | 'bytedance/seedance-v1.5-pro' | 'google/veo-3.0-fast-generate-001' | 'google/veo-3.0-generate-001' | 'google/veo-3.1-fast-generate-001' | 'google/veo-3.1-generate-001' | 'google/veo-3.1-lite-generate-001' | 'klingai/kling-v2.5-turbo-i2v' | 'klingai/kling-v2.5-turbo-t2v' | 'klingai/kling-v2.6-i2v' | 'klingai/kling-v2.6-motion-control' | 'klingai/kling-v2.6-t2v' | 'klingai/kling-v3.0-i2v' | 'klingai/kling-v3.0-motion-control' | 'klingai/kling-v3.0-t2v' | 'minimax/minimax-h3' | 'minimax/minimax-h3-max' | 'spacexai/grok-imagine-video' | 'spacexai/grok-imagine-video-1.5' | (string & {});
|
|
189
|
+
type GatewayVideoModelId = 'alibaba/wan-v2.5-t2v-preview' | 'alibaba/wan-v2.6-i2v' | 'alibaba/wan-v2.6-i2v-flash' | 'alibaba/wan-v2.6-r2v' | 'alibaba/wan-v2.6-r2v-flash' | 'alibaba/wan-v2.6-t2v' | 'alibaba/wan-v2.7-r2v' | 'alibaba/wan-v2.7-t2v' | 'alibaba/wan-v3.0-video' | 'alibaba/wan-v3.0-video-prime' | 'bfl/flux-3-video' | 'bytedance/seedance-2.0' | 'bytedance/seedance-2.0-fast' | 'bytedance/seedance-2.0-mini' | 'bytedance/seedance-2.5' | 'bytedance/seedance-v1.0-pro' | 'bytedance/seedance-v1.0-pro-fast' | 'bytedance/seedance-v1.5-pro' | 'google/veo-3.0-fast-generate-001' | 'google/veo-3.0-generate-001' | 'google/veo-3.1-fast-generate-001' | 'google/veo-3.1-generate-001' | 'google/veo-3.1-lite-generate-001' | 'klingai/kling-v2.5-turbo-i2v' | 'klingai/kling-v2.5-turbo-t2v' | 'klingai/kling-v2.6-i2v' | 'klingai/kling-v2.6-motion-control' | 'klingai/kling-v2.6-t2v' | 'klingai/kling-v3.0-i2v' | 'klingai/kling-v3.0-motion-control' | 'klingai/kling-v3.0-t2v' | 'minimax/minimax-h3' | 'minimax/minimax-h3-max' | 'spacexai/grok-imagine-video' | 'spacexai/grok-imagine-video-1.5' | 'spacexai/grok-imagine-video-1.5-lite' | (string & {});
|
|
97
190
|
//#endregion
|
|
98
191
|
//#region src/gateway-model-entry.d.ts
|
|
99
|
-
declare const KNOWN_MODEL_TYPES: readonly ["embedding", "evaluation", "image", "language", "realtime", "reranking", "speech", "transcription", "video"];
|
|
192
|
+
declare const KNOWN_MODEL_TYPES: readonly ["embedding", "decision", "evaluation", "image", "language", "realtime", "reranking", "speech", "transcription", "video"];
|
|
100
193
|
type KnownModelType = (typeof KNOWN_MODEL_TYPES)[number];
|
|
101
194
|
interface GatewayLanguageModelEntry {
|
|
102
195
|
/**
|
|
@@ -1117,13 +1210,19 @@ interface GatewayProvider extends ProviderV4 {
|
|
|
1117
1210
|
*/
|
|
1118
1211
|
rerankingModel(modelId: GatewayRerankingModelId): RerankingModelV4;
|
|
1119
1212
|
/**
|
|
1120
|
-
* Creates a model for
|
|
1213
|
+
* Creates a model for deciding answers to questions against shared state.
|
|
1121
1214
|
*/
|
|
1122
|
-
|
|
1215
|
+
decision(modelId: GatewayDecisionModelId): Experimental_DecisionModelV4;
|
|
1123
1216
|
/**
|
|
1124
|
-
* Creates a model for
|
|
1217
|
+
* Creates a model for deciding answers to questions against shared state.
|
|
1125
1218
|
*/
|
|
1126
|
-
|
|
1219
|
+
decisionModel(modelId: GatewayDecisionModelId): Experimental_DecisionModelV4;
|
|
1220
|
+
/** @deprecated Use `decisionModel` instead. */
|
|
1221
|
+
evaluationModel(modelId: GatewayDecisionModelId): Experimental_DecisionModelV4 & {
|
|
1222
|
+
doEvaluate: Experimental_DecisionModelV4['doDecide'];
|
|
1223
|
+
};
|
|
1224
|
+
/** @deprecated Use `decision` instead. */
|
|
1225
|
+
evaluation(modelId: GatewayDecisionModelId): ReturnType<GatewayProvider['evaluationModel']>;
|
|
1127
1226
|
/**
|
|
1128
1227
|
* Creates a model for text-to-speech generation.
|
|
1129
1228
|
*/
|
|
@@ -1248,99 +1347,6 @@ type GatewayProviderMetadata = {
|
|
|
1248
1347
|
readonly [key: string]: JSONValue | undefined;
|
|
1249
1348
|
};
|
|
1250
1349
|
//#endregion
|
|
1251
|
-
//#region src/gateway-provider-options.d.ts
|
|
1252
|
-
/**
|
|
1253
|
-
* A condition on the primary model's answers. `QUESTION_ID` narrows
|
|
1254
|
-
* `question` to your question IDs. Without `question`, `confidenceBelow`
|
|
1255
|
-
* checks every Choice and Score question and `probabilityBetween` every
|
|
1256
|
-
* Boolean question. Groups nest at most five levels deep, which the SDK
|
|
1257
|
-
* checks at runtime.
|
|
1258
|
-
*/
|
|
1259
|
-
type EvaluationFallbackCondition<QUESTION_ID extends string = string> = ExclusiveCondition<{
|
|
1260
|
-
question?: QUESTION_ID;
|
|
1261
|
-
confidenceBelow: number;
|
|
1262
|
-
}> | ExclusiveCondition<{
|
|
1263
|
-
question?: QUESTION_ID;
|
|
1264
|
-
probabilityBetween: [number, number];
|
|
1265
|
-
}> | ExclusiveCondition<{
|
|
1266
|
-
any: EvaluationFallbackConditionList<QUESTION_ID>;
|
|
1267
|
-
}> | ExclusiveCondition<{
|
|
1268
|
-
all: EvaluationFallbackConditionList<QUESTION_ID>;
|
|
1269
|
-
}> | ExclusiveCondition<{
|
|
1270
|
-
atLeast: {
|
|
1271
|
-
count: number;
|
|
1272
|
-
conditions: EvaluationFallbackConditionList<QUESTION_ID>;
|
|
1273
|
-
};
|
|
1274
|
-
}>;
|
|
1275
|
-
type GatewayModelFallback<QUESTION_ID extends string = string> = string | {
|
|
1276
|
-
model: string;
|
|
1277
|
-
when: EvaluationFallbackCondition<QUESTION_ID>;
|
|
1278
|
-
};
|
|
1279
|
-
type GatewayProviderOptions<QUESTION_ID extends string = string> = {
|
|
1280
|
-
/**
|
|
1281
|
-
* Service-owned options may be added by the Gateway without requiring an SDK
|
|
1282
|
-
* release. The Gateway service validates and applies the runtime schema.
|
|
1283
|
-
*/
|
|
1284
|
-
[key: string]: unknown;
|
|
1285
|
-
/** Request-scoped BYOK credentials to use instead of cached credentials. */
|
|
1286
|
-
byok?: Record<string, Array<Record<string, unknown>>>;
|
|
1287
|
-
/** Enables automatic caching behavior when supported by the Gateway. */
|
|
1288
|
-
caching?: 'auto';
|
|
1289
|
-
/** Filter to providers that do not train on prompt data. */
|
|
1290
|
-
disallowPromptTraining?: boolean;
|
|
1291
|
-
/**
|
|
1292
|
-
* Restrict routing to provider models that satisfy every given entry.
|
|
1293
|
-
*
|
|
1294
|
-
* Entries are capability tags (`'implicit-caching'`, `'reasoning'`,
|
|
1295
|
-
* `'tool-use'`, `'vision'` (image input), `'structured-output'`
|
|
1296
|
-
* (schema-constrained output)) or weight-format conditions:
|
|
1297
|
-
* `'quantization:fp8'` requires the serving provider to report that weight
|
|
1298
|
-
* format, `'!quantization:fp8'` excludes it (providers with no recorded
|
|
1299
|
-
* format still pass an exclusion). Format values are an open space but must
|
|
1300
|
-
* match `[a-zA-Z0-9._-]{1,32}` and compare case-insensitively. Unknown
|
|
1301
|
-
* capability names are rejected by the Gateway with a 400.
|
|
1302
|
-
*/
|
|
1303
|
-
has?: Array<'implicit-caching' | 'reasoning' | 'structured-output' | 'tool-use' | 'vision' | `quantization:${string}` | `!quantization:${string}`>;
|
|
1304
|
-
/**
|
|
1305
|
-
* Idempotency key for `experimental_startBatch`: retries with the same
|
|
1306
|
-
* key replay the original batch instead of creating a duplicate.
|
|
1307
|
-
*/
|
|
1308
|
-
idempotencyKey?: string;
|
|
1309
|
-
/**
|
|
1310
|
-
* Fallback models to try in order. On evaluation requests, the first entry
|
|
1311
|
-
* can be a conditional `{ model, when }` fallback that reruns the evaluation
|
|
1312
|
-
* when `when` matches the primary answers. Other request types reject a
|
|
1313
|
-
* conditional entry. Pass your question IDs as `QUESTION_ID` to check the
|
|
1314
|
-
* `question` names in `when`.
|
|
1315
|
-
*/
|
|
1316
|
-
models?: GatewayModelFallbackList<QUESTION_ID>;
|
|
1317
|
-
/** Array of provider slugs that are the only ones allowed to be used. */
|
|
1318
|
-
only?: string[];
|
|
1319
|
-
/** Array of provider slugs specifying the provider attempt order. */
|
|
1320
|
-
order?: string[];
|
|
1321
|
-
/** Per-provider timeouts for BYOK credentials in milliseconds. */
|
|
1322
|
-
providerTimeouts?: {
|
|
1323
|
-
byok?: Record<string, number>;
|
|
1324
|
-
};
|
|
1325
|
-
/** Entity identifier against which quota is tracked. */
|
|
1326
|
-
quotaEntityId?: string;
|
|
1327
|
-
/** Unified service tier intent. */
|
|
1328
|
-
serviceTier?: 'flex' | 'priority';
|
|
1329
|
-
/** Sort providers by a performance or cost metric before routing. */
|
|
1330
|
-
sort?: 'cost' | 'tps' | 'ttft';
|
|
1331
|
-
/** User-specified tags for reporting and filtering usage. */
|
|
1332
|
-
tags?: string[];
|
|
1333
|
-
/** End-user identifier for spend tracking and attribution. */
|
|
1334
|
-
user?: string;
|
|
1335
|
-
/** Filter to providers with zero data retention agreements. */
|
|
1336
|
-
zeroDataRetention?: boolean;
|
|
1337
|
-
};
|
|
1338
|
-
type EvaluationFallbackConditionList<QUESTION_ID extends string> = [EvaluationFallbackCondition<QUESTION_ID>, ...EvaluationFallbackCondition<QUESTION_ID>[]];
|
|
1339
|
-
type ConditionKey = 'question' | 'confidenceBelow' | 'probabilityBetween' | 'any' | 'all' | 'atLeast';
|
|
1340
|
-
type ExclusiveCondition<CONDITION> = CONDITION & { [KEY in Exclude<ConditionKey, keyof CONDITION>]?: never; };
|
|
1341
|
-
type ConditionalGatewayModelFallback<QUESTION_ID extends string> = Exclude<GatewayModelFallback<QUESTION_ID>, string>;
|
|
1342
|
-
type GatewayModelFallbackList<QUESTION_ID extends string> = string[] | [ConditionalGatewayModelFallback<QUESTION_ID>, ...string[]];
|
|
1343
|
-
//#endregion
|
|
1344
1350
|
//#region src/errors/gateway-error.d.ts
|
|
1345
1351
|
declare const symbol$9: unique symbol;
|
|
1346
1352
|
export declare abstract class GatewayError extends Error {
|
|
@@ -1569,5 +1575,11 @@ export declare class GatewayResponseError extends GatewayError {
|
|
|
1569
1575
|
//#region src/version.d.ts
|
|
1570
1576
|
export declare const VERSION: string;
|
|
1571
1577
|
//#endregion
|
|
1572
|
-
|
|
1578
|
+
//#region src/index.d.ts
|
|
1579
|
+
/** @deprecated Use `GatewayDecisionModelId` instead. */
|
|
1580
|
+
export type GatewayEvaluationModelId = GatewayDecisionModelId;
|
|
1581
|
+
/** @deprecated Use `DecisionFallbackCondition` instead. */
|
|
1582
|
+
export type EvaluationFallbackCondition<QUESTION_ID extends string = string> = DecisionFallbackCondition<QUESTION_ID>;
|
|
1583
|
+
//#endregion
|
|
1584
|
+
export { type DecisionFallbackCondition, type GatewayAsyncJobMetadata, type GatewayCreditsResponse, type GatewayDecisionModelId, type GatewayEmbeddingModelId, type GatewayErrorResponse, type GatewayGenerationInfo, type GatewayGenerationInfoParams, type GatewayImageModelId, type GatewayLanguageModelEntry, type GatewayLanguageModelEntry as GatewayModelEntry, type GatewayProviderOptions as GatewayLanguageModelOptions, type GatewayProviderOptions, type GatewayLanguageModelSpecification, type GatewayModelFallback, type GatewayModelId, type GatewayProvider, type GatewayProviderMetadata, type GatewayProviderSettings, type GatewayRealtimeModelId, type GatewayRerankingModelId, type GatewaySpeechModelId, type GatewaySpendReportParams, type GatewaySpendReportResponse, type GatewaySpendReportRow, type GatewayTranscriptionModelId, type GatewayVideoModelId, createGateway as createGatewayProvider };
|
|
1573
1585
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":["_$__tool_browserbase_fetch0.BrowserbaseFetchConfig","_$__tool_browserbase_fetch0.browserbaseFetchToolFactory","_$__tool_browserbase_search0.BrowserbaseSearchConfig","_$__tool_browserbase_search0.browserbaseSearchToolFactory","_$__tool_exa_search0.ExaSearchConfig","_$__tool_exa_search0.exaSearchToolFactory","_$__tool_parallel_search0.ParallelSearchConfig","_$__tool_parallel_search0.parallelSearchToolFactory","_$__tool_perplexity_search0.PerplexitySearchConfig","_$__tool_perplexity_search0.perplexitySearchToolFactory","_$__tool_tako_search0.TakoSearchConfig","_$__tool_tako_search0.takoSearchToolFactory","BatchV4","RealtimeFactoryV4","symbol","symbol","symbol","symbol","symbol","symbol","symbol","symbol","symbol"],"sources":["../src/gateway-
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":["_$__tool_browserbase_fetch0.BrowserbaseFetchConfig","_$__tool_browserbase_fetch0.browserbaseFetchToolFactory","_$__tool_browserbase_search0.BrowserbaseSearchConfig","_$__tool_browserbase_search0.browserbaseSearchToolFactory","_$__tool_exa_search0.ExaSearchConfig","_$__tool_exa_search0.exaSearchToolFactory","_$__tool_parallel_search0.ParallelSearchConfig","_$__tool_parallel_search0.parallelSearchToolFactory","_$__tool_perplexity_search0.PerplexitySearchConfig","_$__tool_perplexity_search0.perplexitySearchToolFactory","_$__tool_tako_search0.TakoSearchConfig","_$__tool_tako_search0.takoSearchToolFactory","BatchV4","RealtimeFactoryV4","symbol","symbol","symbol","symbol","symbol","symbol","symbol","symbol","symbol"],"sources":["../src/gateway-decision-model-settings.ts","../src/gateway-provider-options.ts","../src/gateway-embedding-model-settings.ts","../src/gateway-image-model-settings.ts","../src/gateway-language-model-settings.ts","../src/gateway-realtime-auth.ts","../src/gateway-realtime-model-settings.ts","../src/gateway-reranking-model-settings.ts","../src/gateway-speech-model-settings.ts","../src/gateway-transcription-model-settings.ts","../src/gateway-video-model-settings.ts","../src/gateway-model-entry.ts","../src/gateway-fetch-metadata.ts","../src/gateway-spend-report.ts","../src/gateway-generation-info.ts","../src/tool/browserbase-fetch.ts","../src/tool/browserbase-search.ts","../src/tool/exa-search.ts","../src/tool/parallel-search.ts","../src/tool/perplexity-search.ts","../src/tool/tako-search.ts","../src/gateway-tools.ts","../src/gateway-provider.ts","../src/gateway-provider-metadata.ts","../src/errors/gateway-error.ts","../src/errors/create-gateway-error.ts","../src/errors/gateway-authentication-error.ts","../src/errors/gateway-failed-dependency-error.ts","../src/errors/gateway-forbidden-error.ts","../src/errors/gateway-internal-server-error.ts","../src/errors/gateway-invalid-request-error.ts","../src/errors/gateway-model-not-found-error.ts","../src/errors/gateway-not-found-error.ts","../src/errors/gateway-rate-limit-error.ts","../src/errors/gateway-response-error.ts","../src/version.ts","../src/index.ts"],"mappings":";;;KAAY;;;;;;;;;;KC0BA,0BAA0B,uCAClC;EAAqB,WAAW;EAAa;KAC7C;EACE,WAAW;EACX;KAEF;EAAqB,KAAK,8BAA8B;KACxD;EAAqB,KAAK,8BAA8B;KACxD;EACE;IACE;IACA,YAAY,8BAA8B;;;KAItC,qBAAqB;EAG3B;EACA,MAAM,0BAA0B;;KAG1B,uBAAuB;;;;;GAKhC;;EAGD,OAAO,eAAe,MAAM;;EAG5B;;EAGA;;;;;;;;;;;;;EAcA,MAAM;;;;;EAcN;;;;;;;;EASA,SAAS,yBAAyB;;EAGlC;;EAGA;;EAGA;IACE,OAAO;;;EAIT;;EAGA;;EAGA;;EAGA;;EAGA;;EAGA;;KAGG,8BAA8B,+BACjC,0BAA0B,iBACvB,0BAA0B;KAG1B;KASA,mBAAmB,aAAa,eAClC,OAAO,QAAQ,oBAAoB;KAGjC,gCAAgC,8BAA8B,QACjE,qBAAqB;KAIlB,yBAAyB,0CAEzB,gCAAgC;;;KC5JzB;;;KCAA;;;KCAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBC2BC;;;;;qBAMA;;qBAGA;;qBAGA;;;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kC;oBAC3BA;WAET;WACA;WACA;EAEG,cACV,SACA,YACA,SACA,OACA;IAEA;IACA;IACA;IACA;IACA;;SAMK,WAAW,iBAAiB,SAAS;;;;cCvCxCC;;;;;;qBAOO,6BAA6B;oBACtBA;WAET;WACA;EAEG,cACV,SACA,YACA,OACA;IAEA;IACA;IACA;IACA;;SAKK,WAAW,iBAAiB,SAAS;;;;cC3BxCC;;;;qBAKO,8BAA8B;oBACvBA;WAET;WACA;EAEG,cACV,SACA,YACA,OACA;IAEA;IACA;IACA;IACA;;SAKK,WAAW,iBAAiB,SAAS;;;;cCxBxC;;;;qBAKO,6BAA6B;oBACtB;WAET;WACA;WACA;WACA,kBAAkB;EAEf,cACV,SACA,YACA,UACA,iBACA,OACA,cACA;IAEA;IACA;IACA;IACA,kBAAkB;IAClB;IACA;IACA;;SAOK,WAAW,iBAAiB,SAAS;;;;qBCtCjC;;;;YCwED,2BAA2B;;YAE3B,4BAA4B,uCACtC,0BAA0B"}
|
package/dist/index.js
CHANGED
|
@@ -618,6 +618,7 @@ const gatewayAuthMethodSchema = lazySchema(() => zodSchema(z.union([z.literal("a
|
|
|
618
618
|
//#region src/gateway-model-entry.ts
|
|
619
619
|
const KNOWN_MODEL_TYPES = [
|
|
620
620
|
"embedding",
|
|
621
|
+
"decision",
|
|
621
622
|
"evaluation",
|
|
622
623
|
"image",
|
|
623
624
|
"language",
|
|
@@ -1762,7 +1763,7 @@ const gatewayVideoStatusResponseSchema = z.discriminatedUnion("status", [
|
|
|
1762
1763
|
providerMetadata: z.record(z.string(), providerMetadataEntrySchema$2).nullish()
|
|
1763
1764
|
})
|
|
1764
1765
|
]);
|
|
1765
|
-
const
|
|
1766
|
+
const gatewayDecisionProviderOptionsSchema = lazySchema(() => zodSchema(z.object({ models: gatewayModelFallbacksSchema.optional() }).catchall(z.unknown())));
|
|
1766
1767
|
const probabilitySchema = z.number().finite().min(0).max(1);
|
|
1767
1768
|
const questionSchema = z.string().min(1).max(256);
|
|
1768
1769
|
const directConditionSchema = z.union([z.object({
|
|
@@ -1790,11 +1791,11 @@ const gatewayModelFallbacksSchema = z.array(z.union([z.string(), conditionalMode
|
|
|
1790
1791
|
const conditionalIndexes = entries.flatMap((entry, index) => typeof entry === "string" ? [] : [index]);
|
|
1791
1792
|
if (conditionalIndexes.length > 1) context.addIssue({
|
|
1792
1793
|
code: "custom",
|
|
1793
|
-
message: "models supports at most one conditional
|
|
1794
|
+
message: "models supports at most one conditional decision fallback"
|
|
1794
1795
|
});
|
|
1795
1796
|
if (conditionalIndexes[0] !== void 0 && conditionalIndexes[0] !== 0) context.addIssue({
|
|
1796
1797
|
code: "custom",
|
|
1797
|
-
message: "a conditional
|
|
1798
|
+
message: "a conditional decision fallback must be the first models entry",
|
|
1798
1799
|
path: [conditionalIndexes[0]]
|
|
1799
1800
|
});
|
|
1800
1801
|
});
|
|
@@ -1816,8 +1817,8 @@ function conditionSchema(depth) {
|
|
|
1816
1817
|
]);
|
|
1817
1818
|
}
|
|
1818
1819
|
//#endregion
|
|
1819
|
-
//#region src/gateway-
|
|
1820
|
-
var
|
|
1820
|
+
//#region src/gateway-decision-model.ts
|
|
1821
|
+
var GatewayDecisionModel = class {
|
|
1821
1822
|
constructor(modelId, config) {
|
|
1822
1823
|
this.modelId = modelId;
|
|
1823
1824
|
this.config = config;
|
|
@@ -1831,11 +1832,15 @@ var GatewayEvaluationModel = class {
|
|
|
1831
1832
|
get provider() {
|
|
1832
1833
|
return this.config.provider;
|
|
1833
1834
|
}
|
|
1834
|
-
|
|
1835
|
+
/** @deprecated Use `doDecide` instead. */
|
|
1836
|
+
doEvaluate(options) {
|
|
1837
|
+
return this.doDecide(options);
|
|
1838
|
+
}
|
|
1839
|
+
async doDecide({ state, questions, headers, abortSignal, providerOptions }) {
|
|
1835
1840
|
const gatewayOptions = await parseProviderOptions({
|
|
1836
1841
|
provider: "gateway",
|
|
1837
1842
|
providerOptions,
|
|
1838
|
-
schema:
|
|
1843
|
+
schema: gatewayDecisionProviderOptionsSchema
|
|
1839
1844
|
});
|
|
1840
1845
|
const validatedProviderOptions = gatewayOptions == null ? providerOptions : {
|
|
1841
1846
|
...providerOptions,
|
|
@@ -1851,7 +1856,7 @@ var GatewayEvaluationModel = class {
|
|
|
1851
1856
|
questions,
|
|
1852
1857
|
...validatedProviderOptions ? { providerOptions: validatedProviderOptions } : {}
|
|
1853
1858
|
},
|
|
1854
|
-
successfulResponseHandler: createJsonResponseHandler(
|
|
1859
|
+
successfulResponseHandler: createJsonResponseHandler(gatewayDecisionResponseSchema),
|
|
1855
1860
|
failedResponseHandler: createJsonErrorResponseHandler({
|
|
1856
1861
|
errorSchema: z.any(),
|
|
1857
1862
|
errorToMessage: (data) => getErrorMessage(data) ?? "unknown error"
|
|
@@ -1876,16 +1881,16 @@ var GatewayEvaluationModel = class {
|
|
|
1876
1881
|
}
|
|
1877
1882
|
}
|
|
1878
1883
|
getUrl() {
|
|
1879
|
-
return `${this.config.baseURL}/
|
|
1884
|
+
return `${this.config.baseURL}/decision-model`;
|
|
1880
1885
|
}
|
|
1881
1886
|
getModelConfigHeaders() {
|
|
1882
1887
|
return {
|
|
1883
|
-
"ai-
|
|
1888
|
+
"ai-decision-model-specification-version": "4",
|
|
1884
1889
|
"ai-model-id": this.modelId
|
|
1885
1890
|
};
|
|
1886
1891
|
}
|
|
1887
1892
|
};
|
|
1888
|
-
const
|
|
1893
|
+
const gatewayDecisionAnswerSchema = z.discriminatedUnion("type", [
|
|
1889
1894
|
z.object({
|
|
1890
1895
|
type: z.literal("choice"),
|
|
1891
1896
|
choice: z.string(),
|
|
@@ -1901,7 +1906,7 @@ const gatewayEvaluationAnswerSchema = z.discriminatedUnion("type", [
|
|
|
1901
1906
|
probability: z.number()
|
|
1902
1907
|
})
|
|
1903
1908
|
]);
|
|
1904
|
-
const
|
|
1909
|
+
const gatewayDecisionWarningSchema = z.discriminatedUnion("type", [
|
|
1905
1910
|
z.object({
|
|
1906
1911
|
type: z.literal("unsupported"),
|
|
1907
1912
|
feature: z.string(),
|
|
@@ -1922,8 +1927,8 @@ const gatewayEvaluationWarningSchema = z.discriminatedUnion("type", [
|
|
|
1922
1927
|
message: z.string()
|
|
1923
1928
|
})
|
|
1924
1929
|
]);
|
|
1925
|
-
const
|
|
1926
|
-
answers: z.record(z.string(),
|
|
1930
|
+
const gatewayDecisionResponseSchema = lazySchema(() => zodSchema(z.object({
|
|
1931
|
+
answers: z.record(z.string(), gatewayDecisionAnswerSchema),
|
|
1927
1932
|
model: z.string().optional(),
|
|
1928
1933
|
rounding: z.object({
|
|
1929
1934
|
probabilityDecimals: z.number().optional(),
|
|
@@ -1933,7 +1938,7 @@ const gatewayEvaluationResponseSchema = lazySchema(() => zodSchema(z.object({
|
|
|
1933
1938
|
inputTokens: z.number().optional(),
|
|
1934
1939
|
outputTokens: z.number().optional()
|
|
1935
1940
|
}).optional(),
|
|
1936
|
-
warnings: z.array(
|
|
1941
|
+
warnings: z.array(gatewayDecisionWarningSchema).optional(),
|
|
1937
1942
|
providerMetadata: z.record(z.string(), z.record(z.string(), z.unknown())).optional()
|
|
1938
1943
|
})));
|
|
1939
1944
|
//#endregion
|
|
@@ -3011,7 +3016,7 @@ async function getVercelRequestId() {
|
|
|
3011
3016
|
}
|
|
3012
3017
|
//#endregion
|
|
3013
3018
|
//#region src/version.ts
|
|
3014
|
-
const VERSION = "4.0.
|
|
3019
|
+
const VERSION = "4.0.104";
|
|
3015
3020
|
//#endregion
|
|
3016
3021
|
//#region src/gateway-provider.ts
|
|
3017
3022
|
const AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
|
|
@@ -3228,8 +3233,8 @@ function createGateway(options = {}) {
|
|
|
3228
3233
|
};
|
|
3229
3234
|
provider.rerankingModel = createRerankingModel;
|
|
3230
3235
|
provider.reranking = createRerankingModel;
|
|
3231
|
-
const
|
|
3232
|
-
return new
|
|
3236
|
+
const createDecisionModel = (modelId) => {
|
|
3237
|
+
return new GatewayDecisionModel(modelId, {
|
|
3233
3238
|
provider: "gateway",
|
|
3234
3239
|
baseURL,
|
|
3235
3240
|
headers: getHeaders,
|
|
@@ -3237,8 +3242,10 @@ function createGateway(options = {}) {
|
|
|
3237
3242
|
o11yHeaders: createO11yHeaders()
|
|
3238
3243
|
});
|
|
3239
3244
|
};
|
|
3240
|
-
provider.
|
|
3241
|
-
provider.
|
|
3245
|
+
provider.decisionModel = createDecisionModel;
|
|
3246
|
+
provider.decision = createDecisionModel;
|
|
3247
|
+
provider.evaluationModel = createDecisionModel;
|
|
3248
|
+
provider.evaluation = createDecisionModel;
|
|
3242
3249
|
const createSpeechModel = (modelId) => {
|
|
3243
3250
|
return new GatewaySpeechModel(modelId, {
|
|
3244
3251
|
provider: "gateway",
|