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

How to stream with MessageStreamManager? #27

Open
Abe410 opened this issue Apr 3, 2024 · 0 comments
Open

How to stream with MessageStreamManager? #27

Abe410 opened this issue Apr 3, 2024 · 0 comments

Comments

@Abe410
Copy link

Abe410 commented Apr 3, 2024

Hi

I have an instance of the MessageStreamManager which I return from a function, and use in another function to stream my output.

But how do I do that?

Here is what I am returning from a function:

completion = client.messages.stream(
                max_tokens=1024, 
                system=system_message, 
                messages=[{"role": "user", "content": user_message}],
                model="claude-3-haiku-20240307"
                ) 
return completion

How do I then stream the chunks from this completion object, which is a MessageStreamManager?

Doing dir(MessageStreamManager) does not return any method which can be used to stream from this object.

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