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

[JS] GenerateStreamResponse.stream() should give me GenerateResponseChunks #772

Closed
kevinthecheung opened this issue Aug 9, 2024 · 0 comments
Labels
bug Something isn't working js

Comments

@kevinthecheung
Copy link
Contributor

Describe the bug
I get an iterable of GenerateResponseChunkData from generateStream but GenerateResponseChunk would be better.

To Reproduce

    const llmResponseStream: GenerateStreamResponse = await generateStream({
      prompt: `Suggest a complete menu for a ${subject} themed restaurant`,
      model: gemini15Flash,
    });

    for await (const responseChunk of llmResponseStream.stream()) {
      console.log(responseChunk.text()); // compiler error
    }

But if I add @ts-ignore before the line it compiles and works

Expected behavior

I want to use all of GenerateResponseChunk's useful methods. In fact I think it's required for partial structured output

Screenshots
If applicable, add screenshots to help explain your problem.

Runtime (please complete the following information):

  • OS: [e.g. Linux, MacOS]
  • Version [e.g. 22]

** Node version

  • run node --version at paste here

Additional context
Add any other context about the problem here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working js
Projects
Status: Done
Development

No branches or pull requests

2 participants