ai 6.0.0-beta.153 → 6.0.0-beta.155

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
@@ -866,7 +866,7 @@ import {
866
866
  } from "@ai-sdk/provider-utils";
867
867
 
868
868
  // src/version.ts
869
- var VERSION = true ? "6.0.0-beta.153" : "0.0.0-test";
869
+ var VERSION = true ? "6.0.0-beta.155" : "0.0.0-test";
870
870
 
871
871
  // src/util/download/download.ts
872
872
  var download = async ({ url }) => {
@@ -1280,6 +1280,8 @@ function mapToolResultOutput(output) {
1280
1280
  // src/prompt/create-tool-model-output.ts
1281
1281
  import { getErrorMessage as getErrorMessage3 } from "@ai-sdk/provider";
1282
1282
  async function createToolModelOutput({
1283
+ toolCallId,
1284
+ input,
1283
1285
  output,
1284
1286
  tool: tool2,
1285
1287
  errorMode
@@ -1290,7 +1292,7 @@ async function createToolModelOutput({
1290
1292
  return { type: "error-json", value: toJSONValue(output) };
1291
1293
  }
1292
1294
  if (tool2 == null ? void 0 : tool2.toModelOutput) {
1293
- return await tool2.toModelOutput({ output });
1295
+ return await tool2.toModelOutput({ toolCallId, input, output });
1294
1296
  }
1295
1297
  return typeof output === "string" ? { type: "text", value: output } : { type: "json", value: toJSONValue(output) };
1296
1298
  }
@@ -3318,6 +3320,8 @@ async function toResponseMessages({
3318
3320
  break;
3319
3321
  case "tool-result": {
3320
3322
  const output = await createToolModelOutput({
3323
+ toolCallId: part.toolCallId,
3324
+ input: part.input,
3321
3325
  tool: tools == null ? void 0 : tools[part.toolName],
3322
3326
  output: part.output,
3323
3327
  errorMode: "none"
@@ -3333,6 +3337,8 @@ async function toResponseMessages({
3333
3337
  }
3334
3338
  case "tool-error": {
3335
3339
  const output = await createToolModelOutput({
3340
+ toolCallId: part.toolCallId,
3341
+ input: part.input,
3336
3342
  tool: tools == null ? void 0 : tools[part.toolName],
3337
3343
  output: part.error,
3338
3344
  errorMode: "json"
@@ -3367,6 +3373,8 @@ async function toResponseMessages({
3367
3373
  continue;
3368
3374
  }
3369
3375
  const output = await createToolModelOutput({
3376
+ toolCallId: part.toolCallId,
3377
+ input: part.input,
3370
3378
  tool: tools == null ? void 0 : tools[part.toolName],
3371
3379
  output: part.type === "tool-result" ? part.output : part.error,
3372
3380
  errorMode: part.type === "tool-error" ? "text" : "none"
@@ -3487,6 +3495,8 @@ async function generateText({
3487
3495
  const toolContent = [];
3488
3496
  for (const output2 of toolOutputs) {
3489
3497
  const modelOutput = await createToolModelOutput({
3498
+ toolCallId: output2.toolCallId,
3499
+ input: output2.input,
3490
3500
  tool: tools == null ? void 0 : tools[output2.toolName],
3491
3501
  output: output2.type === "tool-result" ? output2.output : output2.error,
3492
3502
  errorMode: output2.type === "tool-error" ? "json" : "none"
@@ -5892,6 +5902,8 @@ var DefaultStreamTextResult = class {
5892
5902
  toolCallId: output2.toolCallId,
5893
5903
  toolName: output2.toolName,
5894
5904
  output: await createToolModelOutput({
5905
+ toolCallId: output2.toolCallId,
5906
+ input: output2.input,
5895
5907
  tool: tools == null ? void 0 : tools[output2.toolName],
5896
5908
  output: output2.type === "tool-result" ? output2.output : output2.error,
5897
5909
  errorMode: output2.type === "tool-error" ? "json" : "none"
@@ -7106,6 +7118,8 @@ async function convertToModelMessages(messages, options) {
7106
7118
  toolCallId: part.toolCallId,
7107
7119
  toolName,
7108
7120
  output: await createToolModelOutput({
7121
+ toolCallId: part.toolCallId,
7122
+ input: part.input,
7109
7123
  output: part.state === "output-error" ? part.errorText : part.output,
7110
7124
  tool: (_b = options == null ? void 0 : options.tools) == null ? void 0 : _b[toolName],
7111
7125
  errorMode: part.state === "output-error" ? "json" : "none"
@@ -7168,6 +7182,8 @@ async function convertToModelMessages(messages, options) {
7168
7182
  toolCallId: toolPart.toolCallId,
7169
7183
  toolName,
7170
7184
  output: await createToolModelOutput({
7185
+ toolCallId: toolPart.toolCallId,
7186
+ input: toolPart.input,
7171
7187
  output: toolPart.state === "output-error" ? toolPart.errorText : toolPart.output,
7172
7188
  tool: (_f = options == null ? void 0 : options.tools) == null ? void 0 : _f[toolName],
7173
7189
  errorMode: toolPart.state === "output-error" ? "text" : "none"