go-openai icon indicating copy to clipboard operation
go-openai copied to clipboard

Add support for assistants streaming

Open weaseldotro opened this issue 11 months ago • 2 comments

The assistants API now supports streaming responses:

  • https://platform.openai.com/docs/assistants/overview/step-4-create-a-run?context=with-streaming
  • https://platform.openai.com/docs/api-reference/assistants-streaming

weaseldotro avatar Mar 14 '24 07:03 weaseldotro

I've forked this repo and quickly hacked a CreateRunStream function: https://github.com/weaseldotro/go-openai/commit/9ffb38f63bf2c936f95db9bce41efb7b392efbf1

This works for me just fine, but somebody should do a proper job with this, like add tests and docs and stuff.

weaseldotro avatar Mar 17 '24 11:03 weaseldotro

I also hacked something together on my own fork.

I had to add on streaming for some other endpoints like submitting tool outputs and just streaming from an existing thread. (if interested, can take a look at SubmitToolsOutputStream, CreateRunStreaming and CreateThreadAndStream. I know, I know, the naming's kinda shite.

tanzyy96 avatar Mar 22 '24 08:03 tanzyy96