Closed
Description
tag 0.11.2:
When using the Assistant API (v2) in streaming mode, it seems to always return an empty stream.
Digging into the code revealed this :
com.openai.core.handlers.SseHandler.kt line 42:
if (message.event == null) {
...
yield message;
...
}
Because of this test the SSE streams related to streaming Assistant (v2) runs return nothing because every entry in the stream is decorated by an 'event' tag.
It does work for 'completions' however since they are plain 'data' objects without an event-tag attached to it.
Not sure why 'event' needs to be null to return (yield) the message in the stream
Example code snippet below, it never prints the "Got something" line, for whatever message content that has been passed to the thread.
// streaming
try (StreamResponse<AssistantStreamEvent> responseStream = client.beta().threads().runs().createStreaming(BetaThreadRunCreateParams.builder()
.assistantId(assistant.id())
.threadId(thread.id())
.build())) {
responseStream.stream().forEach(x->System.out.println("Got something "+x));
} catch (Exception e) {
System.out.println(e.getMessage());
}
Metadata
Metadata
Assignees
Labels
No labels