@ai-sdk/gateway 4.0.83 → 4.0.85

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 CHANGED
@@ -1,5 +1,24 @@
1
1
  # @ai-sdk/gateway
2
2
 
3
+ ## 4.0.85
4
+
5
+ ### Patch Changes
6
+
7
+ - 6982e9d: Include evaluation models in getAvailableModels() instead of filtering them out as unknown model types.
8
+ - 6982e9d: feat(gateway): add experimental evaluation model support
9
+
10
+ ## 4.0.84
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [215b25e]
15
+ - Updated dependencies [d4d96bf]
16
+ - Updated dependencies [a7dd893]
17
+ - Updated dependencies [3456e2c]
18
+ - Updated dependencies [c4e76de]
19
+ - @ai-sdk/provider-utils@5.0.43
20
+ - @ai-sdk/provider@4.0.17
21
+
3
22
  ## 4.0.83
4
23
 
5
24
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -1,9 +1,11 @@
1
- import { LanguageModelV4, ProviderV4, Experimental_BatchV4, EmbeddingModelV4, ImageModelV4, Experimental_VideoModelV4, RerankingModelV4, SpeechModelV4, TranscriptionModelV4, Experimental_RealtimeFactoryV4, JSONValue, TypeValidationError } from '@ai-sdk/provider';
1
+ import { LanguageModelV4, ProviderV4, Experimental_BatchV4, EmbeddingModelV4, ImageModelV4, Experimental_VideoModelV4, RerankingModelV4, Experimental_EvaluationModelV4, SpeechModelV4, TranscriptionModelV4, Experimental_RealtimeFactoryV4, JSONValue, TypeValidationError } from '@ai-sdk/provider';
2
2
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
3
3
  import { FetchFunction, WebSocketConstructor, InferSchema } from '@ai-sdk/provider-utils';
4
4
 
5
5
  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 & {});
6
6
 
7
+ type GatewayEvaluationModelId = 'typesafe-ai/jev-latest' | (string & {});
8
+
7
9
  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-pro' | 'recraft/recraft-v4.1-utility' | 'recraft/recraft-v4.1-utility-pro' | 'spacexai/grok-imagine-image' | 'spacexai/grok-imagine-image-2.0' | (string & {});
8
10
 
9
11
  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' | '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-sonnet-4' | 'anthropic/claude-sonnet-4.5' | 'anthropic/claude-sonnet-4.6' | 'anthropic/claude-sonnet-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' | '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-fin-free' | 'inclusionai/ling-3.0-flash-sante' | 'inclusionai/ling-3.0-flash-sante-free' | 'inclusionai/ling-3.0-flash-vl' | 'inclusionai/ling-3.0-flash-vl-free' | 'inference-net/schematron-v2-small' | 'inference-net/schematron-v2-turbo' | 'interfaze/interfaze-beta' | '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' | '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-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' | 'perplexity/sonar-pro' | 'perplexity/sonar-reasoning-pro' | 'poolside/laguna-s-2.1' | 'poolside/laguna-s-2.1-free' | '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-build-0.1' | 'stepfun/step-3.5-flash' | 'stepfun/step-3.7-flash' | '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' | '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-5v-turbo' | (string & {});
@@ -85,7 +87,7 @@ type GatewayTranscriptionModelId = 'fish-audio/transcribe-1' | 'fish-audio/trans
85
87
 
86
88
  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 & {});
87
89
 
88
- declare const KNOWN_MODEL_TYPES: readonly ["embedding", "image", "language", "realtime", "reranking", "speech", "transcription", "video"];
90
+ declare const KNOWN_MODEL_TYPES: readonly ["embedding", "evaluation", "image", "language", "realtime", "reranking", "speech", "transcription", "video"];
89
91
  type KnownModelType = (typeof KNOWN_MODEL_TYPES)[number];
90
92
  interface GatewayLanguageModelEntry {
91
93
  /**
@@ -974,6 +976,14 @@ interface GatewayProvider extends ProviderV4 {
974
976
  * Creates a model for reranking documents.
975
977
  */
976
978
  rerankingModel(modelId: GatewayRerankingModelId): RerankingModelV4;
979
+ /**
980
+ * Creates a model for evaluating state against questions.
981
+ */
982
+ evaluation(modelId: GatewayEvaluationModelId): Experimental_EvaluationModelV4;
983
+ /**
984
+ * Creates a model for evaluating state against questions.
985
+ */
986
+ evaluationModel(modelId: GatewayEvaluationModelId): Experimental_EvaluationModelV4;
977
987
  /**
978
988
  * Creates a model for text-to-speech generation.
979
989
  */
@@ -1359,4 +1369,4 @@ declare class GatewayResponseError extends GatewayError {
1359
1369
 
1360
1370
  declare const VERSION: string;
1361
1371
 
1362
- export { GATEWAY_AUTH_SUBPROTOCOL_PREFIX, GATEWAY_REALTIME_SUBPROTOCOL, GATEWAY_TEAM_SUBPROTOCOL_PREFIX, GATEWAY_TRANSCRIPTION_SUBPROTOCOL, type GatewayAsyncJobMetadata, GatewayAuthenticationError, type GatewayCreditsResponse, type GatewayEmbeddingModelId, GatewayError, type GatewayErrorResponse, GatewayFailedDependencyError, GatewayForbiddenError, type GatewayGenerationInfo, type GatewayGenerationInfoParams, type GatewayImageModelId, GatewayInternalServerError, GatewayInvalidRequestError, type GatewayLanguageModelEntry, type GatewayProviderOptions as GatewayLanguageModelOptions, type GatewayLanguageModelSpecification, type GatewayLanguageModelEntry as GatewayModelEntry, type GatewayModelId, GatewayModelNotFoundError, GatewayNotFoundError, type GatewayProvider, type GatewayProviderMetadata, type GatewayProviderOptions, type GatewayProviderSettings, GatewayRateLimitError, type GatewayRealtimeModelId, type GatewayRerankingModelId, GatewayResponseError, type GatewaySpeechModelId, type GatewaySpendReportParams, type GatewaySpendReportResponse, type GatewaySpendReportRow, type GatewayTranscriptionModelId, type GatewayVideoModelId, VERSION, createGateway, createGateway as createGatewayProvider, gateway, getGatewayRealtimeAuthToken, getGatewayRealtimeProtocols, getGatewayRealtimeTeamIdOrSlug, getGatewayTranscriptionProtocols };
1372
+ export { GATEWAY_AUTH_SUBPROTOCOL_PREFIX, GATEWAY_REALTIME_SUBPROTOCOL, GATEWAY_TEAM_SUBPROTOCOL_PREFIX, GATEWAY_TRANSCRIPTION_SUBPROTOCOL, type GatewayAsyncJobMetadata, GatewayAuthenticationError, type GatewayCreditsResponse, type GatewayEmbeddingModelId, GatewayError, type GatewayErrorResponse, type GatewayEvaluationModelId, GatewayFailedDependencyError, GatewayForbiddenError, type GatewayGenerationInfo, type GatewayGenerationInfoParams, type GatewayImageModelId, GatewayInternalServerError, GatewayInvalidRequestError, type GatewayLanguageModelEntry, type GatewayProviderOptions as GatewayLanguageModelOptions, type GatewayLanguageModelSpecification, type GatewayLanguageModelEntry as GatewayModelEntry, type GatewayModelId, GatewayModelNotFoundError, GatewayNotFoundError, type GatewayProvider, type GatewayProviderMetadata, type GatewayProviderOptions, type GatewayProviderSettings, GatewayRateLimitError, type GatewayRealtimeModelId, type GatewayRerankingModelId, GatewayResponseError, type GatewaySpeechModelId, type GatewaySpendReportParams, type GatewaySpendReportResponse, type GatewaySpendReportRow, type GatewayTranscriptionModelId, type GatewayVideoModelId, VERSION, createGateway, createGateway as createGatewayProvider, gateway, getGatewayRealtimeAuthToken, getGatewayRealtimeProtocols, getGatewayRealtimeTeamIdOrSlug, getGatewayTranscriptionProtocols };
package/dist/index.js CHANGED
@@ -62,11 +62,11 @@ function decodeSubprotocolValue(value) {
62
62
 
63
63
  // src/gateway-provider.ts
64
64
  import {
65
- createJsonErrorResponseHandler as createJsonErrorResponseHandler12,
66
- createJsonResponseHandler as createJsonResponseHandler12,
67
- getErrorMessage as getErrorMessage12,
65
+ createJsonErrorResponseHandler as createJsonErrorResponseHandler13,
66
+ createJsonResponseHandler as createJsonResponseHandler13,
67
+ getErrorMessage as getErrorMessage13,
68
68
  loadOptionalSetting,
69
- postJsonToApi as postJsonToApi9,
69
+ postJsonToApi as postJsonToApi10,
70
70
  withoutTrailingSlash,
71
71
  withUserAgentSuffix
72
72
  } from "@ai-sdk/provider-utils";
@@ -689,6 +689,7 @@ import {
689
689
  // src/gateway-model-entry.ts
690
690
  var KNOWN_MODEL_TYPES = [
691
691
  "embedding",
692
+ "evaluation",
692
693
  "image",
693
694
  "language",
694
695
  "realtime",
@@ -2255,7 +2256,7 @@ var gatewayVideoStatusResponseSchema = z.discriminatedUnion("status", [
2255
2256
  })
2256
2257
  ]);
2257
2258
 
2258
- // src/gateway-reranking-model.ts
2259
+ // src/gateway-evaluation-model.ts
2259
2260
  import {
2260
2261
  combineHeaders as combineHeaders6,
2261
2262
  createJsonErrorResponseHandler as createJsonErrorResponseHandler9,
@@ -2266,6 +2267,151 @@ import {
2266
2267
  resolve as resolve9,
2267
2268
  zodSchema as zodSchema9
2268
2269
  } from "@ai-sdk/provider-utils";
2270
+ var GatewayEvaluationModel = class {
2271
+ constructor(modelId, config) {
2272
+ this.modelId = modelId;
2273
+ this.config = config;
2274
+ this.specificationVersion = "v4";
2275
+ this.supportedQuestionTypes = ["choice", "score", "boolean"];
2276
+ }
2277
+ get provider() {
2278
+ return this.config.provider;
2279
+ }
2280
+ async doEvaluate({
2281
+ state,
2282
+ questions,
2283
+ headers,
2284
+ abortSignal,
2285
+ providerOptions
2286
+ }) {
2287
+ var _a12;
2288
+ const resolvedHeaders = this.config.headers ? await resolve9(this.config.headers) : void 0;
2289
+ try {
2290
+ const {
2291
+ responseHeaders,
2292
+ value: responseBody,
2293
+ rawValue
2294
+ } = await postJsonToApi6({
2295
+ url: this.getUrl(),
2296
+ headers: combineHeaders6(
2297
+ resolvedHeaders,
2298
+ headers != null ? headers : {},
2299
+ this.getModelConfigHeaders(),
2300
+ await resolve9(this.config.o11yHeaders)
2301
+ ),
2302
+ body: {
2303
+ state,
2304
+ questions,
2305
+ ...providerOptions ? { providerOptions } : {}
2306
+ },
2307
+ successfulResponseHandler: createJsonResponseHandler9(
2308
+ gatewayEvaluationResponseSchema
2309
+ ),
2310
+ failedResponseHandler: createJsonErrorResponseHandler9({
2311
+ errorSchema: z.any(),
2312
+ errorToMessage: (data) => {
2313
+ var _a13;
2314
+ return (_a13 = getErrorMessage9(data)) != null ? _a13 : "unknown error";
2315
+ }
2316
+ }),
2317
+ ...abortSignal && { abortSignal },
2318
+ fetch: this.config.fetch
2319
+ });
2320
+ return {
2321
+ answers: responseBody.answers,
2322
+ ...responseBody.rounding ? { rounding: responseBody.rounding } : {},
2323
+ ...responseBody.usage ? { usage: responseBody.usage } : {},
2324
+ warnings: (_a12 = responseBody.warnings) != null ? _a12 : [],
2325
+ providerMetadata: responseBody.providerMetadata,
2326
+ response: {
2327
+ modelId: this.modelId,
2328
+ headers: responseHeaders,
2329
+ body: rawValue
2330
+ }
2331
+ };
2332
+ } catch (error) {
2333
+ throw await asGatewayError(
2334
+ error,
2335
+ await parseAuthMethod(resolvedHeaders != null ? resolvedHeaders : {})
2336
+ );
2337
+ }
2338
+ }
2339
+ getUrl() {
2340
+ return `${this.config.baseURL}/evaluation-model`;
2341
+ }
2342
+ getModelConfigHeaders() {
2343
+ return {
2344
+ "ai-evaluation-model-specification-version": "4",
2345
+ "ai-model-id": this.modelId
2346
+ };
2347
+ }
2348
+ };
2349
+ var gatewayEvaluationAnswerSchema = z.discriminatedUnion("type", [
2350
+ z.object({
2351
+ type: z.literal("choice"),
2352
+ choice: z.string(),
2353
+ probabilities: z.record(z.string(), z.number()).optional()
2354
+ }),
2355
+ z.object({
2356
+ type: z.literal("score"),
2357
+ score: z.number(),
2358
+ probabilities: z.record(z.string(), z.number()).optional()
2359
+ }),
2360
+ z.object({
2361
+ type: z.literal("boolean"),
2362
+ probability: z.number()
2363
+ })
2364
+ ]);
2365
+ var gatewayEvaluationWarningSchema = z.discriminatedUnion("type", [
2366
+ z.object({
2367
+ type: z.literal("unsupported"),
2368
+ feature: z.string(),
2369
+ details: z.string().optional()
2370
+ }),
2371
+ z.object({
2372
+ type: z.literal("compatibility"),
2373
+ feature: z.string(),
2374
+ details: z.string().optional()
2375
+ }),
2376
+ z.object({
2377
+ type: z.literal("deprecated"),
2378
+ setting: z.string(),
2379
+ message: z.string()
2380
+ }),
2381
+ z.object({
2382
+ type: z.literal("other"),
2383
+ message: z.string()
2384
+ })
2385
+ ]);
2386
+ var gatewayEvaluationResponseSchema = lazySchema9(
2387
+ () => zodSchema9(
2388
+ z.object({
2389
+ answers: z.record(z.string(), gatewayEvaluationAnswerSchema),
2390
+ rounding: z.object({
2391
+ probabilityDecimals: z.number().optional(),
2392
+ scoreDecimals: z.number().optional()
2393
+ }).optional(),
2394
+ usage: z.object({
2395
+ inputTokens: z.number().optional(),
2396
+ outputTokens: z.number().optional()
2397
+ }).optional(),
2398
+ warnings: z.array(gatewayEvaluationWarningSchema).optional(),
2399
+ providerMetadata: z.record(z.string(), z.record(z.string(), z.unknown())).optional()
2400
+ })
2401
+ )
2402
+ );
2403
+
2404
+ // src/gateway-reranking-model.ts
2405
+ import {
2406
+ combineHeaders as combineHeaders7,
2407
+ createJsonErrorResponseHandler as createJsonErrorResponseHandler10,
2408
+ createJsonResponseHandler as createJsonResponseHandler10,
2409
+ getErrorMessage as getErrorMessage10,
2410
+ lazySchema as lazySchema10,
2411
+ postJsonToApi as postJsonToApi7,
2412
+ resolve as resolve10,
2413
+ zodSchema as zodSchema10
2414
+ } from "@ai-sdk/provider-utils";
2269
2415
  var GatewayRerankingModel = class {
2270
2416
  constructor(modelId, config) {
2271
2417
  this.modelId = modelId;
@@ -2284,19 +2430,19 @@ var GatewayRerankingModel = class {
2284
2430
  providerOptions
2285
2431
  }) {
2286
2432
  var _a12;
2287
- const resolvedHeaders = this.config.headers ? await resolve9(this.config.headers) : void 0;
2433
+ const resolvedHeaders = this.config.headers ? await resolve10(this.config.headers) : void 0;
2288
2434
  try {
2289
2435
  const {
2290
2436
  responseHeaders,
2291
2437
  value: responseBody,
2292
2438
  rawValue
2293
- } = await postJsonToApi6({
2439
+ } = await postJsonToApi7({
2294
2440
  url: this.getUrl(),
2295
- headers: combineHeaders6(
2441
+ headers: combineHeaders7(
2296
2442
  resolvedHeaders,
2297
2443
  headers != null ? headers : {},
2298
2444
  this.getModelConfigHeaders(),
2299
- await resolve9(this.config.o11yHeaders)
2445
+ await resolve10(this.config.o11yHeaders)
2300
2446
  ),
2301
2447
  body: {
2302
2448
  documents,
@@ -2304,14 +2450,14 @@ var GatewayRerankingModel = class {
2304
2450
  ...topN != null ? { topN } : {},
2305
2451
  ...providerOptions ? { providerOptions } : {}
2306
2452
  },
2307
- successfulResponseHandler: createJsonResponseHandler9(
2453
+ successfulResponseHandler: createJsonResponseHandler10(
2308
2454
  gatewayRerankingResponseSchema
2309
2455
  ),
2310
- failedResponseHandler: createJsonErrorResponseHandler9({
2456
+ failedResponseHandler: createJsonErrorResponseHandler10({
2311
2457
  errorSchema: z.any(),
2312
2458
  errorToMessage: (data) => {
2313
2459
  var _a13;
2314
- return (_a13 = getErrorMessage9(data)) != null ? _a13 : "unknown error";
2460
+ return (_a13 = getErrorMessage10(data)) != null ? _a13 : "unknown error";
2315
2461
  }
2316
2462
  }),
2317
2463
  ...abortSignal && { abortSignal },
@@ -2361,8 +2507,8 @@ var gatewayRerankingWarningSchema = z.discriminatedUnion("type", [
2361
2507
  message: z.string()
2362
2508
  })
2363
2509
  ]);
2364
- var gatewayRerankingResponseSchema = lazySchema9(
2365
- () => zodSchema9(
2510
+ var gatewayRerankingResponseSchema = lazySchema10(
2511
+ () => zodSchema10(
2366
2512
  z.object({
2367
2513
  ranking: z.array(
2368
2514
  z.object({
@@ -2378,12 +2524,12 @@ var gatewayRerankingResponseSchema = lazySchema9(
2378
2524
 
2379
2525
  // src/gateway-speech-model.ts
2380
2526
  import {
2381
- combineHeaders as combineHeaders7,
2382
- createJsonErrorResponseHandler as createJsonErrorResponseHandler10,
2383
- createJsonResponseHandler as createJsonResponseHandler10,
2384
- getErrorMessage as getErrorMessage10,
2385
- postJsonToApi as postJsonToApi7,
2386
- resolve as resolve10
2527
+ combineHeaders as combineHeaders8,
2528
+ createJsonErrorResponseHandler as createJsonErrorResponseHandler11,
2529
+ createJsonResponseHandler as createJsonResponseHandler11,
2530
+ getErrorMessage as getErrorMessage11,
2531
+ postJsonToApi as postJsonToApi8,
2532
+ resolve as resolve11
2387
2533
  } from "@ai-sdk/provider-utils";
2388
2534
  var GatewaySpeechModel = class {
2389
2535
  constructor(modelId, config) {
@@ -2406,19 +2552,19 @@ var GatewaySpeechModel = class {
2406
2552
  abortSignal
2407
2553
  }) {
2408
2554
  var _a12;
2409
- const resolvedHeaders = this.config.headers ? await resolve10(this.config.headers) : void 0;
2555
+ const resolvedHeaders = this.config.headers ? await resolve11(this.config.headers) : void 0;
2410
2556
  try {
2411
2557
  const {
2412
2558
  responseHeaders,
2413
2559
  value: responseBody,
2414
2560
  rawValue
2415
- } = await postJsonToApi7({
2561
+ } = await postJsonToApi8({
2416
2562
  url: this.getUrl(),
2417
- headers: combineHeaders7(
2563
+ headers: combineHeaders8(
2418
2564
  resolvedHeaders,
2419
2565
  headers != null ? headers : {},
2420
2566
  this.getModelConfigHeaders(),
2421
- await resolve10(this.config.o11yHeaders)
2567
+ await resolve11(this.config.o11yHeaders)
2422
2568
  ),
2423
2569
  body: {
2424
2570
  text,
@@ -2429,14 +2575,14 @@ var GatewaySpeechModel = class {
2429
2575
  ...language && { language },
2430
2576
  ...providerOptions && { providerOptions }
2431
2577
  },
2432
- successfulResponseHandler: createJsonResponseHandler10(
2578
+ successfulResponseHandler: createJsonResponseHandler11(
2433
2579
  gatewaySpeechResponseSchema
2434
2580
  ),
2435
- failedResponseHandler: createJsonErrorResponseHandler10({
2581
+ failedResponseHandler: createJsonErrorResponseHandler11({
2436
2582
  errorSchema: z.any(),
2437
2583
  errorToMessage: (data) => {
2438
2584
  var _a13;
2439
- return (_a13 = getErrorMessage10(data)) != null ? _a13 : "unknown error";
2585
+ return (_a13 = getErrorMessage11(data)) != null ? _a13 : "unknown error";
2440
2586
  }
2441
2587
  }),
2442
2588
  ...abortSignal && { abortSignal },
@@ -2500,19 +2646,19 @@ var gatewaySpeechResponseSchema = z.object({
2500
2646
 
2501
2647
  // src/gateway-transcription-model.ts
2502
2648
  import {
2503
- getErrorMessage as getErrorMessage11
2649
+ getErrorMessage as getErrorMessage12
2504
2650
  } from "@ai-sdk/provider";
2505
2651
  import {
2506
- combineHeaders as combineHeaders8,
2652
+ combineHeaders as combineHeaders9,
2507
2653
  convertBase64ToUint8Array,
2508
2654
  convertUint8ArrayToBase64 as convertUint8ArrayToBase643,
2509
- createJsonErrorResponseHandler as createJsonErrorResponseHandler11,
2510
- createJsonResponseHandler as createJsonResponseHandler11,
2655
+ createJsonErrorResponseHandler as createJsonErrorResponseHandler12,
2656
+ createJsonResponseHandler as createJsonResponseHandler12,
2511
2657
  connectToWebSocket,
2512
2658
  normalizeHeaders,
2513
2659
  experimental_parseTranscriptionStreamPart as parseTranscriptionStreamPart,
2514
- postJsonToApi as postJsonToApi8,
2515
- resolve as resolve11,
2660
+ postJsonToApi as postJsonToApi9,
2661
+ resolve as resolve12,
2516
2662
  EXPERIMENTAL_TRANSCRIPTION_STREAM_AUDIO_DONE_FRAME_TYPE as TRANSCRIPTION_STREAM_AUDIO_DONE_FRAME_TYPE,
2517
2663
  waitForWebSocketBufferDrain,
2518
2664
  EXPERIMENTAL_TRANSCRIPTION_STREAM_START_FRAME_TYPE as TRANSCRIPTION_STREAM_START_FRAME_TYPE
@@ -2534,33 +2680,33 @@ var GatewayTranscriptionModel = class {
2534
2680
  abortSignal
2535
2681
  }) {
2536
2682
  var _a12, _b12, _c, _d;
2537
- const resolvedHeaders = this.config.headers ? await resolve11(this.config.headers) : void 0;
2683
+ const resolvedHeaders = this.config.headers ? await resolve12(this.config.headers) : void 0;
2538
2684
  try {
2539
2685
  const {
2540
2686
  responseHeaders,
2541
2687
  value: responseBody,
2542
2688
  rawValue
2543
- } = await postJsonToApi8({
2689
+ } = await postJsonToApi9({
2544
2690
  url: this.getUrl(),
2545
- headers: combineHeaders8(
2691
+ headers: combineHeaders9(
2546
2692
  resolvedHeaders,
2547
2693
  headers != null ? headers : {},
2548
2694
  this.getModelConfigHeaders(),
2549
- await resolve11(this.config.o11yHeaders)
2695
+ await resolve12(this.config.o11yHeaders)
2550
2696
  ),
2551
2697
  body: {
2552
2698
  audio: audio instanceof Uint8Array ? convertUint8ArrayToBase643(audio) : audio,
2553
2699
  mediaType,
2554
2700
  ...providerOptions && { providerOptions }
2555
2701
  },
2556
- successfulResponseHandler: createJsonResponseHandler11(
2702
+ successfulResponseHandler: createJsonResponseHandler12(
2557
2703
  gatewayTranscriptionResponseSchema
2558
2704
  ),
2559
- failedResponseHandler: createJsonErrorResponseHandler11({
2705
+ failedResponseHandler: createJsonErrorResponseHandler12({
2560
2706
  errorSchema: z.any(),
2561
2707
  errorToMessage: (data) => {
2562
2708
  var _a13;
2563
- return (_a13 = getErrorMessage11(data)) != null ? _a13 : "unknown error";
2709
+ return (_a13 = getErrorMessage12(data)) != null ? _a13 : "unknown error";
2564
2710
  }
2565
2711
  }),
2566
2712
  ...abortSignal && { abortSignal },
@@ -2590,11 +2736,11 @@ var GatewayTranscriptionModel = class {
2590
2736
  async doStream(options) {
2591
2737
  var _a12, _b12, _c, _d, _e;
2592
2738
  const currentDate = (_c = (_b12 = (_a12 = this.config._internal) == null ? void 0 : _a12.currentDate) == null ? void 0 : _b12.call(_a12)) != null ? _c : /* @__PURE__ */ new Date();
2593
- const headers = combineHeaders8(
2594
- await resolve11((_d = this.config.headers) != null ? _d : {}),
2739
+ const headers = combineHeaders9(
2740
+ await resolve12((_d = this.config.headers) != null ? _d : {}),
2595
2741
  (_e = options.headers) != null ? _e : {},
2596
2742
  this.getModelConfigHeaders(),
2597
- await resolve11(this.config.o11yHeaders)
2743
+ await resolve12(this.config.o11yHeaders)
2598
2744
  );
2599
2745
  const authMethod = await parseAuthMethod(headers);
2600
2746
  const startFrame = {
@@ -2832,7 +2978,7 @@ function getServerErrorMessage(error) {
2832
2978
  if (error != null && typeof error === "object" && "message" in error && typeof error.message === "string") {
2833
2979
  return error.message;
2834
2980
  }
2835
- return getErrorMessage11(error);
2981
+ return getErrorMessage12(error);
2836
2982
  }
2837
2983
  var SERVER_ERROR_STATUS_CODES = {
2838
2984
  authentication_error: 401,
@@ -2914,11 +3060,11 @@ function toGatewayRealtimeUrl(baseURL, modelId) {
2914
3060
  // src/tool/exa-search.ts
2915
3061
  import {
2916
3062
  createProviderExecutedToolFactory,
2917
- lazySchema as lazySchema10,
2918
- zodSchema as zodSchema10
3063
+ lazySchema as lazySchema11,
3064
+ zodSchema as zodSchema11
2919
3065
  } from "@ai-sdk/provider-utils";
2920
- var exaSearchInputSchema = lazySchema10(
2921
- () => zodSchema10(
3066
+ var exaSearchInputSchema = lazySchema11(
3067
+ () => zodSchema11(
2922
3068
  z.object({
2923
3069
  query: z.string().describe("Natural-language web search query. This is required."),
2924
3070
  type: z.enum(["auto", "fast", "instant"]).optional().describe(
@@ -2988,8 +3134,8 @@ var exaSearchInputSchema = lazySchema10(
2988
3134
  })
2989
3135
  )
2990
3136
  );
2991
- var exaSearchOutputSchema = lazySchema10(
2992
- () => zodSchema10(
3137
+ var exaSearchOutputSchema = lazySchema11(
3138
+ () => zodSchema11(
2993
3139
  z.union([
2994
3140
  z.object({
2995
3141
  requestId: z.string(),
@@ -3046,11 +3192,11 @@ var exaSearch = (config = {}) => exaSearchToolFactory(config);
3046
3192
  // src/tool/parallel-search.ts
3047
3193
  import {
3048
3194
  createProviderExecutedToolFactory as createProviderExecutedToolFactory2,
3049
- lazySchema as lazySchema11,
3050
- zodSchema as zodSchema11
3195
+ lazySchema as lazySchema12,
3196
+ zodSchema as zodSchema12
3051
3197
  } from "@ai-sdk/provider-utils";
3052
- var parallelSearchInputSchema = lazySchema11(
3053
- () => zodSchema11(
3198
+ var parallelSearchInputSchema = lazySchema12(
3199
+ () => zodSchema12(
3054
3200
  z.object({
3055
3201
  objective: z.string().describe(
3056
3202
  "Natural-language description of the web research goal, including source or freshness guidance and broader context from the task. Maximum 5000 characters."
@@ -3089,8 +3235,8 @@ var parallelSearchInputSchema = lazySchema11(
3089
3235
  })
3090
3236
  )
3091
3237
  );
3092
- var parallelSearchOutputSchema = lazySchema11(
3093
- () => zodSchema11(
3238
+ var parallelSearchOutputSchema = lazySchema12(
3239
+ () => zodSchema12(
3094
3240
  z.union([
3095
3241
  // Success response
3096
3242
  z.object({
@@ -3131,11 +3277,11 @@ var parallelSearch = (config = {}) => parallelSearchToolFactory(config);
3131
3277
  // src/tool/perplexity-search.ts
3132
3278
  import {
3133
3279
  createProviderExecutedToolFactory as createProviderExecutedToolFactory3,
3134
- lazySchema as lazySchema12,
3135
- zodSchema as zodSchema12
3280
+ lazySchema as lazySchema13,
3281
+ zodSchema as zodSchema13
3136
3282
  } from "@ai-sdk/provider-utils";
3137
- var perplexitySearchInputSchema = lazySchema12(
3138
- () => zodSchema12(
3283
+ var perplexitySearchInputSchema = lazySchema13(
3284
+ () => zodSchema13(
3139
3285
  z.object({
3140
3286
  query: z.union([z.string(), z.array(z.string())]).describe(
3141
3287
  "Search query (string) or multiple queries (array of up to 5 strings). Multi-query searches return combined results from all queries."
@@ -3176,8 +3322,8 @@ var perplexitySearchInputSchema = lazySchema12(
3176
3322
  })
3177
3323
  )
3178
3324
  );
3179
- var perplexitySearchOutputSchema = lazySchema12(
3180
- () => zodSchema12(
3325
+ var perplexitySearchOutputSchema = lazySchema13(
3326
+ () => zodSchema13(
3181
3327
  z.union([
3182
3328
  // Success response
3183
3329
  z.object({
@@ -3217,8 +3363,8 @@ var perplexitySearch = (config = {}) => perplexitySearchToolFactory(config);
3217
3363
  // src/tool/tako-search.ts
3218
3364
  import {
3219
3365
  createProviderExecutedToolFactory as createProviderExecutedToolFactory4,
3220
- lazySchema as lazySchema13,
3221
- zodSchema as zodSchema13
3366
+ lazySchema as lazySchema14,
3367
+ zodSchema as zodSchema14
3222
3368
  } from "@ai-sdk/provider-utils";
3223
3369
  var takoDataSourceInputSchema = z.object({
3224
3370
  count: z.number().optional().describe(
@@ -3257,8 +3403,8 @@ var takoWebSourceInputSchema = z.object({
3257
3403
  "Keep results published on or before this ISO date (YYYY-MM-DD)."
3258
3404
  )
3259
3405
  });
3260
- var takoSearchInputSchema = lazySchema13(
3261
- () => zodSchema13(
3406
+ var takoSearchInputSchema = lazySchema14(
3407
+ () => zodSchema14(
3262
3408
  z.object({
3263
3409
  query: z.string().describe(
3264
3410
  'Natural-language search query. Include the entity, metric, and time period. Quote a phrase to force it to one entity, for example "Tesla":PRODUCT price.'
@@ -3388,8 +3534,8 @@ var takoWebResultSchema = z.object({
3388
3534
  publish_date: z.string().nullish(),
3389
3535
  content: takoResultContentSchema.nullish()
3390
3536
  }).passthrough();
3391
- var takoSearchOutputSchema = lazySchema13(
3392
- () => zodSchema13(
3537
+ var takoSearchOutputSchema = lazySchema14(
3538
+ () => zodSchema14(
3393
3539
  z.union([
3394
3540
  z.object({
3395
3541
  request_id: z.string(),
@@ -3472,7 +3618,7 @@ async function getVercelRequestId() {
3472
3618
  }
3473
3619
 
3474
3620
  // src/version.ts
3475
- var VERSION = true ? "4.0.83" : "0.0.0-test";
3621
+ var VERSION = true ? "4.0.85" : "0.0.0-test";
3476
3622
 
3477
3623
  // src/gateway-provider.ts
3478
3624
  var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
@@ -3527,7 +3673,7 @@ function createGateway(options = {}) {
3527
3673
  const headers = createAuthHeaders(auth);
3528
3674
  const url = new URL("/v1/realtime/client-secrets", baseURL).toString();
3529
3675
  try {
3530
- const { value } = await postJsonToApi9({
3676
+ const { value } = await postJsonToApi10({
3531
3677
  url,
3532
3678
  headers,
3533
3679
  body: {
@@ -3537,14 +3683,14 @@ function createGateway(options = {}) {
3537
3683
  expiresIn: params.expiresAfterSeconds
3538
3684
  }
3539
3685
  },
3540
- successfulResponseHandler: createJsonResponseHandler12(
3686
+ successfulResponseHandler: createJsonResponseHandler13(
3541
3687
  gatewayClientSecretResponseSchema
3542
3688
  ),
3543
- failedResponseHandler: createJsonErrorResponseHandler12({
3689
+ failedResponseHandler: createJsonErrorResponseHandler13({
3544
3690
  errorSchema: z.any(),
3545
3691
  errorToMessage: (data) => {
3546
3692
  var _a13;
3547
- return (_a13 = getErrorMessage12(data)) != null ? _a13 : "unknown error";
3693
+ return (_a13 = getErrorMessage13(data)) != null ? _a13 : "unknown error";
3548
3694
  }
3549
3695
  }),
3550
3696
  fetch: options.fetch
@@ -3713,6 +3859,17 @@ function createGateway(options = {}) {
3713
3859
  };
3714
3860
  provider.rerankingModel = createRerankingModel;
3715
3861
  provider.reranking = createRerankingModel;
3862
+ const createEvaluationModel = (modelId) => {
3863
+ return new GatewayEvaluationModel(modelId, {
3864
+ provider: "gateway",
3865
+ baseURL,
3866
+ headers: getHeaders,
3867
+ fetch: options.fetch,
3868
+ o11yHeaders: createO11yHeaders()
3869
+ });
3870
+ };
3871
+ provider.evaluationModel = createEvaluationModel;
3872
+ provider.evaluation = createEvaluationModel;
3716
3873
  const createSpeechModel = (modelId) => {
3717
3874
  return new GatewaySpeechModel(modelId, {
3718
3875
  provider: "gateway",