ai 5.0.0-beta.30 → 5.0.0-beta.31

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.mjs CHANGED
@@ -11,7 +11,8 @@ import {
11
11
  dynamicTool as dynamicTool2,
12
12
  generateId as generateId2,
13
13
  jsonSchema as jsonSchema2,
14
- tool as tool2
14
+ tool as tool2,
15
+ zodSchema
15
16
  } from "@ai-sdk/provider-utils";
16
17
 
17
18
  // src/generate-text/generate-text.ts
@@ -315,6 +316,11 @@ var audioMediaTypeSignatures = [
315
316
  mediaType: "audio/mp4",
316
317
  bytesPrefix: [102, 116, 121, 112],
317
318
  base64Prefix: "ZnR5cA"
319
+ },
320
+ {
321
+ mediaType: "audio/webm",
322
+ bytesPrefix: [26, 69, 223, 163],
323
+ base64Prefix: "GkXf"
318
324
  }
319
325
  ];
320
326
  var stripID3 = (data) => {
@@ -1761,9 +1767,29 @@ var DefaultStepResult = class {
1761
1767
  get toolCalls() {
1762
1768
  return this.content.filter((part) => part.type === "tool-call");
1763
1769
  }
1770
+ get staticToolCalls() {
1771
+ return this.toolCalls.filter(
1772
+ (toolCall) => toolCall.dynamic === false
1773
+ );
1774
+ }
1775
+ get dynamicToolCalls() {
1776
+ return this.toolCalls.filter(
1777
+ (toolCall) => toolCall.dynamic === true
1778
+ );
1779
+ }
1764
1780
  get toolResults() {
1765
1781
  return this.content.filter((part) => part.type === "tool-result");
1766
1782
  }
1783
+ get staticToolResults() {
1784
+ return this.toolResults.filter(
1785
+ (toolResult) => toolResult.dynamic === false
1786
+ );
1787
+ }
1788
+ get dynamicToolResults() {
1789
+ return this.toolResults.filter(
1790
+ (toolResult) => toolResult.dynamic === true
1791
+ );
1792
+ }
1767
1793
  };
1768
1794
 
1769
1795
  // src/generate-text/stop-condition.ts
@@ -2226,7 +2252,7 @@ async function executeTools({
2226
2252
  }),
2227
2253
  "ai.toolCall.name": toolName,
2228
2254
  "ai.toolCall.id": toolCallId,
2229
- "ai.toolCall.input": {
2255
+ "ai.toolCall.args": {
2230
2256
  output: () => JSON.stringify(input)
2231
2257
  }
2232
2258
  }
@@ -2234,7 +2260,7 @@ async function executeTools({
2234
2260
  tracer,
2235
2261
  fn: async (span) => {
2236
2262
  try {
2237
- const result = await tool3.execute(input, {
2263
+ const output = await tool3.execute(input, {
2238
2264
  toolCallId,
2239
2265
  messages,
2240
2266
  abortSignal
@@ -2245,7 +2271,7 @@ async function executeTools({
2245
2271
  telemetry,
2246
2272
  attributes: {
2247
2273
  "ai.toolCall.result": {
2248
- output: () => JSON.stringify(result)
2274
+ output: () => JSON.stringify(output)
2249
2275
  }
2250
2276
  }
2251
2277
  })
@@ -2257,7 +2283,7 @@ async function executeTools({
2257
2283
  toolCallId,
2258
2284
  toolName,
2259
2285
  input,
2260
- output: result,
2286
+ output,
2261
2287
  dynamic: tool3.type === "dynamic"
2262
2288
  };
2263
2289
  } catch (error) {
@@ -2305,9 +2331,21 @@ var DefaultGenerateTextResult = class {
2305
2331
  get toolCalls() {
2306
2332
  return this.finalStep.toolCalls;
2307
2333
  }
2334
+ get staticToolCalls() {
2335
+ return this.finalStep.staticToolCalls;
2336
+ }
2337
+ get dynamicToolCalls() {
2338
+ return this.finalStep.dynamicToolCalls;
2339
+ }
2308
2340
  get toolResults() {
2309
2341
  return this.finalStep.toolResults;
2310
2342
  }
2343
+ get staticToolResults() {
2344
+ return this.finalStep.staticToolResults;
2345
+ }
2346
+ get dynamicToolResults() {
2347
+ return this.finalStep.dynamicToolResults;
2348
+ }
2311
2349
  get sources() {
2312
2350
  return this.finalStep.sources;
2313
2351
  }
@@ -3366,7 +3404,7 @@ function processUIMessageStream({
3366
3404
  });
3367
3405
  }
3368
3406
  write();
3369
- if (onToolCall && !chunk.providerExecuted && !chunk.dynamic) {
3407
+ if (onToolCall && !chunk.providerExecuted) {
3370
3408
  await onToolCall({
3371
3409
  toolCall: chunk
3372
3410
  });
@@ -3890,7 +3928,7 @@ function runToolsTransformation({
3890
3928
  }),
3891
3929
  "ai.toolCall.name": toolCall.toolName,
3892
3930
  "ai.toolCall.id": toolCall.toolCallId,
3893
- "ai.toolCall.input": {
3931
+ "ai.toolCall.args": {
3894
3932
  output: () => JSON.stringify(toolCall.input)
3895
3933
  }
3896
3934
  }
@@ -3927,7 +3965,7 @@ function runToolsTransformation({
3927
3965
  selectTelemetryAttributes({
3928
3966
  telemetry,
3929
3967
  attributes: {
3930
- "ai.toolCall.output": {
3968
+ "ai.toolCall.result": {
3931
3969
  output: () => JSON.stringify(output)
3932
3970
  }
3933
3971
  }
@@ -4334,7 +4372,11 @@ var DefaultStreamTextResult = class {
4334
4372
  files: finalStep.files,
4335
4373
  sources: finalStep.sources,
4336
4374
  toolCalls: finalStep.toolCalls,
4375
+ staticToolCalls: finalStep.staticToolCalls,
4376
+ dynamicToolCalls: finalStep.dynamicToolCalls,
4337
4377
  toolResults: finalStep.toolResults,
4378
+ staticToolResults: finalStep.staticToolResults,
4379
+ dynamicToolResults: finalStep.dynamicToolResults,
4338
4380
  request: finalStep.request,
4339
4381
  response: finalStep.response,
4340
4382
  warnings: finalStep.warnings,
@@ -4864,9 +4906,21 @@ var DefaultStreamTextResult = class {
4864
4906
  get toolCalls() {
4865
4907
  return this.finalStep.then((step) => step.toolCalls);
4866
4908
  }
4909
+ get staticToolCalls() {
4910
+ return this.finalStep.then((step) => step.staticToolCalls);
4911
+ }
4912
+ get dynamicToolCalls() {
4913
+ return this.finalStep.then((step) => step.dynamicToolCalls);
4914
+ }
4867
4915
  get toolResults() {
4868
4916
  return this.finalStep.then((step) => step.toolResults);
4869
4917
  }
4918
+ get staticToolResults() {
4919
+ return this.finalStep.then((step) => step.staticToolResults);
4920
+ }
4921
+ get dynamicToolResults() {
4922
+ return this.finalStep.then((step) => step.dynamicToolResults);
4923
+ }
4870
4924
  get usage() {
4871
4925
  return this.finalStep.then((step) => step.usage);
4872
4926
  }
@@ -9498,6 +9552,7 @@ export {
9498
9552
  toolModelMessageSchema,
9499
9553
  userModelMessageSchema,
9500
9554
  wrapLanguageModel,
9501
- wrapProvider
9555
+ wrapProvider,
9556
+ zodSchema
9502
9557
  };
9503
9558
  //# sourceMappingURL=index.mjs.map