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

Node.js stream to CLI app using streamText jams up #3198

Open
stephenkalnoske-sans opened this issue Oct 3, 2024 · 0 comments
Open

Node.js stream to CLI app using streamText jams up #3198

stephenkalnoske-sans opened this issue Oct 3, 2024 · 0 comments

Comments

@stephenkalnoske-sans
Copy link

Description

I have a CLI program using streamText that sends the stream to the console via console.log. It will work for a bit but then the stream output will stop displaying. However, when I go into wireshark, I can see that the full stream from OpenAI completed. Then I'll get an Aborted type error.

Screenshot 2024-10-03 at 7 04 46 PM

Here is what wireshark pulled down from the actual openai api request:

The basic Nmap scan of your localhost (127.0.0.1) has been completed again.

Here are the results:
- **Host is up** with a latency of 0.000057 seconds.
- **Open Ports**:
  - **22/tcp: SSH**

997 other TCP ports are closed.

If there's anything else you'd like to do, just let me know!

Here's the relevant code block:

for await (const streamObj of response.fullStream) {
      if (streamObj.type === "tool-call") {
        console.log(streamObj)
      }
      
      if (streamObj.type !== "text-delta") {
        console.log(streamObj)
        continue;
      }

      

      const text = streamObj.textDelta;
      console.log(text)
    }
    rl.write("\n\n");

Should I try a different kind of stream?

Code example

No response

Additional context

No response

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

1 participant