|
1 | 1 | --- |
2 | 2 | title: "LLM observability" |
3 | 3 | 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." |
5 | 5 | --- |
6 | 6 |
|
7 | 7 | **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. |
8 | 8 |
|
9 | 9 | 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. |
10 | 10 |
|
11 | 11 | <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. |
13 | 13 | </Note> |
14 | 14 |
|
15 | 15 | ## Turn it on |
@@ -66,6 +66,10 @@ A fourth **Prompt** tab appears when the call is linked to an [AI Prompt](/ai/pr |
66 | 66 |
|
67 | 67 | 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. |
68 | 68 |
|
| 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 | + |
69 | 73 | ```ts /trigger/support.ts |
70 | 74 | import { task, prompts } from "@trigger.dev/sdk"; |
71 | 75 | import { generateText } from "ai"; |
|
0 commit comments