small fix on examples/python-simplechat/client.py to actually get a streamed response and get tokens printed as we receive it (#4671)

This commit is contained in:
Rayan Mostovoi 2024-05-28 02:19:20 +02:00 committed by GitHub
parent c79f8c9c39
commit 8a8e7afa96
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -9,6 +9,7 @@ def chat(messages):
r = requests.post( r = requests.post(
"http://0.0.0.0:11434/api/chat", "http://0.0.0.0:11434/api/chat",
json={"model": model, "messages": messages, "stream": True}, json={"model": model, "messages": messages, "stream": True},
stream=True
) )
r.raise_for_status() r.raise_for_status()
output = "" output = ""