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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # ai
2
2
 
3
+ ## 6.0.268
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [ad28ecb]
8
+ - @ai-sdk/gateway@3.0.183
9
+
10
+ ## 6.0.267
11
+
12
+ ### Patch Changes
13
+
14
+ - cd29175: Include telemetry metadata attributes on tool call spans.
15
+ - e88c835: Expose structured output parsing diagnostics from `generateText` when generation stops because of the output token limit.
16
+ - Updated dependencies [845ad6d]
17
+ - Updated dependencies [fe80a3c]
18
+ - @ai-sdk/gateway@3.0.182
19
+
3
20
  ## 6.0.266
4
21
 
5
22
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -1173,7 +1173,8 @@ interface GenerateTextResult<TOOLS extends ToolSet, OUTPUT extends Output> {
1173
1173
  * The generated output according to the `output` specification.
1174
1174
  *
1175
1175
  * @throws {NoOutputGeneratedError} When no output is available, for example
1176
- * when the final step does not finish with a `stop` reason.
1176
+ * when the final step finishes with a `tool-calls` reason, or when it
1177
+ * contains no text and does not finish with a `stop` reason.
1177
1178
  */
1178
1179
  readonly output: InferCompleteOutput<OUTPUT>;
1179
1180
  }
package/dist/index.d.ts CHANGED
@@ -1173,7 +1173,8 @@ interface GenerateTextResult<TOOLS extends ToolSet, OUTPUT extends Output> {
1173
1173
  * The generated output according to the `output` specification.
1174
1174
  *
1175
1175
  * @throws {NoOutputGeneratedError} When no output is available, for example
1176
- * when the final step does not finish with a `stop` reason.
1176
+ * when the final step finishes with a `tool-calls` reason, or when it
1177
+ * contains no text and does not finish with a `stop` reason.
1177
1178
  */
1178
1179
  readonly output: InferCompleteOutput<OUTPUT>;
1179
1180
  }
package/dist/index.js CHANGED
@@ -1304,7 +1304,7 @@ function detectMediaType({
1304
1304
  var import_provider_utils3 = require("@ai-sdk/provider-utils");
1305
1305
 
1306
1306
  // src/version.ts
1307
- var VERSION = true ? "6.0.266" : "0.0.0-test";
1307
+ var VERSION = true ? "6.0.268" : "0.0.0-test";
1308
1308
 
1309
1309
  // src/util/download/download.ts
1310
1310
  var download = async ({
@@ -3009,6 +3009,7 @@ async function executeToolCall({
3009
3009
  onToolCallStart,
3010
3010
  onToolCallFinish
3011
3011
  }) {
3012
+ var _a22;
3012
3013
  const { toolName, toolCallId, input } = toolCall;
3013
3014
  const tool2 = tools == null ? void 0 : tools[toolName];
3014
3015
  if ((tool2 == null ? void 0 : tool2.execute) == null) {
@@ -3033,6 +3034,12 @@ async function executeToolCall({
3033
3034
  operationId: "ai.toolCall",
3034
3035
  telemetry
3035
3036
  }),
3037
+ ...Object.fromEntries(
3038
+ Object.entries((_a22 = telemetry == null ? void 0 : telemetry.metadata) != null ? _a22 : {}).map(([key, value]) => [
3039
+ `ai.telemetry.metadata.${key}`,
3040
+ value
3041
+ ])
3042
+ ),
3036
3043
  "ai.toolCall.name": toolName,
3037
3044
  "ai.toolCall.id": toolCallId,
3038
3045
  "ai.toolCall.args": {
@@ -5202,7 +5209,7 @@ async function generateText({
5202
5209
  ]
5203
5210
  });
5204
5211
  let resolvedOutput;
5205
- if (lastStep.finishReason === "stop") {
5212
+ if (lastStep.finishReason === "stop" || lastStep.finishReason !== "tool-calls" && lastStep.text.length > 0) {
5206
5213
  const outputSpecification = output != null ? output : text();
5207
5214
  resolvedOutput = await outputSpecification.parseCompleteOutput(
5208
5215
  { text: lastStep.text },