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

Add streaming support to googleai_dart client #299

Closed
davidmigloz opened this issue Jan 17, 2024 · 1 comment · Fixed by #323
Closed

Add streaming support to googleai_dart client #299

davidmigloz opened this issue Jan 17, 2024 · 1 comment · Fixed by #323
Assignees
Labels
p:googleai_dart googleai_dart package. t:enhancement New feature or request
Milestone

Comments

@davidmigloz
Copy link
Owner

davidmigloz commented Jan 17, 2024

Docs: https://ai.google.dev/tutorials/rest_quickstart#stream_generate_content

The schema and main methods from the client are automatically generated from the OpenAPI spec. However, the streaming methods need to be written manually.

To add stream support to generate content we need to:

  1. Remove /models/{modelId}:streamGenerateContent from the googleai_openapi_curated.yaml and regenerate the client (as we will add this method manually).
  2. Add a streamGenerateContent method in the GoogleAIClient class. You can check OpenAIClient.createCompletionStream as a reference.
  3. Write a StreamTransformer that returns valid jsons from the stream of data. You can check _OpenAIStreamTransformer as a reference (but the way the data is sent may be different).
@davidmigloz davidmigloz added p:googleai_dart googleai_dart package. t:enhancement New feature or request labels Jan 17, 2024
@davidmigloz davidmigloz added this to the v0.4.0 milestone Jan 17, 2024
@luisredondo
Copy link
Contributor

I will work on this one! @davidmigloz

@davidmigloz davidmigloz modified the milestones: v0.3.3, v0.4.0 Jan 20, 2024
davidmigloz added a commit that referenced this issue Feb 12, 2024
Co-authored-by: David Miguel <me@davidmiguel.com>
KennethKnudsen97 pushed a commit to KennethKnudsen97/langchain_dart that referenced this issue Apr 22, 2024
Co-authored-by: David Miguel <me@davidmiguel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p:googleai_dart googleai_dart package. t:enhancement New feature or request
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants