ai 7.0.0-beta.183 → 7.0.0-beta.185

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.
Files changed (37) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/index.d.ts +11 -1
  3. package/dist/index.js +37 -20
  4. package/dist/index.js.map +1 -1
  5. package/dist/internal/index.js +1 -1
  6. package/docs/02-getting-started/04-svelte.mdx +3 -3
  7. package/docs/02-getting-started/05-nuxt.mdx +4 -4
  8. package/docs/02-getting-started/06-nodejs.mdx +3 -3
  9. package/docs/02-getting-started/07-expo.mdx +2 -2
  10. package/docs/02-getting-started/08-tanstack-start.mdx +4 -4
  11. package/docs/03-agents/06-tool-approvals.mdx +6 -6
  12. package/docs/03-agents/07-workflow-agent.mdx +42 -2
  13. package/docs/03-ai-sdk-core/17-runtime-and-tool-context.mdx +2 -2
  14. package/docs/03-ai-sdk-core/20-prompt-engineering.mdx +1 -1
  15. package/docs/03-ai-sdk-core/36-realtime.mdx +69 -11
  16. package/docs/03-ai-sdk-core/38-video-generation.mdx +15 -0
  17. package/docs/03-ai-sdk-core/45-provider-management.mdx +3 -3
  18. package/docs/03-ai-sdk-core/60-telemetry.mdx +4 -0
  19. package/docs/03-ai-sdk-harnesses/01-overview.mdx +2 -0
  20. package/docs/03-ai-sdk-harnesses/02-harness-agent.mdx +2 -0
  21. package/docs/03-ai-sdk-harnesses/06-workflow-utilities.mdx +342 -0
  22. package/docs/03-ai-sdk-harnesses/index.mdx +6 -0
  23. package/docs/04-ai-sdk-ui/02-chatbot.mdx +3 -3
  24. package/docs/04-ai-sdk-ui/03-chatbot-tool-usage.mdx +1 -1
  25. package/docs/04-ai-sdk-ui/21-error-handling.mdx +2 -2
  26. package/docs/04-ai-sdk-ui/25-message-metadata.mdx +2 -2
  27. package/docs/06-advanced/02-stopping-streams.mdx +2 -2
  28. package/docs/07-reference/01-ai-sdk-core/13-generate-video.mdx +7 -0
  29. package/docs/07-reference/01-ai-sdk-core/23-get-realtime-tool-definitions.mdx +9 -0
  30. package/docs/07-reference/01-ai-sdk-core/40-provider-registry.mdx +1 -1
  31. package/docs/07-reference/02-ai-sdk-ui/05-use-realtime.mdx +6 -2
  32. package/docs/07-reference/04-ai-sdk-workflow/01-workflow-agent.mdx +15 -1
  33. package/package.json +4 -4
  34. package/src/agent/tool-loop-agent.ts +17 -0
  35. package/src/generate-video/generate-video.ts +8 -0
  36. /package/docs/03-ai-sdk-harnesses/{06-ui.mdx → 07-ui.mdx} +0 -0
  37. /package/docs/03-ai-sdk-harnesses/{07-terminal-ui.mdx → 08-terminal-ui.mdx} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # ai
2
2
 
3
+ ## 7.0.0-beta.185
4
+
5
+ ### Patch Changes
6
+
7
+ - 75763b0: agents: tag outgoing requests with an ai-sdk-agent user-agent segment for usage attribution (tool-loop, workflow)
8
+
9
+ ## 7.0.0-beta.184
10
+
11
+ ### Patch Changes
12
+
13
+ - 0416e3e: feat (video): add first-class `generateAudio` call option
14
+ - Updated dependencies [a403276]
15
+ - Updated dependencies [0416e3e]
16
+ - @ai-sdk/gateway@4.0.0-beta.112
17
+ - @ai-sdk/provider@4.0.0-beta.20
18
+ - @ai-sdk/provider-utils@5.0.0-beta.50
19
+
3
20
  ## 7.0.0-beta.183
4
21
 
5
22
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -5221,6 +5221,12 @@ declare class ToolLoopAgent<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, RU
5221
5221
  */
5222
5222
  get tools(): TOOLS;
5223
5223
  private prepareCall;
