ai 6.0.250 → 6.0.252

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,21 @@
1
1
  # ai
2
2
 
3
+ ## 6.0.252
4
+
5
+ ### Patch Changes
6
+
7
+ - 2f96d3f: Allow providers without reranking model support to satisfy the `Provider` type.
8
+ - afb1965: Propagate errors thrown by the Chat `onFinish` callback to the initiating request.
9
+ - Updated dependencies [18b0965]
10
+ - Updated dependencies [451d2c3]
11
+ - @ai-sdk/gateway@3.0.171
12
+
13
+ ## 6.0.251
14
+
15
+ ### Patch Changes
16
+
17
+ - d13c2e9: Respect ToolLoopAgent timeouts configured in agent settings.
18
+
3
19
  ## 6.0.250
4
20
 
5
21
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -205,7 +205,7 @@ type Provider = {
205
205
  *
206
206
  * @throws {NoSuchModelError} If no such model exists.
207
207
  */
208
- rerankingModel(modelId: string): RerankingModel;
208
+ rerankingModel?(modelId: string): RerankingModel;
209
209
  };
210
210
 
211
211
  /**
@@ -3357,7 +3357,7 @@ type ToolLoopAgentSettings<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUT
3357
3357
  * }),
3358
3358
  * ```
3359
3359
  */
3360
- prepareCall?: (options: Omit<AgentCallParameters<CALL_OPTIONS, NoInfer<TOOLS>>, 'onStepFinish'> & Pick<ToolLoopAgentSettings<CALL_OPTIONS, TOOLS, OUTPUT>, 'model' | 'tools' | 'maxOutputTokens' | 'temperature' | 'topP' | 'topK' | 'presencePenalty' | 'frequencyPenalty' | 'stopSequences' | 'seed' | 'headers' | 'instructions' | 'allowSystemInMessages' | 'stopWhen' | 'experimental_telemetry' | 'activeTools' | 'providerOptions' | 'experimental_context' | 'experimental_download'>) => MaybePromiseLike<Pick<ToolLoopAgentSettings<CALL_OPTIONS, TOOLS, OUTPUT>, 'model' | 'tools' | 'maxOutputTokens' | 'temperature' | 'topP' | 'topK' | 'presencePenalty' | 'frequencyPenalty' | 'stopSequences' | 'seed' | 'headers' | 'instructions' | 'allowSystemInMessages' | 'stopWhen' | 'experimental_telemetry' | 'activeTools' | 'providerOptions' | 'experimental_context' | 'experimental_download'> & Omit<Prompt, 'system'>>;
3360
+ prepareCall?: (options: Omit<AgentCallParameters<CALL_OPTIONS, NoInfer<TOOLS>>, 'onStepFinish'> & Pick<ToolLoopAgentSettings<CALL_OPTIONS, TOOLS, OUTPUT>, 'model' | 'tools' | 'maxOutputTokens' | 'temperature' | 'topP' | 'topK' | 'presencePenalty' | 'frequencyPenalty' | 'stopSequences' | 'seed' | 'headers' | 'instructions' | 'allowSystemInMessages' | 'stopWhen' | 'experimental_telemetry' | 'activeTools' | 'providerOptions' | 'experimental_context' | 'experimental_download'>) => MaybePromiseLike<Pick<ToolLoopAgentSettings<CALL_OPTIONS, TOOLS, OUTPUT>, 'model' | 'tools' | 'maxOutputTokens' | 'temperature' | 'topP' | 'topK' | 'presencePenalty' | 'frequencyPenalty' | 'stopSequences' | 'seed' | 'timeout' | 'headers' | 'instructions' | 'allowSystemInMessages' | 'stopWhen' | 'experimental_telemetry' | 'activeTools' | 'providerOptions' | 'experimental_context' | 'experimental_download'> & Omit<Prompt, 'system'>>;
3361
3361
  };
3362
3362
 
3363
3363
  /**
package/dist/index.d.ts CHANGED
@@ -205,7 +205,7 @@ type Provider = {
205
205
  *
206
206
  * @throws {NoSuchModelError} If no such model exists.
207
207
  */
208
- rerankingModel(modelId: string): RerankingModel;
208
+ rerankingModel?(modelId: string): RerankingModel;
209
209
  };
210
210
 
211
211
  /**
@@ -3357,7 +3357,7 @@ type ToolLoopAgentSettings<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUT
3357
3357
  * }),
3358
3358
  * ```
3359
3359
  */
