fix: be compatible with custom model without full response (#222)

Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
This commit is contained in:
James Tsang 2023-10-13 14:46:50 -05:00 committed by GitHub
parent 04319c968a
commit 3eda9ed74d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -1026,7 +1026,7 @@ class Completion(openai_Completion):
Returns:
The cost in USD. 0 if the model is not supported.
"""
model = response["model"]
model = response.get("model")
if model not in cls.price1K:
return 0
# raise ValueError(f"Unknown model: {model}")