ai 3.1.21 → 3.1.23

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/dist/index.d.mts CHANGED
@@ -841,12 +841,12 @@ If set and supported by the model, calls will generate deterministic results.
841
841
  @param maxRetries - Maximum number of retries. Set to 0 to disable retries. Default: 2.
842
842
  @param abortSignal - An optional abort signal that can be used to cancel the call.
843
843
 
844
- @param maxAutomaticRoundtrips - Maximal number of automatic roundtrips for tool calls.
844
+ @param maxToolRoundtrips - Maximal number of automatic roundtrips for tool calls.
845
845
 
846
846
  @returns
847
847
  A result object that contains the generated text, the results of the tool calls, and additional information.
848
848
  */
849
- declare function generateText<TOOLS extends Record<string, CoreTool>>({ model, tools, toolChoice, system, prompt, messages, maxRetries, abortSignal, maxAutomaticRoundtrips, ...settings }: CallSettings & Prompt & {
849
+ declare function generateText<TOOLS extends Record<string, CoreTool>>({ model, tools, toolChoice, system, prompt, messages, maxRetries, abortSignal, maxAutomaticRoundtrips, maxToolRoundtrips, ...settings }: CallSettings & Prompt & {
850
850
  /**
851
851
  The language model to use.
852
852
  */
@@ -860,6 +860,10 @@ The tool choice strategy. Default: 'auto'.
860
860
  */
861
861
  toolChoice?: CoreToolChoice<TOOLS>;
862
862
  /**
863
+ @deprecated Use `maxToolRoundtrips` instead.
864
+ */
865
+ maxAutomaticRoundtrips?: number;
866
+ /**
863
867
  Maximal number of automatic roundtrips for tool calls.
864
868
 
865
869
  An automatic tool call roundtrip is another LLM call with the
@@ -871,7 +875,7 @@ case of misconfigured tools.
871
875
 
872
876
  By default, it's set to 0, which will disable the feature.
873
877
  */
874
- maxAutomaticRoundtrips?: number;
878
+ maxToolRoundtrips?: number;
875
879
  }): Promise<GenerateTextResult<TOOLS>>;
876
880
  /**
877
881
  The result of a `generateText` call.
package/dist/index.d.ts CHANGED
@@ -841,12 +841,12 @@ If set and supported by the model, calls will generate deterministic results.
841
841
  @param maxRetries - Maximum number of retries. Set to 0 to disable retries. Default: 2.
842
842
  @param abortSignal - An optional abort signal that can be used to cancel the call.
843
843
 
844
- @param maxAutomaticRoundtrips - Maximal number of automatic roundtrips for tool calls.
844
+ @param maxToolRoundtrips - Maximal number of automatic roundtrips for tool calls.
845
845
 
846
846
  @returns
847
847
  A result object that contains the generated text, the results of the tool calls, and additional information.
848
848
  */
849
- declare function generateText<TOOLS extends Record<string, CoreTool>>({ model, tools, toolChoice, system, prompt, messages, maxRetries, abortSignal, maxAutomaticRoundtrips, ...settings }: CallSettings & Prompt & {
849
+ declare function generateText<TOOLS extends Record<string, CoreTool>>({ model, tools, toolChoice, system, prompt, messages, maxRetries, abortSignal, maxAutomaticRoundtrips, maxToolRoundtrips, ...settings }: CallSettings & Prompt & {
850
850
  /**
851
851
  The language model to use.
852
852
  */
@@ -860,6 +860,10 @@ The tool choice strategy. Default: 'auto'.
860
860
  */
861
861
  toolChoice?: CoreToolChoice<TOOLS>;
862
862
  /**
863
+ @deprecated Use `maxToolRoundtrips` instead.
864
+ */
865
+ maxAutomaticRoundtrips?: number;
866
+ /**
863
867
  Maximal number of automatic roundtrips for tool calls.
864
868
 
865
869
  An automatic tool call roundtrip is another LLM call with the
@@ -871,7 +875,7 @@ case of misconfigured tools.
871
875
 
872
876
  By default, it's set to 0, which will disable the feature.
873
877
  */
874
- maxAutomaticRoundtrips?: number;
878
+ maxToolRoundtrips?: number;
875
879
  }): Promise<GenerateTextResult<TOOLS>>;
876
880
  /**
877
881
  The result of a `generateText` call.
package/dist/index.js CHANGED
@@ -1344,6 +1344,7 @@ async function generateText({
1344
1344
  maxRetries,
1345
1345
  abortSignal,
1346
1346
  maxAutomaticRoundtrips = 0,
1347
+ maxToolRoundtrips = maxAutomaticRoundtrips,
1347
1348
  ...settings
1348
1349
  }) {
1349
1350
  var _a, _b, _c;
@@ -1388,7 +1389,7 @@ async function generateText({
1388
1389
  // there are tool calls:
1389
1390
  currentToolCalls.length > 0 && // all current tool calls have results:
1390
1391
  currentToolResults.length === currentToolCalls.length && // the number of roundtrips is less than the maximum:
1391
- roundtrips++ < maxAutomaticRoundtrips
1392
+ roundtrips++ < maxToolRoundtrips
1392
1393
  );
1393
1394
  return new GenerateTextResult({
1394
1395
  // Always return a string so that the caller doesn't have to check for undefined.