From 0d748b5e20697901061500a8b2488a77ea34ab1c Mon Sep 17 00:00:00 2001 From: James Tsang Date: Fri, 13 Oct 2023 14:46:50 -0500 Subject: [PATCH] fix: be compatible with custom model without full response (#222) Co-authored-by: Qingyun Wu --- autogen/oai/completion.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autogen/oai/completion.py b/autogen/oai/completion.py index f3ea897de6b..54739ec5d2f 100644 --- a/autogen/oai/completion.py +++ b/autogen/oai/completion.py @@ -1026,7 +1026,7 @@ def cost(cls, response: dict): 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}")