openai-kotlin
openai-kotlin copied to clipboard
Feature request: assistant streaming
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.