Integrations
Trigger.dev
Instrumenting your OpenAI calls made through Trigger.dev with Parea
You can use Parea to get visibility into your OpenAI calls made through Trigger.dev. This guide will show you how to do that.
Pre-requisites
- Created a Trigger.dev project & job
- Followed the Authentication steps to set up an organization and API key.
- Installed the Parea SDK:
npm i parea-ai
Instrumenting your OpenAI calls
Assuming you are calling OpenAI through Trigger.dev like this:
To instrument your OpenAI calls, you need to:
- Instantiate the Parea client in the beginning of your application
- Wrap
io.openai.chat.completions.create
withtraceOpenAITriggerDev
. This will automatically log any OpenAI call and send it to Parea.
Applying these changes, your code will look like this:
Visualizing your traces
You will see the OpenAI call appear in the dashboard as shown below: