Skip to content

Sentry OpenAI Instrumentation breaks withResponse() #19073

@jpulec

Description

@jpulec

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/node

SDK Version

10.37.0

Framework Version

No response

Link to Sentry event

No response

Reproduction Example/SDK Setup

The OpenAI lib supports calling .withResponse() on the result of chat.completions.create() and responses.create() in order to get back both the stream and the raw response object from the request. It seems that Sentry's integration does not maintain this API interface, since trying to call withResponse() on a wrapped result ends up with the error: instance.chat.completions.create(...).withResponse is not a function

Steps to Reproduce

  1. Enable OpenAI Integration (on by default)
  2. Call openAIInstance.completions.create({ ... }).withResponse()
  3. Error is thrown.

Expected Result

Sentry's integration should not break this API.

Actual Result

err: {
"type": "TypeError",
"message": "instance.chat.completions.create(...).withResponse is not a function",
}

Additional Context

No response

Priority

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it.

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    Waiting for: Product Owner

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions