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

OpenAI Streaming #25

Merged
merged 62 commits into from
Sep 4, 2024
Merged

OpenAI Streaming #25

merged 62 commits into from
Sep 4, 2024

Conversation

CharlesDuboisSAP
Copy link
Contributor

@CharlesDuboisSAP CharlesDuboisSAP commented Aug 16, 2024

Context

AI/ai-sdk-java-backlog#59

Streaming allows the user to get an initial response from the LLM without waiting for the whole response.

Feature scope:

  • Added streamChatCompletion() to the OpenAiClient

Definition of Done

  • Functionality scope stated & covered
  • Tests cover the scope above
  • Error handling created / updated & covered by the tests above
  • Aligned changes with the JavaScript SDK
  • Documentation updated
  • Release notes updated

@CharlesDuboisSAP CharlesDuboisSAP self-assigned this Aug 16, 2024
@CharlesDuboisSAP CharlesDuboisSAP changed the title Streaming OpenAI Streaming Aug 16, 2024
@CharlesDuboisSAP CharlesDuboisSAP marked this pull request as ready for review August 21, 2024 07:47
.peek(totalOutput::addDelta)
.forEach(delta -> send(emitter, delta.getDeltaContent()));
} finally {
send(emitter, "\n\n-----Total Output-----\n\n" + objectToJson(totalOutput));
Copy link
Contributor

@newtork newtork Sep 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Comment/Minor)

It could be worthwhile to not just dump the object-to-string. But instead to extract the relevant information and write it piece-by-piece. That would also demonstrate the actual benefit of the feature. Right now the interested reader would wonder.. "what does total output even mean? what does it contain?"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are potentially 30 relevant informations. Which one in particular?
Also you could say the regular OpenAiClient.chatCompletion() is confusing because it returns the total output.
Maybe you have a name suggestion for this var?

@CharlesDuboisSAP CharlesDuboisSAP merged commit 89bb17c into main Sep 4, 2024
5 checks passed
@CharlesDuboisSAP CharlesDuboisSAP deleted the streaming branch September 4, 2024 14:58
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

Successfully merging this pull request may close these issues.

4 participants