ai 7.0.104 → 7.0.105

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.
@@ -11,8 +11,8 @@ is one state, not a batch of unrelated inputs.
11
11
 
12
12
  This API and the evaluation model specification are experimental and may change
13
13
  in patch releases. Pass an evaluation model instance, resolve a model through a
14
- provider registry, or use a string ID with an evaluation-capable default provider.
15
- Evaluation does not fall back to Vercel AI Gateway.
14
+ provider registry, or use a string ID. Strings resolve through Vercel AI Gateway
15
+ unless you configure an evaluation-capable default provider.
16
16
 
17
17
  ```ts
18
18
  import { experimental_evaluate, type Experimental_EvaluationModel } from 'ai';
@@ -125,8 +125,26 @@ evaluation models.
125
125
 
126
126
  ### Default-provider strings
127
127
 
128
- To use strings directly, configure the default provider once at application
129
- startup:
128
+ String IDs use Vercel AI Gateway by default. Configure Gateway authentication
129
+ with `AI_GATEWAY_API_KEY` or Vercel OIDC, then pass a Gateway model ID:
130
+
131
+ ```ts
132
+ import { experimental_evaluate } from 'ai';
133
+
134
+ const result = await experimental_evaluate({
135
+ model: 'typesafe-ai/jev-latest',
136
+ state: 'I was charged twice. Please refund the extra charge.',
137
+ questions: {
138
+ refund: {
139
+ type: 'boolean',
140
+ instructions: 'Is the customer asking for a refund?',
141
+ },
142
+ },
143
+ });
144
+ ```
145
+
146
+ To resolve strings through your own provider or aliases, configure the default
147
+ provider once at application startup:
130
148
 
131
149
  ```ts
132
150
  // Using the registry above, expose an alias through a custom provider:
@@ -152,9 +170,10 @@ also resolve through this global default. Prefer model instances in aliases to
152
170
  avoid resolution cycles. Global configuration affects other AI SDK functions
153
171
  too; avoid changing it per request in a shared process.
154
172
 
155
- Strings require an explicitly configured provider with an `evaluationModel`
156
- method. There is no assumed Gateway evaluation support. Missing providers throw
157
- `NoSuchProviderError`; missing models or evaluation capabilities throw
173
+ An explicitly configured default provider must expose an `evaluationModel`
174
+ method; Gateway is used only when no default provider is configured. Missing
175
+ registry providers throw `NoSuchProviderError`; missing models or evaluation
176
+ capabilities throw
158
177
  `NoSuchModelError` with `modelType: 'evaluationModel'`. Unsupported model versions
159
178
  throw `UnsupportedModelVersionError`, including models returned by registries.
160
179
  The stable `ProviderV4` and `ProviderRegistryProvider` interfaces are unchanged;
@@ -473,8 +473,8 @@ This simplifies provider usage and makes it easier to switch between providers w
473
473
 
474
474
  Custom providers accept `evaluationModels` aliases, and registries expose
475
475
  `evaluationModel('provider:model')`. These methods return model instances for
