ai 6.0.208 → 6.0.210
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 +18 -0
- package/dist/index.js +34 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +34 -4
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +1 -1
- package/dist/internal/index.mjs +1 -1
- package/docs/02-getting-started/02-nextjs-app-router.mdx +2 -2
- package/docs/02-getting-started/03-nextjs-pages-router.mdx +2 -2
- package/docs/02-getting-started/04-svelte.mdx +4 -4
- package/docs/02-getting-started/05-nuxt.mdx +5 -5
- package/docs/02-getting-started/06-nodejs.mdx +3 -3
- package/docs/02-getting-started/07-expo.mdx +4 -4
- package/docs/02-getting-started/08-tanstack-start.mdx +4 -4
- package/docs/04-ai-sdk-ui/02-chatbot.mdx +3 -3
- package/docs/04-ai-sdk-ui/03-chatbot-tool-usage.mdx +1 -1
- package/docs/04-ai-sdk-ui/21-error-handling.mdx +2 -2
- package/docs/04-ai-sdk-ui/25-message-metadata.mdx +2 -2
- package/docs/06-advanced/02-stopping-streams.mdx +3 -3
- package/package.json +5 -5
- package/src/telemetry/sanitize-attribute-value.ts +39 -0
- package/src/telemetry/select-telemetry-attributes.ts +7 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# ai
|
|
2
2
|
|
|
3
|
+
## 6.0.210
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 1b40ac7: Publish all packages under the `@ai-v6` dist tag.
|
|
8
|
+
- Updated dependencies [1b40ac7]
|
|
9
|
+
- @ai-sdk/gateway@3.0.135
|
|
10
|
+
- @ai-sdk/provider-utils@4.0.31
|
|
11
|
+
- @ai-sdk/provider@3.0.11
|
|
12
|
+
|
|
13
|
+
## 6.0.209
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- d102dff: Sanitize OpenTelemetry array attributes so spans no longer emit invalid OTLP values (arrays containing `undefined`/`null`/objects, or arrays mixing primitive types). For example, `gen_ai.response.finish_reasons` could be emitted as `[undefined]` when a finish reason was missing. Such values previously failed telemetry ingestion with `deserializing message invalid value: map, expected map with a single key` and flooded function logs with errors.
|
|
18
|
+
- Updated dependencies [709c0fa]
|
|
19
|
+
- @ai-sdk/gateway@3.0.134
|
|
20
|
+
|
|
3
21
|
## 6.0.208
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -1281,7 +1281,7 @@ function detectMediaType({
|
|
|
1281
1281
|
var import_provider_utils3 = require("@ai-sdk/provider-utils");
|
|
1282
1282
|
|
|
1283
1283
|
// src/version.ts
|
|
1284
|
-
var VERSION = true ? "6.0.
|
|
1284
|
+
var VERSION = true ? "6.0.210" : "0.0.0-test";
|
|
1285
1285
|
|
|
1286
1286
|
// src/util/download/download.ts
|
|
1287
1287
|
var download = async ({
|
|
@@ -2505,6 +2505,30 @@ function recordErrorOnSpan(span, error) {
|
|
|
2505
2505
|
}
|
|
2506
2506
|
}
|
|
2507
2507
|
|
|
2508
|
+
// src/telemetry/sanitize-attribute-value.ts
|
|
2509
|
+
function isPrimitiveAttributeValue(value) {
|
|
2510
|
+
return typeof value === "string" || typeof value === "number" || typeof value === "boolean";
|
|
2511
|
+
}
|
|
2512
|
+
function sanitizeAttributeValue(value) {
|
|
2513
|
+
if (!Array.isArray(value)) {
|
|
2514
|
+
return value;
|
|
2515
|
+
}
|
|
2516
|
+
const primitiveTypes = new Set(
|
|
2517
|
+
value.filter(isPrimitiveAttributeValue).map((item) => typeof item)
|
|
2518
|
+
);
|
|
2519
|
+
if (primitiveTypes.size !== 1) {
|
|
2520
|
+
return void 0;
|
|
2521
|
+
}
|
|
2522
|
+
const [primitiveType] = primitiveTypes;
|
|
2523
|
+
if (primitiveType === "string") {
|
|
2524
|
+
return value.filter((item) => typeof item === "string");
|
|
2525
|
+
}
|
|
2526
|
+
if (primitiveType === "number") {
|
|
2527
|
+
return value.filter((item) => typeof item === "number");
|
|
2528
|
+
}
|
|
2529
|
+
return value.filter((item) => typeof item === "boolean");
|
|
2530
|
+
}
|
|
2531
|
+
|
|
2508
2532
|
// src/telemetry/select-telemetry-attributes.ts
|
|
2509
2533
|
async function selectTelemetryAttributes({
|
|
2510
2534
|
telemetry,
|
|
@@ -2524,7 +2548,9 @@ async function selectTelemetryAttributes({
|
|
|
2524
2548
|
}
|
|
2525
2549
|
const result = await value.input();
|
|
2526
2550
|
if (result != null) {
|
|
2527
|
-
|
|
2551
|
+
const sanitized2 = sanitizeAttributeValue(result);
|
|
2552
|
+
if (sanitized2 != null)
|
|
2553
|
+
resultAttributes[key] = sanitized2;
|
|
2528
2554
|
}
|
|
2529
2555
|
continue;
|
|
2530
2556
|
}
|
|
@@ -2534,11 +2560,15 @@ async function selectTelemetryAttributes({
|
|
|
2534
2560
|
}
|
|
2535
2561
|
const result = await value.output();
|
|
2536
2562
|
if (result != null) {
|
|
2537
|
-
|
|
2563
|
+
const sanitized2 = sanitizeAttributeValue(result);
|
|
2564
|
+
if (sanitized2 != null)
|
|
2565
|
+
resultAttributes[key] = sanitized2;
|
|
2538
2566
|
}
|
|
2539
2567
|
continue;
|
|
2540
2568
|
}
|
|
2541
|
-
|
|
2569
|
+
const sanitized = sanitizeAttributeValue(value);
|
|
2570
|
+
if (sanitized != null)
|
|
2571
|
+
resultAttributes[key] = sanitized;
|
|
2542
2572
|
}
|
|
2543
2573
|
return resultAttributes;
|
|
2544
2574
|
}
|