fix: fix bug for the case --model is not specified

This commit is contained in:
Alan Liu 2023-11-08 23:57:24 +08:00
parent 3239ec80c9
commit 6c17ab6e75

View file

@ -106,11 +106,8 @@ async def chat_completion(request: Request, model: Optional[str] = None):
try:
data = await request.json()
print(f"data: {data}")
data["model"] = (
server_settings.get("completion_model", None) # server default
or model # model passed in url
or data["model"] # default passed in
)
server_model = server_settings.get("completion_model", None) if server_settings else None
data["model"] = server_model or model or data["model"]
## CHECK KEYS ##
# default to always using the "ENV" variables, only if AUTH_STRATEGY==DYNAMIC then reads headers
# env_validation = litellm.validate_environment(model=data["model"])