matthoffner
commited on
Commit
•
40717b9
1
Parent(s):
e6bf24c
Update main.py
Browse files
main.py
CHANGED
@@ -35,8 +35,8 @@ async def chat(request: ChatCompletionRequest, response_mode=None):
|
|
35 |
tokens = llm.tokenize(request.prompt)
|
36 |
async def server_sent_events(chat_chunks, llm):
|
37 |
for chat_chunk in llm.generate(chat_chunks):
|
38 |
-
yield llm.detokenize(chat_chunk)
|
39 |
-
yield ""
|
40 |
|
41 |
return EventSourceResponse(server_sent_events(tokens, llm))
|
42 |
|
|
|
35 |
tokens = llm.tokenize(request.prompt)
|
36 |
async def server_sent_events(chat_chunks, llm):
|
37 |
for chat_chunk in llm.generate(chat_chunks):
|
38 |
+
yield dict(data=json.dumps(llm.detokenize(chat_chunk))
|
39 |
+
yield dict(data="[DONE]")
|
40 |
|
41 |
return EventSourceResponse(server_sent_events(tokens, llm))
|
42 |
|