Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assistant (v2) streaming returns an empty stream in v0.11.2 #103

Open
joostbr opened this issue Jan 12, 2025 · 1 comment
Open

Assistant (v2) streaming returns an empty stream in v0.11.2 #103

joostbr opened this issue Jan 12, 2025 · 1 comment

Comments

@joostbr
Copy link

joostbr commented Jan 12, 2025

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());
        }
@TomerAberbach
Copy link
Collaborator

Thanks for the report!

This is a misconfiguration in our streaming code generator config. The configuration is set up to support completions, which requires that only the data of events with an event tag are yielded. Clearly that's not suitable for the Assistants API, so we'll fix it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants