@ai-sdk/gateway 0.0.0-02dba89b-20251009204516 → 0.0.0-4115c213-20260122152721
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 +886 -167
- package/dist/index.d.mts +205 -34
- package/dist/index.d.ts +205 -34
- package/dist/index.js +459 -180
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +450 -148
- package/dist/index.mjs.map +1 -1
- package/docs/00-ai-gateway.mdx +625 -0
- package/package.json +19 -6
- package/src/errors/as-gateway-error.ts +33 -0
- package/src/errors/create-gateway-error.ts +132 -0
- package/src/errors/extract-api-call-response.ts +15 -0
- package/src/errors/gateway-authentication-error.ts +84 -0
- package/src/errors/gateway-error.ts +47 -0
- package/src/errors/gateway-internal-server-error.ts +33 -0
- package/src/errors/gateway-invalid-request-error.ts +33 -0
- package/src/errors/gateway-model-not-found-error.ts +47 -0
- package/src/errors/gateway-rate-limit-error.ts +33 -0
- package/src/errors/gateway-response-error.ts +42 -0
- package/src/errors/index.ts +16 -0
- package/src/errors/parse-auth-method.ts +23 -0
- package/src/gateway-config.ts +7 -0
- package/src/gateway-embedding-model-settings.ts +22 -0
- package/src/gateway-embedding-model.ts +109 -0
- package/src/gateway-fetch-metadata.ts +127 -0
- package/src/gateway-image-model-settings.ts +12 -0
- package/src/gateway-image-model.ts +145 -0
- package/src/gateway-language-model-settings.ts +159 -0
- package/src/gateway-language-model.ts +212 -0
- package/src/gateway-model-entry.ts +58 -0
- package/src/gateway-provider-options.ts +66 -0
- package/src/gateway-provider.ts +284 -0
- package/src/gateway-tools.ts +15 -0
- package/src/index.ts +27 -0
- package/src/tool/perplexity-search.ts +294 -0
- package/src/vercel-environment.ts +6 -0
- package/src/version.ts +6 -0
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
import { LanguageModelV3, ProviderV3, EmbeddingModelV3, ImageModelV3, TypeValidationError } from '@ai-sdk/provider';
|
|
2
|
+
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
3
|
+
import { FetchFunction, InferSchema } from '@ai-sdk/provider-utils';
|
|
4
4
|
|
|
5
|
-
type GatewayModelId = 'alibaba/qwen-3-14b' | 'alibaba/qwen-3-235b' | 'alibaba/qwen-3-30b' | 'alibaba/qwen-3-32b' | 'alibaba/qwen3-coder' | 'alibaba/qwen3-coder-plus' | 'alibaba/qwen3-max' | 'alibaba/qwen3-max-preview' | 'alibaba/qwen3-next-80b-a3b-instruct' | 'alibaba/qwen3-next-80b-a3b-thinking' | 'alibaba/qwen3-vl-instruct' | 'alibaba/qwen3-vl-thinking' | 'amazon/nova-lite' | 'amazon/nova-micro' | 'amazon/nova-pro' | 'anthropic/claude-3-haiku' | 'anthropic/claude-3-opus' | 'anthropic/claude-3.5-haiku' | 'anthropic/claude-3.5-sonnet' | 'anthropic/claude-3.7-sonnet' | 'anthropic/claude-opus-4' | 'anthropic/claude-opus-4.1' | 'anthropic/claude-sonnet-4' | '
|
|
5
|
+
type GatewayModelId = 'alibaba/qwen-3-14b' | 'alibaba/qwen-3-235b' | 'alibaba/qwen-3-30b' | 'alibaba/qwen-3-32b' | 'alibaba/qwen3-235b-a22b-thinking' | 'alibaba/qwen3-coder' | 'alibaba/qwen3-coder-30b-a3b' | 'alibaba/qwen3-coder-plus' | 'alibaba/qwen3-max' | 'alibaba/qwen3-max-preview' | 'alibaba/qwen3-next-80b-a3b-instruct' | 'alibaba/qwen3-next-80b-a3b-thinking' | 'alibaba/qwen3-vl-instruct' | 'alibaba/qwen3-vl-thinking' | 'amazon/nova-2-lite' | 'amazon/nova-lite' | 'amazon/nova-micro' | 'amazon/nova-pro' | 'anthropic/claude-3-haiku' | 'anthropic/claude-3-opus' | 'anthropic/claude-3.5-haiku' | 'anthropic/claude-3.5-sonnet' | 'anthropic/claude-3.5-sonnet-20240620' | 'anthropic/claude-3.7-sonnet' | 'anthropic/claude-haiku-4.5' | 'anthropic/claude-opus-4' | 'anthropic/claude-opus-4.1' | 'anthropic/claude-opus-4.5' | 'anthropic/claude-sonnet-4' | 'anthropic/claude-sonnet-4.5' | 'arcee-ai/trinity-mini' | 'bytedance/seed-1.6' | 'bytedance/seed-1.8' | 'cohere/command-a' | 'deepseek/deepseek-r1' | 'deepseek/deepseek-v3' | 'deepseek/deepseek-v3.1' | 'deepseek/deepseek-v3.1-terminus' | 'deepseek/deepseek-v3.2' | 'deepseek/deepseek-v3.2-exp' | 'deepseek/deepseek-v3.2-thinking' | 'google/gemini-2.0-flash' | 'google/gemini-2.0-flash-lite' | 'google/gemini-2.5-flash' | 'google/gemini-2.5-flash-image' | 'google/gemini-2.5-flash-image-preview' | 'google/gemini-2.5-flash-lite' | 'google/gemini-2.5-flash-lite-preview-09-2025' | 'google/gemini-2.5-flash-preview-09-2025' | 'google/gemini-2.5-pro' | 'google/gemini-3-flash' | 'google/gemini-3-pro-image' | 'google/gemini-3-pro-preview' | 'inception/mercury-coder-small' | 'kwaipilot/kat-coder-pro-v1' | 'meituan/longcat-flash-chat' | 'meituan/longcat-flash-thinking' | 'meta/llama-3.1-70b' | 'meta/llama-3.1-8b' | 'meta/llama-3.2-11b' | 'meta/llama-3.2-1b' | 'meta/llama-3.2-3b' | 'meta/llama-3.2-90b' | 'meta/llama-3.3-70b' | 'meta/llama-4-maverick' | 'meta/llama-4-scout' | 'minimax/minimax-m2' | 'minimax/minimax-m2.1' | 'minimax/minimax-m2.1-lightning' | 'mistral/codestral' | 'mistral/devstral-2' | 'mistral/devstral-small' | 'mistral/devstral-small-2' | 'mistral/magistral-medium' | 'mistral/magistral-small' | 'mistral/ministral-14b' | 'mistral/ministral-3b' | 'mistral/ministral-8b' | 'mistral/mistral-large-3' | 'mistral/mistral-medium' | 'mistral/mistral-nemo' | 'mistral/mistral-small' | 'mistral/mixtral-8x22b-instruct' | 'mistral/pixtral-12b' | 'mistral/pixtral-large' | 'moonshotai/kimi-k2' | 'moonshotai/kimi-k2-0905' | 'moonshotai/kimi-k2-thinking' | 'moonshotai/kimi-k2-thinking-turbo' | 'moonshotai/kimi-k2-turbo' | 'morph/morph-v3-fast' | 'morph/morph-v3-large' | 'nvidia/nemotron-3-nano-30b-a3b' | 'nvidia/nemotron-nano-12b-v2-vl' | 'nvidia/nemotron-nano-9b-v2' | 'openai/codex-mini' | 'openai/gpt-3.5-turbo' | 'openai/gpt-3.5-turbo-instruct' | 'openai/gpt-4-turbo' | 'openai/gpt-4.1' | 'openai/gpt-4.1-mini' | 'openai/gpt-4.1-nano' | 'openai/gpt-4o' | 'openai/gpt-4o-mini' | 'openai/gpt-5' | 'openai/gpt-5-chat' | 'openai/gpt-5-codex' | 'openai/gpt-5-mini' | '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-instant' | 'openai/gpt-5.1-thinking' | 'openai/gpt-5.2' | 'openai/gpt-5.2-chat' | 'openai/gpt-5.2-codex' | 'openai/gpt-5.2-pro' | 'openai/gpt-oss-120b' | 'openai/gpt-oss-20b' | 'openai/gpt-oss-safeguard-20b' | 'openai/o1' | 'openai/o3' | 'openai/o3-deep-research' | 'openai/o3-mini' | 'openai/o3-pro' | 'openai/o4-mini' | 'perplexity/sonar' | 'perplexity/sonar-pro' | 'perplexity/sonar-reasoning' | 'perplexity/sonar-reasoning-pro' | 'prime-intellect/intellect-3' | 'stealth/sonoma-dusk-alpha' | 'stealth/sonoma-sky-alpha' | 'vercel/v0-1.0-md' | 'vercel/v0-1.5-md' | 'xai/grok-2-vision' | 'xai/grok-3' | 'xai/grok-3-fast' | 'xai/grok-3-mini' | 'xai/grok-3-mini-fast' | 'xai/grok-4' | 'xai/grok-4-fast-non-reasoning' | 'xai/grok-4-fast-reasoning' | 'xai/grok-4.1-fast-non-reasoning' | 'xai/grok-4.1-fast-reasoning' | 'xai/grok-code-fast-1' | 'xiaomi/mimo-v2-flash' | 'zai/glm-4.5' | 'zai/glm-4.5-air' | 'zai/glm-4.5v' | 'zai/glm-4.6' | 'zai/glm-4.6v' | 'zai/glm-4.6v-flash' | 'zai/glm-4.7' | 'zai/glm-4.7-flashx' | (string & {});
|
|
6
6
|
|
|
7
7
|
interface GatewayLanguageModelEntry {
|
|
8
8
|
/**
|
|
@@ -50,7 +50,7 @@ interface GatewayLanguageModelEntry {
|
|
|
50
50
|
*/
|
|
51
51
|
modelType?: 'language' | 'embedding' | 'image' | null;
|
|
52
52
|
}
|
|
53
|
-
type GatewayLanguageModelSpecification = Pick<
|
|
53
|
+
type GatewayLanguageModelSpecification = Pick<LanguageModelV3, 'specificationVersion' | 'provider' | 'modelId'>;
|
|
54
54
|
|
|
55
55
|
interface GatewayFetchMetadataResponse {
|
|
56
56
|
models: GatewayLanguageModelEntry[];
|
|
@@ -62,14 +62,158 @@ interface GatewayCreditsResponse {
|
|
|
62
62
|
totalUsed: string;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
type GatewayEmbeddingModelId = 'amazon/titan-embed-text-v2' | 'cohere/embed-v4.0' | 'google/gemini-embedding-001' | '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' | 'voyage/voyage-3-large' | 'voyage/voyage-3.5' | 'voyage/voyage-3.5-lite' | 'voyage/voyage-code-
|
|
65
|
+
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/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' | 'voyage/voyage-3-large' | 'voyage/voyage-3.5' | 'voyage/voyage-3.5-lite' | 'voyage/voyage-code-2' | 'voyage/voyage-code-3' | 'voyage/voyage-finance-2' | 'voyage/voyage-law-2' | (string & {});
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
type GatewayImageModelId = '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' | 'google/imagen-4.0-fast-generate-001' | 'google/imagen-4.0-generate-001' | 'google/imagen-4.0-ultra-generate-001' | 'recraft/recraft-v2' | 'recraft/recraft-v3' | (string & {});
|
|
68
|
+
|
|
69
|
+
interface PerplexitySearchConfig {
|
|
70
|
+
/**
|
|
71
|
+
* Default maximum number of search results to return (1-20, default: 10).
|
|
72
|
+
*/
|
|
73
|
+
maxResults?: number;
|
|
74
|
+
/**
|
|
75
|
+
* Default maximum tokens to extract per search result page (256-2048, default: 2048).
|
|
76
|
+
*/
|
|
77
|
+
maxTokensPerPage?: number;
|
|
78
|
+
/**
|
|
79
|
+
* Default maximum total tokens across all search results (default: 25000, max: 1000000).
|
|
80
|
+
*/
|
|
81
|
+
maxTokens?: number;
|
|
82
|
+
/**
|
|
83
|
+
* Default two-letter ISO 3166-1 alpha-2 country code for regional search results.
|
|
84
|
+
* Examples: 'US', 'GB', 'FR'
|
|
85
|
+
*/
|
|
86
|
+
country?: string;
|
|
87
|
+
/**
|
|
88
|
+
* Default list of domains to include or exclude from search results (max 20).
|
|
89
|
+
* To include: ['nature.com', 'science.org']
|
|
90
|
+
* To exclude: ['-example.com', '-spam.net']
|
|
91
|
+
*/
|
|
92
|
+
searchDomainFilter?: string[];
|
|
93
|
+
/**
|
|
94
|
+
* Default list of ISO 639-1 language codes to filter results (max 10, lowercase).
|
|
95
|
+
* Examples: ['en', 'fr', 'de']
|
|
96
|
+
*/
|
|
97
|
+
searchLanguageFilter?: string[];
|
|
98
|
+
/**
|
|
99
|
+
* Default recency filter for results.
|
|
100
|
+
* Cannot be combined with searchAfterDate/searchBeforeDate at runtime.
|
|
101
|
+
*/
|
|
102
|
+
searchRecencyFilter?: 'day' | 'week' | 'month' | 'year';
|
|
103
|
+
}
|
|
104
|
+
interface PerplexitySearchResult {
|
|
105
|
+
/** Title of the search result */
|
|
106
|
+
title: string;
|
|
107
|
+
/** URL of the search result */
|
|
108
|
+
url: string;
|
|
109
|
+
/** Text snippet/preview of the content */
|
|
110
|
+
snippet: string;
|
|
111
|
+
/** Publication date of the content */
|
|
112
|
+
date?: string;
|
|
113
|
+
/** Last updated date of the content */
|
|
114
|
+
lastUpdated?: string;
|
|
115
|
+
}
|
|
116
|
+
interface PerplexitySearchResponse {
|
|
117
|
+
/** Array of search results */
|
|
118
|
+
results: PerplexitySearchResult[];
|
|
119
|
+
/** Unique identifier for this search request */
|
|
120
|
+
id: string;
|
|
121
|
+
}
|
|
122
|
+
interface PerplexitySearchError {
|
|
123
|
+
/** Error type */
|
|
124
|
+
error: 'api_error' | 'rate_limit' | 'timeout' | 'invalid_input' | 'unknown';
|
|
125
|
+
/** HTTP status code if applicable */
|
|
126
|
+
statusCode?: number;
|
|
127
|
+
/** Human-readable error message */
|
|
128
|
+
message: string;
|
|
129
|
+
}
|
|
130
|
+
interface PerplexitySearchInput {
|
|
131
|
+
/**
|
|
132
|
+
* Search query (string) or multiple queries (array of up to 5 strings).
|
|
133
|
+
* Multi-query searches return combined results from all queries.
|
|
134
|
+
*/
|
|
135
|
+
query: string | string[];
|
|
136
|
+
/**
|
|
137
|
+
* Maximum number of search results to return (1-20, default: 10).
|
|
138
|
+
*/
|
|
139
|
+
max_results?: number;
|
|
140
|
+
/**
|
|
141
|
+
* Maximum number of tokens to extract per search result page (256-2048, default: 2048).
|
|
142
|
+
*/
|
|
143
|
+
max_tokens_per_page?: number;
|
|
144
|
+
/**
|
|
145
|
+
* Maximum total tokens across all search results (default: 25000, max: 1000000).
|
|
146
|
+
*/
|
|
147
|
+
max_tokens?: number;
|
|
148
|
+
/**
|
|
149
|
+
* Two-letter ISO 3166-1 alpha-2 country code for regional search results.
|
|
150
|
+
* Examples: 'US', 'GB', 'FR'
|
|
151
|
+
*/
|
|
152
|
+
country?: string;
|
|
153
|
+
/**
|
|
154
|
+
* List of domains to include or exclude from search results (max 20).
|
|
155
|
+
* To include: ['nature.com', 'science.org']
|
|
156
|
+
* To exclude: ['-example.com', '-spam.net']
|
|
157
|
+
*/
|
|
158
|
+
search_domain_filter?: string[];
|
|
159
|
+
/**
|
|
160
|
+
* List of ISO 639-1 language codes to filter results (max 10, lowercase).
|
|
161
|
+
* Examples: ['en', 'fr', 'de']
|
|
162
|
+
*/
|
|
163
|
+
search_language_filter?: string[];
|
|
164
|
+
/**
|
|
165
|
+
* Include only results published after this date.
|
|
166
|
+
* Format: 'MM/DD/YYYY' (e.g., '3/1/2025')
|
|
167
|
+
* Cannot be used with search_recency_filter.
|
|
168
|
+
*/
|
|
169
|
+
search_after_date?: string;
|
|
170
|
+
/**
|
|
171
|
+
* Include only results published before this date.
|
|
172
|
+
* Format: 'MM/DD/YYYY' (e.g., '3/15/2025')
|
|
173
|
+
* Cannot be used with search_recency_filter.
|
|
174
|
+
*/
|
|
175
|
+
search_before_date?: string;
|
|
176
|
+
/**
|
|
177
|
+
* Include only results last updated after this date.
|
|
178
|
+
* Format: 'MM/DD/YYYY' (e.g., '3/1/2025')
|
|
179
|
+
* Cannot be used with search_recency_filter.
|
|
180
|
+
*/
|
|
181
|
+
last_updated_after_filter?: string;
|
|
182
|
+
/**
|
|
183
|
+
* Include only results last updated before this date.
|
|
184
|
+
* Format: 'MM/DD/YYYY' (e.g., '3/15/2025')
|
|
185
|
+
* Cannot be used with search_recency_filter.
|
|
186
|
+
*/
|
|
187
|
+
last_updated_before_filter?: string;
|
|
188
|
+
/**
|
|
189
|
+
* Filter results by relative time period.
|
|
190
|
+
* Cannot be used with search_after_date or search_before_date.
|
|
191
|
+
*/
|
|
192
|
+
search_recency_filter?: 'day' | 'week' | 'month' | 'year';
|
|
193
|
+
}
|
|
194
|
+
type PerplexitySearchOutput = PerplexitySearchResponse | PerplexitySearchError;
|
|
195
|
+
declare const perplexitySearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<PerplexitySearchInput, PerplexitySearchOutput, PerplexitySearchConfig>;
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Gateway-specific provider-defined tools.
|
|
199
|
+
*/
|
|
200
|
+
declare const gatewayTools: {
|
|
201
|
+
/**
|
|
202
|
+
* Search the web using Perplexity's Search API for real-time information,
|
|
203
|
+
* news, research papers, and articles.
|
|
204
|
+
*
|
|
205
|
+
* Provides ranked search results with advanced filtering options including
|
|
206
|
+
* domain, language, date range, and recency filters.
|
|
207
|
+
*/
|
|
208
|
+
perplexitySearch: (config?: PerplexitySearchConfig) => ReturnType<typeof perplexitySearchToolFactory>;
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
interface GatewayProvider extends ProviderV3 {
|
|
212
|
+
(modelId: GatewayModelId): LanguageModelV3;
|
|
69
213
|
/**
|
|
70
214
|
Creates a model for text generation.
|
|
71
215
|
*/
|
|
72
|
-
languageModel(modelId: GatewayModelId):
|
|
216
|
+
languageModel(modelId: GatewayModelId): LanguageModelV3;
|
|
73
217
|
/**
|
|
74
218
|
Returns available providers and models for use with the remote provider.
|
|
75
219
|
*/
|
|
@@ -81,7 +225,19 @@ interface GatewayProvider extends ProviderV2 {
|
|
|
81
225
|
/**
|
|
82
226
|
Creates a model for generating text embeddings.
|
|
83
227
|
*/
|
|
84
|
-
|
|
228
|
+
embeddingModel(modelId: GatewayEmbeddingModelId): EmbeddingModelV3;
|
|
229
|
+
/**
|
|
230
|
+
* @deprecated Use `embeddingModel` instead.
|
|
231
|
+
*/
|
|
232
|
+
textEmbeddingModel(modelId: GatewayEmbeddingModelId): EmbeddingModelV3;
|
|
233
|
+
/**
|
|
234
|
+
Creates a model for generating images.
|
|
235
|
+
*/
|
|
236
|
+
imageModel(modelId: GatewayImageModelId): ImageModelV3;
|
|
237
|
+
/**
|
|
238
|
+
Gateway-specific tools executed server-side.
|
|
239
|
+
*/
|
|
240
|
+
tools: typeof gatewayTools;
|
|
85
241
|
}
|
|
86
242
|
interface GatewayProviderSettings {
|
|
87
243
|
/**
|
|
@@ -112,11 +268,16 @@ Create a remote provider instance.
|
|
|
112
268
|
declare function createGatewayProvider(options?: GatewayProviderSettings): GatewayProvider;
|
|
113
269
|
declare const gateway: GatewayProvider;
|
|
114
270
|
|
|
115
|
-
declare const gatewayProviderOptions:
|
|
116
|
-
only
|
|
117
|
-
order
|
|
118
|
-
|
|
119
|
-
|
|
271
|
+
declare const gatewayProviderOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
272
|
+
only?: string[] | undefined;
|
|
273
|
+
order?: string[] | undefined;
|
|
274
|
+
user?: string | undefined;
|
|
275
|
+
tags?: string[] | undefined;
|
|
276
|
+
models?: string[] | undefined;
|
|
277
|
+
byok?: Record<string, Record<string, unknown>[]> | undefined;
|
|
278
|
+
zeroDataRetention?: boolean | undefined;
|
|
279
|
+
}>;
|
|
280
|
+
type GatewayProviderOptions = InferSchema<typeof gatewayProviderOptions>;
|
|
120
281
|
|
|
121
282
|
declare const symbol$6: unique symbol;
|
|
122
283
|
declare abstract class GatewayError extends Error {
|
|
@@ -125,10 +286,12 @@ declare abstract class GatewayError extends Error {
|
|
|
125
286
|
abstract readonly type: string;
|
|
126
287
|
readonly statusCode: number;
|
|
127
288
|
readonly cause?: unknown;
|
|
128
|
-
|
|
289
|
+
readonly generationId?: string;
|
|
290
|
+
constructor({ message, statusCode, cause, generationId, }: {
|
|
129
291
|
message: string;
|
|
130
292
|
statusCode?: number;
|
|
131
293
|
cause?: unknown;
|
|
294
|
+
generationId?: string;
|
|
132
295
|
});
|
|
133
296
|
/**
|
|
134
297
|
* Checks if the given error is a Gateway Error.
|
|
@@ -139,15 +302,16 @@ declare abstract class GatewayError extends Error {
|
|
|
139
302
|
static hasMarker(error: unknown): error is GatewayError;
|
|
140
303
|
}
|
|
141
304
|
|
|
142
|
-
declare const gatewayErrorResponseSchema:
|
|
143
|
-
error:
|
|
144
|
-
message:
|
|
145
|
-
type
|
|
146
|
-
param
|
|
147
|
-
code
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
|
|
305
|
+
declare const gatewayErrorResponseSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
306
|
+
error: {
|
|
307
|
+
message: string;
|
|
308
|
+
type?: string | null | undefined;
|
|
309
|
+
param?: unknown;
|
|
310
|
+
code?: string | number | null | undefined;
|
|
311
|
+
};
|
|
312
|
+
generationId?: string | null | undefined;
|
|
313
|
+
}>;
|
|
314
|
+
type GatewayErrorResponse = InferSchema<typeof gatewayErrorResponseSchema>;
|
|
151
315
|
|
|
152
316
|
declare const symbol$5: unique symbol;
|
|
153
317
|
/**
|
|
@@ -157,21 +321,23 @@ declare class GatewayAuthenticationError extends GatewayError {
|
|
|
157
321
|
private readonly [symbol$5];
|
|
158
322
|
readonly name = "GatewayAuthenticationError";
|
|
159
323
|
readonly type = "authentication_error";
|
|
160
|
-
constructor({ message, statusCode, cause, }?: {
|
|
324
|
+
constructor({ message, statusCode, cause, generationId, }?: {
|
|
161
325
|
message?: string;
|
|
162
326
|
statusCode?: number;
|
|
163
327
|
cause?: unknown;
|
|
328
|
+
generationId?: string;
|
|
164
329
|
});
|
|
165
330
|
static isInstance(error: unknown): error is GatewayAuthenticationError;
|
|
166
331
|
/**
|
|
167
332
|
* Creates a contextual error message when authentication fails
|
|
168
333
|
*/
|
|
169
|
-
static createContextualError({ apiKeyProvided, oidcTokenProvided, message, statusCode, cause, }: {
|
|
334
|
+
static createContextualError({ apiKeyProvided, oidcTokenProvided, message, statusCode, cause, generationId, }: {
|
|
170
335
|
apiKeyProvided: boolean;
|
|
171
336
|
oidcTokenProvided: boolean;
|
|
172
337
|
message?: string;
|
|
173
338
|
statusCode?: number;
|
|
174
339
|
cause?: unknown;
|
|
340
|
+
generationId?: string;
|
|
175
341
|
}): GatewayAuthenticationError;
|
|
176
342
|
}
|
|
177
343
|
|
|
@@ -183,10 +349,11 @@ declare class GatewayInternalServerError extends GatewayError {
|
|
|
183
349
|
private readonly [symbol$4];
|
|
184
350
|
readonly name = "GatewayInternalServerError";
|
|
185
351
|
readonly type = "internal_server_error";
|
|
186
|
-
constructor({ message, statusCode, cause, }?: {
|
|
352
|
+
constructor({ message, statusCode, cause, generationId, }?: {
|
|
187
353
|
message?: string;
|
|
188
354
|
statusCode?: number;
|
|
189
355
|
cause?: unknown;
|
|
356
|
+
generationId?: string;
|
|
190
357
|
});
|
|
191
358
|
static isInstance(error: unknown): error is GatewayInternalServerError;
|
|
192
359
|
}
|
|
@@ -199,10 +366,11 @@ declare class GatewayInvalidRequestError extends GatewayError {
|
|
|
199
366
|
private readonly [symbol$3];
|
|
200
367
|
readonly name = "GatewayInvalidRequestError";
|
|
201
368
|
readonly type = "invalid_request_error";
|
|
202
|
-
constructor({ message, statusCode, cause, }?: {
|
|
369
|
+
constructor({ message, statusCode, cause, generationId, }?: {
|
|
203
370
|
message?: string;
|
|
204
371
|
statusCode?: number;
|
|
205
372
|
cause?: unknown;
|
|
373
|
+
generationId?: string;
|
|
206
374
|
});
|
|
207
375
|
static isInstance(error: unknown): error is GatewayInvalidRequestError;
|
|
208
376
|
}
|
|
@@ -216,11 +384,12 @@ declare class GatewayModelNotFoundError extends GatewayError {
|
|
|
216
384
|
readonly name = "GatewayModelNotFoundError";
|
|
217
385
|
readonly type = "model_not_found";
|
|
218
386
|
readonly modelId?: string;
|
|
219
|
-
constructor({ message, statusCode, modelId, cause, }?: {
|
|
387
|
+
constructor({ message, statusCode, modelId, cause, generationId, }?: {
|
|
220
388
|
message?: string;
|
|
221
389
|
statusCode?: number;
|
|
222
390
|
modelId?: string;
|
|
223
391
|
cause?: unknown;
|
|
392
|
+
generationId?: string;
|
|
224
393
|
});
|
|
225
394
|
static isInstance(error: unknown): error is GatewayModelNotFoundError;
|
|
226
395
|
}
|
|
@@ -233,10 +402,11 @@ declare class GatewayRateLimitError extends GatewayError {
|
|
|
233
402
|
private readonly [symbol$1];
|
|
234
403
|
readonly name = "GatewayRateLimitError";
|
|
235
404
|
readonly type = "rate_limit_exceeded";
|
|
236
|
-
constructor({ message, statusCode, cause, }?: {
|
|
405
|
+
constructor({ message, statusCode, cause, generationId, }?: {
|
|
237
406
|
message?: string;
|
|
238
407
|
statusCode?: number;
|
|
239
408
|
cause?: unknown;
|
|
409
|
+
generationId?: string;
|
|
240
410
|
});
|
|
241
411
|
static isInstance(error: unknown): error is GatewayRateLimitError;
|
|
242
412
|
}
|
|
@@ -250,13 +420,14 @@ declare class GatewayResponseError extends GatewayError {
|
|
|
250
420
|
readonly name = "GatewayResponseError";
|
|
251
421
|
readonly type = "response_error";
|
|
252
422
|
readonly response?: unknown;
|
|
253
|
-
readonly validationError?:
|
|
254
|
-
constructor({ message, statusCode, response, validationError, cause, }?: {
|
|
423
|
+
readonly validationError?: TypeValidationError;
|
|
424
|
+
constructor({ message, statusCode, response, validationError, cause, generationId, }?: {
|
|
255
425
|
message?: string;
|
|
256
426
|
statusCode?: number;
|
|
257
427
|
response?: unknown;
|
|
258
|
-
validationError?:
|
|
428
|
+
validationError?: TypeValidationError;
|
|
259
429
|
cause?: unknown;
|
|
430
|
+
generationId?: string;
|
|
260
431
|
});
|
|
261
432
|
static isInstance(error: unknown): error is GatewayResponseError;
|
|
262
433
|
}
|