Skip to content

Commit 65d993d

Browse files
committed
docs: say how AI SDK 7 changes tracing defaults and prompt linking
1 parent 7b33dff commit 65d993d

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

‎docs/ai/observability.mdx‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
---
22
title: "LLM observability"
33
sidebarTitle: "LLM observability"
4-
description: "Capture Vercel AI SDK calls in a task as spans in the run trace, with model, token usage, cost, and latency. Opt in per call, link calls to prompt versions, and query usage across runs."
4+
description: "Capture Vercel AI SDK calls in a task as spans in the run trace, with model, token usage, cost, and latency. Link calls to prompt versions and query usage across runs."
55
---
66

77
**LLM observability turns a Vercel AI SDK call inside a task into its own span in the run trace, next to your logs and other spans.** Each span carries the model, provider, input, output, and total token counts, cost, and latency, so you can see what each generation did and what it cost without leaving the run.
88

99
Everything shows up inline in the run trace you already use to debug runs. There is no separate product and no dashboard to set up.
1010

1111
<Note>
12-
Observability is opt-in per call and only covers [Vercel AI SDK](https://ai-sdk.dev) functions (`generateText`, `streamText`, `generateObject`). Calls you make with a raw `fetch`, a provider's own SDK, or any other HTTP client are not captured automatically.
12+
Observability only covers [Vercel AI SDK](https://ai-sdk.dev) functions (`generateText`, `streamText`, `generateObject`). On AI SDK 5 and 6 it's opt-in per call. On AI SDK 7, once the `@ai-sdk/otel` adapter is registered, every call is traced, including its prompts and responses, unless you pass `telemetry: { isEnabled: false }`. Calls you make with a raw `fetch`, a provider's own SDK, or any other HTTP client are not captured automatically.
1313
</Note>
1414

1515
## Turn it on
@@ -66,6 +66,10 @@ A fourth **Prompt** tab appears when the call is linked to an [AI Prompt](/ai/pr
6666

6767
If you manage prompts with [AI Prompts](/ai/prompts), resolve the prompt and spread `toAISDKTelemetry()` into the call. This sets `experimental_telemetry` for you and links the span back to the exact prompt version that produced it.
6868

69+
<Note>
70+
Prompt linking currently works on AI SDK 5 and 6. On AI SDK 7, the metadata from `toAISDKTelemetry()` doesn't reach the span yet, so the call is traced but isn't linked to its prompt version or given the custom attributes.
71+
</Note>
72+
6973
```ts /trigger/support.ts
7074
import { task, prompts } from "@trigger.dev/sdk";
7175
import { generateText } from "ai";

‎docs/ai/prompts.mdx‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,10 @@ By default, `resolve()` returns the **override** version if one is active, other
135135

136136
The resolved prompt integrates with the [Vercel AI SDK](https://ai-sdk.dev) via `toAISDKTelemetry()`. This links AI generation spans to the prompt in the dashboard.
137137

138+
<Note>
139+
Prompt linking currently works on AI SDK 5 and 6. On AI SDK 7, the metadata from `toAISDKTelemetry()` doesn't reach the span yet, so generations are traced but not linked to the prompt.
140+
</Note>
141+
138142
### generateText
139143

140144
```ts

0 commit comments

Comments
 (0)