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

Feature request: assistant streaming

Open rnewman opened this issue 1 year ago • 0 comments

Feature Description

The OpenAI API recently added events for the beta Assistant feature:

https://platform.openai.com/docs/api-reference/assistants-streaming/events

The official Python SDK uses this to offer a streaming interface:

https://platform.openai.com/docs/assistants/overview?lang=python&context=with-streaming

so you can stream and handle events from a run without polling:

with client.beta.threads.runs.stream(
  thread_id=thread.id,
  assistant_id=assistant.id,
  instructions="Please address the user as Jane Doe. The user has a premium account.",
  event_handler=EventHandler(),
) as stream:
  stream.until_done()

Problem it Solves

Writing a polling-based assistant client is awkward and slow.

rnewman avatar Apr 09 '24 18:04 rnewman