3360
- prepareCall?: (options: Omit<AgentCallParameters<CALL_OPTIONS, NoInfer<TOOLS>>, 'onStepFinish'> & Pick<ToolLoopAgentSettings<CALL_OPTIONS, TOOLS, OUTPUT>, 'model' | 'tools' | 'maxOutputTokens' | 'temperature' | 'topP' | 'topK' | 'presencePenalty' | 'frequencyPenalty' | 'stopSequences' | 'seed' | 'headers' | 'instructions' | 'allowSystemInMessages' | 'stopWhen' | 'experimental_telemetry' | 'activeTools' | 'providerOptions' | 'experimental_context' | 'experimental_download'>) => MaybePromiseLike<Pick<ToolLoopAgentSettings<CALL_OPTIONS, TOOLS, OUTPUT>, 'model' | 'tools' | 'maxOutputTokens' | 'temperature' | 'topP' | 'topK' | 'presencePenalty' | 'frequencyPenalty' | 'stopSequences' | 'seed' | 'headers' | 'instructions' | 'allowSystemInMessages' | 'stopWhen' | 'experimental_telemetry' | 'activeTools' | 'providerOptions' | 'experimental_context' | 'experimental_download'> & Omit<Prompt, 'system'>>;
3360
+ prepareCall?: (options: Omit<AgentCallParameters<CALL_OPTIONS, NoInfer<TOOLS>>, 'onStepFinish'> & Pick<ToolLoopAgentSettings<CALL_OPTIONS, TOOLS, OUTPUT>, 'model' | 'tools' | 'maxOutputTokens' | 'temperature' | 'topP' | 'topK' | 'presencePenalty' | 'frequencyPenalty' | 'stopSequences' | 'seed' | 'headers' | 'instructions' | 'allowSystemInMessages' | 'stopWhen' | 'experimental_telemetry' | 'activeTools' | 'providerOptions' | 'experimental_context' | 'experimental_download'>) => MaybePromiseLike<Pick<ToolLoopAgentSettings<CALL_OPTIONS, TOOLS, OUTPUT>, 'model' | 'tools' | 'maxOutputTokens' | 'temperature' | 'topP' | 'topK' | 'presencePenalty' | 'frequencyPenalty' | 'stopSequences' | 'seed' | 'timeout' | 'headers' | 'instructions' | 'allowSystemInMessages' | 'stopWhen' | 'experimental_telemetry' | 'activeTools' | 'providerOptions' | 'experimental_context' | 'experimental_download'> & Omit<Prompt, 'system'>>;
3361
3361
  };
3362
3362
 
3363
3363
  /**
package/dist/index.js CHANGED
@@ -1304,7 +1304,7 @@ function detectMediaType({
1304
1304
  var import_provider_utils3 = require("@ai-sdk/provider-utils");
1305
1305
 
1306
1306
  // src/version.ts
1307
- var VERSION = true ? "6.0.250" : "0.0.0-test";
1307
+ var VERSION = true ? "6.0.252" : "0.0.0-test";
1308
1308
 
1309
1309
  // src/util/download/download.ts
1310
1310
  var download = async ({
@@ -8910,10 +8910,11 @@ var ToolLoopAgent = class {
8910
8910
  onStepFinish,
8911
8911
  ...options
8912
8912
  }) {
8913
+ const preparedCall = await this.prepareCall(options);
8913
8914
  return generateText({
8914
- ...await this.prepareCall(options),
8915
+ ...preparedCall,
8915
8916
  abortSignal,
8916
- timeout,
8917
+ timeout: timeout != null ? timeout : preparedCall.timeout,
8917
8918
  onStepFinish: this.mergeOnStepFinishCallbacks(onStepFinish)
8918
8919
  });
8919
8920
  }
@@ -8927,10 +8928,11 @@ var ToolLoopAgent = class {
8927
8928
  onStepFinish,
8928
8929
  ...options
8929
8930
  }) {
8931
+ const preparedCall = await this.prepareCall(options);
8930
8932
  return streamText({
8931
- ...await this.prepareCall(options),
8933
+ ...preparedCall,
8932
8934
  abortSignal,
8933
- timeout,
8935
+ timeout: timeout != null ? timeout : preparedCall.timeout,
8934
8936
  experimental_transform,
8935
8937
  onStepFinish: this.mergeOnStepFinishCallbacks(onStepFinish)
8936
8938
  });
@@ -14156,13 +14158,12 @@ var AbstractChat = class {
14156
14158
  finishReason: activeResponse.state.finishReason
14157
14159
  });
14158
14160
  }
14159
- } catch (err) {
14160
- console.error(err);
14161
- }
14162
- if (this.activeResponse === activeResponse) {
14163
- this.activeResponse = void 0;
14161
+ } finally {
14162
+ if (this.activeResponse === activeResponse) {
14163
+ this.activeResponse = void 0;
14164
+ }
14165
+ clearActiveResumeRequest();
14164
14166
  }
14165
- clearActiveResumeRequest();
14166
14167
  }
14167
14168
  if (!isError && await this.shouldSendAutomatically()) {
14168
14169
  await this.makeRequest({