openai / openai-node

The official Node.js / Typescript library for the OpenAI API
https://www.npmjs.com/package/openai
Apache License 2.0
7.71k stars 827 forks source link

Assistant Streaming Error Event #845

Open metaskills opened 4 months ago

metaskills commented 4 months ago

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

Describe the feature or improvement you're requesting

Been using the Assistants stream events (https://github.com/openai/openai-node/blob/master/helpers.md) and was wondering if there is a missing error event to compliment the end event? Or is there an expectation that we would use the event event and track error or end as needed from this list? https://platform.openai.com/docs/api-reference/assistants-streaming/events

Additional context

I am worried that without an error event end would be used and there would be a gap in how I could handle this with my application.

rattrayalex commented 4 months ago

Thanks for reporting. I believe .on('error', cb) should actually work, but doesn't appeared to be typed/documented appropriately. We'll look into this.