Merge pull request #781 from clalanliu/main

fix: fix bug for the case --model is not specified
This commit is contained in:
Ishaan Jaff 2023-11-08 08:26:32 -08:00 committed by GitHub
commit 8cedacfa2d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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"])