ai 6.0.266 → 6.0.268

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.
@@ -164,7 +164,7 @@ function detectMediaType({
164
164
  var import_provider_utils2 = require("@ai-sdk/provider-utils");
165
165
 
166
166
  // src/version.ts
167
- var VERSION = true ? "6.0.266" : "0.0.0-test";
167
+ var VERSION = true ? "6.0.268" : "0.0.0-test";
168
168
 
169
169
  // src/util/download/download.ts
170
170
  var download = async ({
@@ -144,7 +144,7 @@ import {
144
144
  } from "@ai-sdk/provider-utils";
145
145
 
146
146
  // src/version.ts
147
- var VERSION = true ? "6.0.266" : "0.0.0-test";
147
+ var VERSION = true ? "6.0.268" : "0.0.0-test";
148
148
 
149
149
  // src/util/download/download.ts
150
150
  var download = async ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai",
3
- "version": "6.0.266",
3
+ "version": "6.0.268",
4
4
  "description": "AI SDK by Vercel - build apps like ChatGPT, Claude, Gemini, and more with a single interface for any model using the Vercel AI Gateway or go direct to OpenAI, Anthropic, Google, or any other model provider.",
5
5
  "license": "Apache-2.0",
6
6
  "sideEffects": false,
@@ -45,7 +45,7 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "@opentelemetry/api": "^1.9.0",
48
- "@ai-sdk/gateway": "3.0.181",
48
+ "@ai-sdk/gateway": "3.0.183",
49
49
  "@ai-sdk/provider": "3.0.15",
50
50
  "@ai-sdk/provider-utils": "4.0.48"
51
51
  },
@@ -85,6 +85,12 @@ export async function executeToolCall<TOOLS extends ToolSet>({
85
85
  operationId: 'ai.toolCall',
86
86
  telemetry,
87
87
  }),
88
+ ...Object.fromEntries(
89
+ Object.entries(telemetry?.metadata ?? {}).map(([key, value]) => [
90
+ `ai.telemetry.metadata.${key}`,
91
+ value,
92
+ ]),
93
+ ),
88
94
  'ai.toolCall.name': toolName,
89
95
  'ai.toolCall.id': toolCallId,
90
96
  'ai.toolCall.args': {
@@ -170,7 +170,8 @@ export interface GenerateTextResult<
170
170
  * The generated output according to the `output` specification.
171
171
  *
172
172
  * @throws {NoOutputGeneratedError} When no output is available, for example
173
- * when the final step does not finish with a `stop` reason.
173
+ * when the final step finishes with a `tool-calls` reason, or when it
174
+ * contains no text and does not finish with a `stop` reason.
174
175
  */
175
176
  readonly output: InferCompleteOutput<OUTPUT>;
176
177
  }
@@ -1306,9 +1306,13 @@ export async function generateText<
1306
1306
  ],
1307
1307
  });
1308
1308
 
1309
- // parse output only if the last step was finished with "stop":
1309
+ // parse output for stop responses and non-empty responses that are not
1310
+ // tool calls:
1310
1311
  let resolvedOutput;
1311
- if (lastStep.finishReason === 'stop') {
1312
+ if (
1313
+ lastStep.finishReason === 'stop' ||
1314
+ (lastStep.finishReason !== 'tool-calls' && lastStep.text.length > 0)
1315
+ ) {
1312
1316
  const outputSpecification = output ?? text();
1313
1317
  resolvedOutput = await outputSpecification.parseCompleteOutput(
1314
1318
  { text: lastStep.text },