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

In the example file stream_output_via_api.py, all data from the setting context is None #1484

Open
pzw943969386 opened this issue Sep 24, 2024 · 3 comments

Comments

@pzw943969386
Copy link

I reinstalled the metagpt package using git and modified the log function to obtain streaming output.
However, I am currently unable to retrieve any data,
stream_pipe = stream_pipe_var.get(None)
always returns None, even though the context has been set.
When I used the metagpt package installed in June, I was able to get streaming data.

@pzw943969386
Copy link
Author

I am using the current version of metagpt and running the stream_output_via_api.py file. However, the streaming data obtained through the log settings is all None.

@seehi
Copy link
Contributor

seehi commented Sep 24, 2024

Using the main branch, the output of stream_output_via_api.py is normal.

 curl http://127.0.1.1:7860/v1/chat/completions -X POST -H "Content-Type: application/json" -d '{"model": "write_tutorial","stream": true,"messages": [{"role": "user","content": "Write a tutorial about MySQL"}]}'

@pzw943969386
Copy link
Author

pzw943969386 commented Sep 24, 2024

def stream_pipe_log(content):
    print(content, end="")
    stream_pipe = stream_pipe_var.get(None)
    if stream_pipe:
        print(f'{content=}')
        stream_pipe.set_message(content)

Hello, thank you for your response. If you log within this method, you'll notice that the content is empty, and I am unable to retrieve any streaming data. However, in the version I installed via Git in June, there was data output.

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

2 participants