matthoffner commited on
Commit
cb09a6f
1 Parent(s): 406422f

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +2 -2
main.py CHANGED
@@ -88,10 +88,10 @@ async def chat(request: ChatCompletionRequest):
88
  yield f"data: {json.dumps(response)}\n\n"
89
  yield "event: done\ndata: {}\n\n"
90
 
91
- return StreamingResponse(format_response(chat_chunks), media_type="text/event-stream")
92
 
93
  @app.post("/v0/chat/completions")
94
- async def chat(request: ChatCompletionRequest, response_mode=None):
95
  kwargs = request.dict()
96
  dialogue_template = DialogueTemplate(
97
  system=system_message, messages=kwargs['messages']
 
88
  yield f"data: {json.dumps(response)}\n\n"
89
  yield "event: done\ndata: {}\n\n"
90
 
91
+ return EventSourceResponse(format_response(chat_chunks), media_type="text/event-stream")
92
 
93
  @app.post("/v0/chat/completions")
94
+ async def chatV0(request: ChatCompletionRequest, response_mode=None):
95
  kwargs = request.dict()
96
  dialogue_template = DialogueTemplate(
97
  system=system_message, messages=kwargs['messages']