Integrations
Vercel AI SDK
Learn how to integrate KeywordsAI tracing with Vercel AI SDK to monitor and analyze your AI application performance. Step-by-step guide for setting up environment variables and creating traced workflows.
Prerequisites
- Vercel AI SDK
- KeywordsAI API key
Steps
1
Install Keywords AI SDK
2
Add an instrumentation file to the root of your project
You should add an instrumentation file to the root of your project. For example, instrumentation.ts
. Same level as .env
or next.config.js
file.
Then add the KeywordsAIExporter
as the trace exporter
root-of-project/instrumentation.js
3
(optional) Configure next.config.js
If you are using Next.js, please do the following:
- Add node-loader package
- Add the following to your
next.config.js
file:
next.config.js
4
Send traces to KeywordsAI
Then, to trace a specific function, simply enable tracing. here is an example of it working on the streamText function:
Was this page helpful?