5224
+ /**
5225
+ * Tags outgoing requests so usage can be attributed to ToolLoopAgent. Chains
5226
+ * with the `ai/<version>` and `ai-sdk/<provider>/<version>` suffixes added
5227
+ * downstream by generateText/streamText and the provider.
5228
+ */
5229
+ private agentHeaders;
5224
5230
  /**
5225
5231
  * Generates an output from the agent (non-streaming).
5226
5232
  */
@@ -7861,7 +7867,7 @@ type GenerateVideoPrompt = string | {
7861
7867
  image: DataContent;
7862
7868
  text?: string;
7863
7869
  };
7864
- declare function experimental_generateVideo({ model: modelArg, prompt: promptArg, n, maxVideosPerCall, aspectRatio, resolution, duration, fps, seed, providerOptions, maxRetries: maxRetriesArg, abortSignal, headers, download: downloadFn, }: {
7870
+ declare function experimental_generateVideo({ model: modelArg, prompt: promptArg, n, maxVideosPerCall, aspectRatio, resolution, duration, fps, seed, generateAudio, providerOptions, maxRetries: maxRetriesArg, abortSignal, headers, download: downloadFn, }: {
7865
7871
  /**
7866
7872
  * The video model to use.
7867
7873
  */
@@ -7898,6 +7904,10 @@ declare function experimental_generateVideo({ model: modelArg, prompt: promptArg
7898
7904
  * Seed for the video generation.
7899
7905
  */
7900
7906
  seed?: number;
7907
+ /**
7908
+ * Whether the model should generate audio alongside the video.
7909
+ */
7910
+ generateAudio?: boolean;
7901
7911
  /**
7902
7912
  * Additional provider-specific options that are passed through to the provider
7903
7913
  * as body parameters.
package/dist/index.js CHANGED
@@ -19,7 +19,8 @@ import {
19
19
 
20
20
  // src/agent/tool-loop-agent.ts
21
21
  import {
22
- validateTypes as validateTypes3
22
+ validateTypes as validateTypes3,
23
+ withUserAgentSuffix as withUserAgentSuffix3
23
24
  } from "@ai-sdk/provider-utils";
24
25
 
25
26
  // src/generate-text/generate-text.ts
@@ -1088,7 +1089,7 @@ import {
1088
1089
  } from "@ai-sdk/provider-utils";
1089
1090
 
1090
1091
  // src/version.ts
1091
- var VERSION = true ? "7.0.0-beta.183" : "0.0.0-test";
1092
+ var VERSION = true ? "7.0.0-beta.185" : "0.0.0-test";
1092
1093
 
1093
1094
  // src/util/download/download.ts
1094
1095
  var download = async ({
@@ -10014,6 +10015,18 @@ var ToolLoopAgent = class {
10014
10015
  ...promptArgs
10015
10016
  };
10016
10017
  }
10018
+ /**
10019
+ * Tags outgoing requests so usage can be attributed to ToolLoopAgent. Chains
10020
+ * with the `ai/<version>` and `ai-sdk/<provider>/<version>` suffixes added
10021
+ * downstream by generateText/streamText and the provider.
10022
+ */
10023
+ agentHeaders(preparedCall) {
10024
+ var _a22;
10025
+ return withUserAgentSuffix3(
10026
+ (_a22 = preparedCall.headers) != null ? _a22 : {},
10027
+ "ai-sdk-agent/tool-loop"
10028
+ );
10029
+ }
10017
10030
  /**
10018
10031
  * Generates an output from the agent (non-streaming).
10019
10032
  */
@@ -10067,7 +10080,8 @@ var ToolLoopAgent = class {
10067
10080
  };
10068
10081
  return await generate({
10069
10082
  ...preparedCall,
10070
- ...callbackArgs
10083
+ ...callbackArgs,
10084
+ headers: this.agentHeaders(preparedCall)
10071
10085
  });
10072
10086
  }
10073
10087
  /**
@@ -10125,7 +10139,8 @@ var ToolLoopAgent = class {
10125
10139
  };
10126
10140
  return await stream({
10127
10141
  ...preparedCall,
10128
- ...callbackArgs
10142
+ ...callbackArgs,
10143
+ headers: this.agentHeaders(preparedCall)
10129
10144
  });
10130
10145
  }
10131
10146
  };
@@ -11087,7 +11102,7 @@ async function pipeAgentUIStreamToResponse({
11087
11102
  // src/embed/embed.ts
11088
11103
  import {
11089
11104
  createIdGenerator as createIdGenerator4,
11090
- withUserAgentSuffix as withUserAgentSuffix3
11105
+ withUserAgentSuffix as withUserAgentSuffix4
11091
11106
  } from "@ai-sdk/provider-utils";
11092
11107
  var originalGenerateCallId4 = createIdGenerator4({
11093
11108
  prefix: "call",
@@ -11116,7 +11131,7 @@ async function embed({
11116
11131
  });
11117
11132
  const resolvedOnStart = onStart != null ? onStart : experimental_onStart;
11118
11133
  const resolvedOnEnd = onEnd != null ? onEnd : experimental_onEnd;
11119
- const headersWithUserAgent = withUserAgentSuffix3(
11134
+ const headersWithUserAgent = withUserAgentSuffix4(
11120
11135
  headers != null ? headers : {},
11121
11136
  `ai/${VERSION}`
11122
11137
  );
@@ -11237,7 +11252,7 @@ var DefaultEmbedResult = class {
11237
11252
  // src/embed/embed-many.ts
11238
11253
  import {
11239
11254
  createIdGenerator as createIdGenerator5,
11240
- withUserAgentSuffix as withUserAgentSuffix4
11255
+ withUserAgentSuffix as withUserAgentSuffix5
11241
11256
  } from "@ai-sdk/provider-utils";
11242
11257
 
11243
11258
  // src/util/split-array.ts
@@ -11281,7 +11296,7 @@ async function embedMany({
11281
11296
  });
11282
11297
  const resolvedOnStart = onStart != null ? onStart : experimental_onStart;
11283
11298
  const resolvedOnEnd = onEnd != null ? onEnd : experimental_onEnd;
11284
- const headersWithUserAgent = withUserAgentSuffix4(
11299
+ const headersWithUserAgent = withUserAgentSuffix5(
11285
11300
  headers != null ? headers : {},
11286
11301
  `ai/${VERSION}`
11287
11302
  );
@@ -11507,7 +11522,7 @@ var DefaultEmbedManyResult = class {
11507
11522
  import {
11508
11523
  convertBase64ToUint8Array as convertBase64ToUint8Array4,
11509
11524
  detectMediaType as detectMediaType2,
11510
- withUserAgentSuffix as withUserAgentSuffix5
11525
+ withUserAgentSuffix as withUserAgentSuffix6
11511
11526
  } from "@ai-sdk/provider-utils";
11512
11527
 
11513
11528
  // src/prompt/data-content.ts
@@ -11561,7 +11576,7 @@ async function generateImage({
11561
11576
  }) {
11562
11577
  var _a22, _b;
11563
11578
  const model = resolveImageModel(modelArg);
11564
- const headersWithUserAgent = withUserAgentSuffix5(
11579
+ const headersWithUserAgent = withUserAgentSuffix6(
11565
11580
  headers != null ? headers : {},
11566
11581
  `ai/${VERSION}`
11567
11582
  );
@@ -11729,7 +11744,7 @@ function toImageModelV4File(dataContent) {
11729
11744
  // src/generate-object/generate-object.ts
11730
11745
  import {
11731
11746
  createIdGenerator as createIdGenerator6,
11732
- withUserAgentSuffix as withUserAgentSuffix6
11747
+ withUserAgentSuffix as withUserAgentSuffix7
11733
11748
  } from "@ai-sdk/provider-utils";
11734
11749
 
11735
11750
  // src/generate-text/extract-reasoning-content.ts
@@ -12253,7 +12268,7 @@ async function generateObject(options) {
12253
12268
  enumValues
12254
12269
  });
12255
12270
  const callSettings = prepareLanguageModelCallOptions(settings);
12256
- const headersWithUserAgent = withUserAgentSuffix6(
12271
+ const headersWithUserAgent = withUserAgentSuffix7(
12257
12272
  headers != null ? headers : {},
12258
12273
  `ai/${VERSION}`
12259
12274
  );
@@ -13090,7 +13105,7 @@ var DefaultStreamObjectResult = class {
13090
13105
  // src/generate-speech/generate-speech.ts
13091
13106
  import {
13092
13107
  detectMediaType as detectMediaType3,
13093
- withUserAgentSuffix as withUserAgentSuffix7
13108
+ withUserAgentSuffix as withUserAgentSuffix8
13094
13109
  } from "@ai-sdk/provider-utils";
13095
13110
 
13096
13111
  // src/generate-speech/generated-audio-file.ts
@@ -13137,7 +13152,7 @@ async function generateSpeech({
13137
13152
  if (!resolvedModel) {
13138
13153
  throw new Error("Model could not be resolved");
13139
13154
  }
13140
- const headersWithUserAgent = withUserAgentSuffix7(
13155
+ const headersWithUserAgent = withUserAgentSuffix8(
13141
13156
  headers != null ? headers : {},
13142
13157
  `ai/${VERSION}`
13143
13158
  );
@@ -13374,7 +13389,7 @@ function smoothStream({
13374
13389
  // src/generate-video/generate-video.ts
13375
13390
  import {
13376
13391
  convertBase64ToUint8Array as convertBase64ToUint8Array5,
13377
- withUserAgentSuffix as withUserAgentSuffix8,
13392
+ withUserAgentSuffix as withUserAgentSuffix9,
13378
13393
  detectMediaType as detectMediaType4
13379
13394
  } from "@ai-sdk/provider-utils";
13380
13395
  var defaultDownload = createDownload();
@@ -13388,6 +13403,7 @@ async function experimental_generateVideo({
13388
13403
  duration,
13389
13404
  fps,
13390
13405
  seed,
13406
+ generateAudio,
13391
13407
  providerOptions,
13392
13408
  maxRetries: maxRetriesArg,
13393
13409
  abortSignal,
@@ -13396,7 +13412,7 @@ async function experimental_generateVideo({
13396
13412
  }) {
13397
13413
  var _a22;
13398
13414
  const model = resolveVideoModel(modelArg);
13399
- const headersWithUserAgent = withUserAgentSuffix8(
13415
+ const headersWithUserAgent = withUserAgentSuffix9(
13400
13416
  headers != null ? headers : {},
13401
13417
  `ai/${VERSION}`
13402
13418
  );
@@ -13422,6 +13438,7 @@ async function experimental_generateVideo({
13422
13438
  duration,
13423
13439
  fps,
13424
13440
  seed,
13441
+ generateAudio,
13425
13442
  image,
13426
13443
  providerOptions: providerOptions != null ? providerOptions : {},
13427
13444
  headers: headersWithUserAgent,
@@ -15713,7 +15730,7 @@ var DefaultRerankResult = class {
15713
15730
  // src/transcribe/transcribe.ts
15714
15731
  import {
15715
15732
  detectMediaType as detectMediaType5,
15716
- withUserAgentSuffix as withUserAgentSuffix9
15733
+ withUserAgentSuffix as withUserAgentSuffix10
15717
15734
  } from "@ai-sdk/provider-utils";
15718
15735
  var defaultDownload2 = createDownload();
15719
15736
  async function transcribe({
@@ -15733,7 +15750,7 @@ async function transcribe({
15733
15750
  maxRetries: maxRetriesArg,
15734
15751
  abortSignal
15735
15752
  });
15736
- const headersWithUserAgent = withUserAgentSuffix9(
15753
+ const headersWithUserAgent = withUserAgentSuffix10(
15737
15754
  headers != null ? headers : {},
15738
15755
  `ai/${VERSION}`
15739
15756
  );
@@ -15790,7 +15807,7 @@ var experimental_transcribe = transcribe;
15790
15807
  // src/ui/call-completion-api.ts
15791
15808
  import {
15792
15809
  parseJsonEventStream,
15793
- withUserAgentSuffix as withUserAgentSuffix10,
15810
+ withUserAgentSuffix as withUserAgentSuffix11,
15794
15811
  getRuntimeEnvironmentUserAgent as getRuntimeEnvironmentUserAgent2
15795
15812
  } from "@ai-sdk/provider-utils";
15796
15813
 
@@ -15840,7 +15857,7 @@ async function callCompletionApi({
15840
15857
  ...body
15841
15858
  }),
15842
15859
  credentials,
15843
- headers: withUserAgentSuffix10(
15860
+ headers: withUserAgentSuffix11(
15844
15861
  {
15845
15862
  "Content-Type": "application/json",
15846
15863
  ...headers