476
- `experimental_evaluate`. An explicitly configured default provider with an
477
- `evaluationModel` method also enables direct string IDs; evaluation does not
478
- implicitly use Gateway. Registry middleware for language and image models does
479
- not apply to evaluation. See [Evaluation](/docs/ai-sdk-core/evaluation#model-aliases-and-registries)
476
+ `experimental_evaluate`. Direct string IDs use Gateway by default, or an
477
+ explicitly configured default provider with an `evaluationModel` method. Registry
478
+ middleware for language and image models does not apply to evaluation.
479
+ See [Evaluation](/docs/ai-sdk-core/evaluation#model-aliases-and-registries)
480
480
  for aliases, default-provider configuration, and capability differences.
@@ -14,15 +14,15 @@ state. See [Evaluation](/docs/ai-sdk-core/evaluation) for examples and semantics
14
14
 
15
15
  ## Parameters
16
16
 
17
- | Parameter | Type | Description |
18
- | ----------------- | ------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
19
- | `model` | `Experimental_EvaluationModel` | Required experimental v4 model instance or a string ID resolved by an explicitly configured evaluation-capable default provider. |
20
- | `state` | `string \| object \| array` | Required JSON-compatible shared state. |
21
- | `questions` | `Record<string, Experimental_EvaluationQuestion>` | Required nonempty question map. |
22
- | `maxRetries` | `number` | Nonnegative integer; defaults to 2. |
23
- | `abortSignal` | `AbortSignal` | Cancels evaluation. |
24
- | `headers` | `Record<string, string>` | Additional HTTP headers. |
25
- | `providerOptions` | `ProviderOptions` | Provider-specific options. |
17
+ | Parameter | Type | Description |
18
+ | ----------------- | ------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
19
+ | `model` | `Experimental_EvaluationModel` | Required experimental v4 model instance or a string ID resolved by Gateway or an explicitly configured evaluation-capable default provider. |
20
+ | `state` | `string \| object \| array` | Required JSON-compatible shared state. |
21
+ | `questions` | `Record<string, Experimental_EvaluationQuestion>` | Required nonempty question map. |
22
+ | `maxRetries` | `number` | Nonnegative integer; defaults to 2. |
23
+ | `abortSignal` | `AbortSignal` | Cancels evaluation. |
24
+ | `headers` | `Record<string, string>` | Additional HTTP headers. |
25
+ | `providerOptions` | `ProviderOptions` | Provider-specific options. |
26
26
 
27
27
  ## Result
28
28
 
@@ -312,6 +312,7 @@ retain experimental evaluation access.
312
312
  Unavailable evaluation capabilities or models throw `NoSuchModelError` with
313
313
  `modelType: 'evaluationModel'`; unknown registry providers throw
314
314
  `NoSuchProviderError`. These capabilities are structural extensions and are not
315
- added to the stable `ProviderV4` contract. Evaluation does not assume Gateway
316
- support. See [Evaluation](/docs/ai-sdk-core/evaluation#model-aliases-and-registries)
315
+ added to the stable `ProviderV4` contract. Direct evaluation string IDs default
316
+ to Gateway when no default provider is configured.
317
+ See [Evaluation](/docs/ai-sdk-core/evaluation#model-aliases-and-registries)
317
318
  for runnable usage patterns.
@@ -207,13 +207,15 @@ The `customProvider` function returns a `Provider` instance. It has the followin
207
207
  Pass `evaluationModels: Record<string, Experimental_EvaluationModel>` to define
208
208
  aliases for evaluation model instances or string IDs. The returned provider adds
209
209
  `evaluationModel(alias): Experimental_EvaluationModelV4`. String aliases resolve
210
- through an explicitly configured default provider with an `evaluationModel`
211
- method. Unknown aliases use the fallback provider's evaluation factory when
212
- available; model failures and unsupported questions do not trigger substitution.
210
+ through Gateway by default, or an explicitly configured default provider with
211
+ an `evaluationModel` method. Unknown aliases use the fallback provider's evaluation
212
+ factory when available; model failures and unsupported questions do not trigger
213
+ substitution.
213
214
 
214
215
  Unavailable evaluation capabilities or models throw `NoSuchModelError` with
215
216
  `modelType: 'evaluationModel'`; unknown registry providers throw
216
217
  `NoSuchProviderError`. These capabilities are structural extensions and are not
217
- added to the stable `ProviderV4` contract. Evaluation does not assume Gateway
218
- support. See [Evaluation](/docs/ai-sdk-core/evaluation#model-aliases-and-registries)
218
+ added to the stable `ProviderV4` contract. Direct evaluation string IDs default
219
+ to Gateway when no default provider is configured.
220
+ See [Evaluation](/docs/ai-sdk-core/evaluation#model-aliases-and-registries)
219
221
  for runnable usage patterns.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai",
3
- "version": "7.0.104",
3
+ "version": "7.0.105",
4
4
  "type": "module",
5
5
  "description": "AI SDK by Vercel - build apps like ChatGPT, Claude, Gemini, and more with a single interface for any model using the Vercel AI Gateway or go direct to OpenAI, Anthropic, Google, or any other model provider.",
6
6
  "license": "Apache-2.0",
@@ -42,7 +42,7 @@
42
42
  }
43
43
  },
44
44
  "dependencies": {
45
- "@ai-sdk/gateway": "4.0.84",
45
+ "@ai-sdk/gateway": "4.0.85",
46
46
  "@ai-sdk/provider": "4.0.17",
47
47
  "@ai-sdk/provider-utils": "5.0.43"
48
48
  },
@@ -222,10 +222,8 @@ export function resolveEvaluationModel(
222
222
  ): EvaluationModelV4 {
223
223
  if (typeof model === 'string') {
224
224
  // Use the original provider so experimental methods and their receiver survive.
225
- // Evaluation does not default to Gateway.
226
- const provider = globalThis.AI_SDK_DEFAULT_PROVIDER as
227
- | EvaluationProvider
228
- | undefined;
225
+ const provider = (globalThis.AI_SDK_DEFAULT_PROVIDER ??
226
+ gateway) as EvaluationProvider;
229
227
 
230
228
  if (typeof provider?.evaluationModel !== 'function') {
231
229
  throw new NoSuchModelError({