ai 6.0.0-beta.114 → 6.0.0-beta.116

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,17 @@
1
1
  # ai
2
2
 
3
+ ## 6.0.0-beta.116
4
+
5
+ ### Patch Changes
6
+
7
+ - 4ece5f9: feat(agent): add experimental_download to ToolLoopAgent
8
+
9
+ ## 6.0.0-beta.115
10
+
11
+ ### Patch Changes
12
+
13
+ - 7da02d2: fix(ai): prune messages properly when toolCalls set to 'before-last-message'
14
+
3
15
  ## 6.0.0-beta.114
4
16
 
5
17
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -2748,6 +2748,12 @@ type ToolLoopAgentSettings<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUT
2748
2748
  */
2749
2749
  experimental_context?: unknown;
2750
2750
  /**
2751
+ Custom download function to use for URLs.
2752
+
2753
+ By default, files are downloaded if the model does not support the URL for the given media type.
2754
+ */
2755
+ experimental_download?: DownloadFunction | undefined;
2756
+ /**
2751
2757
  * The schema for the call options.
2752
2758
  */
2753
2759
  callOptionsSchema?: FlexibleSchema<CALL_OPTIONS>;
@@ -2756,7 +2762,7 @@ type ToolLoopAgentSettings<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUT
2756
2762
  *
2757
2763
  * You can use this to have templates based on call options.
2758
2764
  */
2759
- prepareCall?: (options: AgentCallParameters<CALL_OPTIONS> & Pick<ToolLoopAgentSettings<CALL_OPTIONS, TOOLS, OUTPUT>, 'model' | 'tools' | 'maxOutputTokens' | 'temperature' | 'topP' | 'topK' | 'presencePenalty' | 'frequencyPenalty' | 'stopSequences' | 'seed' | 'headers' | 'instructions' | 'stopWhen' | 'experimental_telemetry' | 'activeTools' | 'providerOptions' | 'experimental_context'>) => MaybePromiseLike<Pick<ToolLoopAgentSettings<CALL_OPTIONS, TOOLS, OUTPUT>, 'model' | 'tools' | 'maxOutputTokens' | 'temperature' | 'topP' | 'topK' | 'presencePenalty' | 'frequencyPenalty' | 'stopSequences' | 'seed' | 'headers' | 'instructions' | 'stopWhen' | 'experimental_telemetry' | 'activeTools' | 'providerOptions' | 'experimental_context'> & Omit<Prompt, 'system'>>;
2765
+ prepareCall?: (options: AgentCallParameters<CALL_OPTIONS> & Pick<ToolLoopAgentSettings<CALL_OPTIONS, TOOLS, OUTPUT>, 'model' | 'tools' | 'maxOutputTokens' | 'temperature' | 'topP' | 'topK' | 'presencePenalty' | 'frequencyPenalty' | 'stopSequences' | 'seed' | 'headers' | 'instructions' | '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' | 'stopWhen' | 'experimental_telemetry' | 'activeTools' | 'providerOptions' | 'experimental_context' | 'experimental_download'> & Omit<Prompt, 'system'>>;
2760
2766
  };
2761
2767
 
2762
2768
  /**
package/dist/index.d.ts CHANGED
@@ -2748,6 +2748,12 @@ type ToolLoopAgentSettings<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUT
2748
2748
  */
2749
2749
  experimental_context?: unknown;
2750
2750
  /**
2751
+ Custom download function to use for URLs.
2752
+
2753
+ By default, files are downloaded if the model does not support the URL for the given media type.
2754
+ */
2755
+ experimental_download?: DownloadFunction | undefined;
2756
+ /**
2751
2757
  * The schema for the call options.
2752
2758
  */
2753
2759
  callOptionsSchema?: FlexibleSchema<CALL_OPTIONS>;
@@ -2756,7 +2762,7 @@ type ToolLoopAgentSettings<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUT
2756
2762
  *
2757
2763
  * You can use this to have templates based on call options.
2758
2764
  */
2759
- prepareCall?: (options: AgentCallParameters<CALL_OPTIONS> & Pick<ToolLoopAgentSettings<CALL_OPTIONS, TOOLS, OUTPUT>, 'model' | 'tools' | 'maxOutputTokens' | 'temperature' | 'topP' | 'topK' | 'presencePenalty' | 'frequencyPenalty' | 'stopSequences' | 'seed' | 'headers' | 'instructions' | 'stopWhen' | 'experimental_telemetry' | 'activeTools' | 'providerOptions' | 'experimental_context'>) => MaybePromiseLike<Pick<ToolLoopAgentSettings<CALL_OPTIONS, TOOLS, OUTPUT>, 'model' | 'tools' | 'maxOutputTokens' | 'temperature' | 'topP' | 'topK' | 'presencePenalty' | 'frequencyPenalty' | 'stopSequences' | 'seed' | 'headers' | 'instructions' | 'stopWhen' | 'experimental_telemetry' | 'activeTools' | 'providerOptions' | 'experimental_context'> & Omit<Prompt, 'system'>>;
2765
+ prepareCall?: (options: AgentCallParameters<CALL_OPTIONS> & Pick<ToolLoopAgentSettings<CALL_OPTIONS, TOOLS, OUTPUT>, 'model' | 'tools' | 'maxOutputTokens' | 'temperature' | 'topP' | 'topK' | 'presencePenalty' | 'frequencyPenalty' | 'stopSequences' | 'seed' | 'headers' | 'instructions' | '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' | 'stopWhen' | 'experimental_telemetry' | 'activeTools' | 'providerOptions' | 'experimental_context' | 'experimental_download'> & Omit<Prompt, 'system'>>;
2760
2766
  };
2761
2767
 
2762
2768
  /**
package/dist/index.js CHANGED
@@ -886,7 +886,7 @@ function detectMediaType({
886
886
  var import_provider_utils2 = require("@ai-sdk/provider-utils");
887
887
 
888
888
  // src/version.ts
889
- var VERSION = true ? "6.0.0-beta.114" : "0.0.0-test";
889
+ var VERSION = true ? "6.0.0-beta.116" : "0.0.0-test";
890
890
 
891
891
  // src/util/download/download.ts
892
892
  var download = async ({ url }) => {
@@ -9571,7 +9571,7 @@ function pruneMessages({
9571
9571
  const keptToolCallIds = /* @__PURE__ */ new Set();
9572
9572
  const keptApprovalIds = /* @__PURE__ */ new Set();
9573
9573
  if (keepLastMessagesCount != null) {
9574
- for (const message of messages.slice(0, -keepLastMessagesCount)) {
9574
+ for (const message of messages.slice(-keepLastMessagesCount)) {
9575
9575
  if ((message.role === "assistant" || message.role === "tool") && typeof message.content !== "string") {
9576
9576
  for (const part of message.content) {
9577
9577
  if (part.type === "tool-call" || part.type === "tool-result") {