Skip to content

Commit 7b33dff

Browse files
committed
docs: cover AI SDK 7 tracing defaults and opt-out, and the v5 structured output result
1 parent e2b7714 commit 7b33dff

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

‎docs/ai/observability.mdx‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ Set `experimental_telemetry: { isEnabled: true }` on the AI SDK call. There is n
2626
registerTelemetry(new OpenTelemetry());
2727
```
2828

29-
A [`chat.agent()`](/ai-chat/overview) run registers the adapter for you at run start, so chat agents need only the install. Once the adapter is registered, AI SDK 7 traces calls by default, and `telemetry` is the non-deprecated name for `experimental_telemetry`. On AI SDK 5 and 6, `ai` core emits spans directly and no adapter is needed.
29+
Register it the same way in projects with [`chat.agent()`](/ai-chat/overview) runs too: the static import is what includes `@ai-sdk/otel` in your deployed bundle. `chat.agent()` detects the existing registration and won't add a second one.
30+
31+
Once the adapter is registered, AI SDK 7 traces every call by default, so the per-call flag is optional. To leave a call out, pass `telemetry: { isEnabled: false }` (`telemetry` is the non-deprecated name for `experimental_telemetry`). On AI SDK 5 and 6, `ai` core emits spans directly and no adapter is needed.
3032
</Note>
3133

3234
```ts /trigger/summarize.ts

‎docs/tasks/schemaTask.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ export const chartTool = tool({
182182
```
183183

184184
<Note>
185-
This sample uses AI SDK 7. On AI SDK 6, use `{ type: "image-data", data: output.chart, mediaType: "image/png" }` as the item in `value` instead of the `file` part. On AI SDK 5, use `experimental_output: Output.object(...)` instead of `output`, and `toModelOutput: (output) => ({ type: "content", value: [{ type: "media", data: output.chart, mediaType: "image/png" }] })`.
185+
This sample uses AI SDK 7. On AI SDK 6, use `{ type: "image-data", data: output.chart, mediaType: "image/png" }` as the item in `value` instead of the `file` part. On AI SDK 5, pass `experimental_output: Output.object(...)` instead of `output` and read the result from `experimental_output`, and use `toModelOutput: (output) => ({ type: "content", value: [{ type: "media", data: output.chart, mediaType: "image/png" }] })`.
186186
</Note>
187187

188188
Inside the task run, you can read tool execution context with **`ai.currentToolOptions()`** (and helpers like `ai.toolCallId()`, `ai.chatContext()` when running inside a [`chat.agent`](/ai-chat/overview)):

0 commit comments

Comments
 (0)