support minicpm #2404

Former-commit-id: 4449e91cbee8fd804cf8bf1ff6b9f5301fde94ed
This commit is contained in:
hiyouga
2024-02-03 22:36:46 +08:00
parent 5fb21f6e54
commit bcd76d2c7a
3 changed files with 17 additions and 7 deletions

View File

@@ -120,6 +120,9 @@ def create_app(chat_model: "ChatModel") -> "FastAPI":
def chat_completion(messages: Sequence[Dict[str, str]], system: str, tools: str, request: ChatCompletionRequest):
if request.stream:
if tools:
raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST, detail="Cannot stream function calls.")
generate = stream_chat_completion(messages, system, tools, request)
return EventSourceResponse(generate, media_type="text/event-stream")