Skip to content

Commit 6de6a05

Browse files
authored
chore(vercel-ai): recommend adding recordInputs and recordOutputs (#14111)
1 parent 1739994 commit 6de6a05

File tree

1 file changed

+15
-2
lines changed
  • docs/platforms/javascript/common/configuration/integrations

1 file changed

+15
-2
lines changed

docs/platforms/javascript/common/configuration/integrations/vercelai.mdx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,13 @@ Sentry.init({
4747
});
4848
```
4949

50-
To enhance the spans collected by this integration, we recommend providing a `functionId` to identify the function that the telemetry data is for. For more details, see the [AI SDK Telemetry Metadata docs](https://sdk.vercel.ai/docs/ai-sdk-core/telemetry#telemetry-metadata).
50+
To correctly capture spans, pass the `experimental_telemetry` object with `isEnabled: true` to every `generateText`, `generateObject`, and `streamText` function call. For more details, see the [AI SDK Telemetry Metadata docs](https://sdk.vercel.ai/docs/ai-sdk-core/telemetry#telemetry-metadata).
5151

5252
```javascript
5353
const result = await generateText({
5454
model: openai("gpt-4o"),
5555
experimental_telemetry: {
5656
isEnabled: true,
57-
functionId: "my-awesome-function",
5857
},
5958
});
6059
```
@@ -109,6 +108,20 @@ Sentry.init({
109108
});
110109
```
111110

111+
## Identifying functions
112+
113+
In order to make it easier to correlate captured spans with the function calls we recommend setting `functionId` in `experimental_telemetry` in all generation function calls:
114+
115+
```javascript
116+
const result = await generateText({
117+
model: openai("gpt-4o"),
118+
experimental_telemetry: {
119+
isEnabled: true,
120+
functionId: "my-awesome-function",
121+
},
122+
});
123+
```
124+
112125
## Configuration
113126

114127
By default this integration adds tracing support to all `ai` function callsites. If you need to disable span collection for a specific call, you can do so by setting `experimental_telemetry.isEnabled` to `false` in the first argument of the function call.

0 commit comments

Comments
 (0)