mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-10-01 01:26:03 -04:00
Update 12 - OpenAI API.md
This commit is contained in:
parent
b0b999dd68
commit
55dc9845cb
@ -174,11 +174,15 @@ while True:
|
||||
stream_response = requests.post(url, headers=headers, json=data, verify=False, stream=True)
|
||||
client = sseclient.SSEClient(stream_response)
|
||||
|
||||
assistant_message = ''
|
||||
for event in client.events():
|
||||
payload = json.loads(event.data)
|
||||
print(payload['choices'][0]['message']['content'], end='')
|
||||
chunk = payload['choices'][0]['message']['content']
|
||||
assistant_message += chunk
|
||||
print(chunk, end='')
|
||||
|
||||
print()
|
||||
history.append({"role": "assistant", "content": assistant_message})
|
||||
```
|
||||
|
||||
#### Python completions example with streaming
|
||||
|
Loading…
Reference in New Issue
Block a user