-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
ref(docs): Restructure OpenAI integration documentation #16044
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
| ## Configuration | ||
|
|
||
| By default this integration adds tracing support to OpenAI API method calls including: | ||
| By default, tracing support is added to the following OpenAI API method calls: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated this to be abstract as it can either be an integration or helper
| This integration is **enabled by default for Node.js-based platforms** and automatically captures spans for OpenAI API method calls. You don't need to add it to your `integrations` array in `Sentry.init` unless you want to configure input and output recording with the `recordInputs` and `recordOutputs` options: | ||
|
|
||
| ```javascript | ||
| Sentry.init({ | ||
| dsn: "____PUBLIC_DSN____", | ||
| tracesSampleRate: 1.0, | ||
| integrations: [ | ||
| // This integration is enabled by default. | ||
| // Only add this if you want to configure options. | ||
| Sentry.openAIIntegration({ | ||
| recordInputs: true, | ||
| recordOutputs: true, | ||
| }), | ||
| ], | ||
| }); | ||
| ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this integration is enabled by default, we should give that instruction at the base level, and only give the instructions for options under the subheading. This paragraph also doesn't really tell me what "configuring input and output recording" does for me, so it feels a bit vague right now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
@RulaKhaled I noticed that we do not have a separate section about Runtime for NextJS + OpenAI. should we add something? https://docs.sentry.io/platforms/javascript/guides/nextjs/configuration/integrations/openai/ |
We don't need to, all runtimes in Next.js should use the manual instrumentation. |
|
|
||
| _Import name: `Sentry.openAIIntegration`_ | ||
|
|
||
| The `openAIIntegration` adds instrumentation for the `openai` API to capture spans by wrapping OpenAI client calls and recording LLM interactions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| The `openAIIntegration` adds instrumentation for the `openai` API to capture spans by wrapping OpenAI client calls and recording LLM interactions. | |
| The `openAIIntegration` adds instrumentation for the `openai` SDK to capture spans by wrapping OpenAI client calls and recording LLM interactions. |
l: I'd call it an SDK, but maybe @inventarSarah has a different opinion.
| <Alert> | ||
|
|
||
| This integration works in the Node.js, Cloudflare Workers, Vercel Edge Functions, and browser runtimes. It requires SDK version `10.2.0` or higher. | ||
| This integration is **enabled by default for Node.js-based platforms** and automatically captures spans for OpenAI API method calls. It requires SDK version `10.2.0` or higher. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
q: Couldn't we just conditionally reword this and show it for environments where it's enabled by default via PlatformSelection? e.g.
This integration is enabled by default and automatically captures spans for Anthropic API method calls [..]
|
|
||
| <PlatformSection supported={["javascript"]}> | ||
| For browser applications, you need to manually instrument the OpenAI client using the `instrumentOpenAiClient` helper: | ||
| The `instrumentOpenAiClient` helper adds instrumentation for the `openai` API to capture spans by wrapping OpenAI client calls and recording LLM interactions with configurable input/output recording. You need to manually wrap your OpenAI client instance with this helper. See example below: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| The `instrumentOpenAiClient` helper adds instrumentation for the `openai` API to capture spans by wrapping OpenAI client calls and recording LLM interactions with configurable input/output recording. You need to manually wrap your OpenAI client instance with this helper. See example below: | |
| The `instrumentOpenAiClient` helper adds instrumentation for the `openai` SDK to capture spans by wrapping OpenAI client calls and recording LLM interactions with configurable input/output recording. You need to manually wrap your OpenAI client instance with this helper. See example below: |
l: For alignment.
|
|
||
| _Type: `boolean` (optional)_ | ||
|
|
||
| Records outputs from OpenAI API method calls (such as generated text and responses). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
l: Alignment of "OpenAI API method calls" across the PR. I think this should be "OpenAI SDK calls"
| <PlatformSection supported={["javascript", "javascript.react", "javascript.angular", "javascript.vue", "javascript.svelte", "javascript.solid", "javascript.ember", "javascript.gatsby", "javascript.nextjs", "javascript.nuxt", "javascript.solidstart", "javascript.sveltekit", "javascript.react-router", "javascript.remix", "javascript.astro", "javascript.tanstackstart-react", "javascript.electron", "javascript.cloudflare"]}> | ||
|
|
||
| Records outputs from OpenAI API method calls (such as generated text and responses). | ||
|
|
||
| Defaults to `true` if `sendDefaultPii` is `true`. | ||
| Manual Instrumentation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
l: Maybe we can invert this and just use notSupported={["javascript.node"]}, as far as I can tell, that's the only SDK where we can for sure tell that users don't need to know about manual instrumentation, right?
| ## Supported Operations | ||
|
|
||
| By default this integration adds tracing support to OpenAI API method calls including: | ||
| By default, tracing support is added to the following OpenAI API method calls: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| By default, tracing support is added to the following OpenAI API method calls: | |
| By default, tracing support is added to the following OpenAI SDK method calls: |

closes https://linear.app/getsentry/issue/TET-1719/browser-javascript-ai-agent-onboarding