Skip to content

Support raw error responses #1577

@DanielHabenicht

Description

@DanielHabenicht

Confirm this is a feature request for the Node library and not the underlying OpenAI API.

  • This is a feature request for the Node library

Describe the feature or improvement you're requesting

With the current version its is possible to have undocumented request parameters and response parameters. But if one also returns undocumente errors which are not matching the openai layout the response is basically not accessible.

It would be nice if the error could contain a .raw property which allows to access the original body and headers.

Additional context

e.g. this would be possible:

try {
  new OpenAI({...}).chat.completions.create({
        model,
        messages,
        stream: true
      });
} catch (error) {
  // Access undocumented properties, e.g. RFC specified error properties
  console.log(error.detail)
}
```

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingsdk

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions