From 25679346dc4c5670d8683c5e84bf95aaf22cf42e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E9=87=91=E6=B7=8B?= Date: Fri, 18 Oct 2024 10:01:44 +0000 Subject: [PATCH] Update openai_api.py --- metagpt/provider/openai_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metagpt/provider/openai_api.py b/metagpt/provider/openai_api.py index 11b1d38cb..8cb503572 100644 --- a/metagpt/provider/openai_api.py +++ b/metagpt/provider/openai_api.py @@ -103,7 +103,7 @@ class OpenAILLM(BaseLLM): if finish_reason: if hasattr(chunk, "usage"): # Some services have usage as an attribute of the chunk, such as Fireworks - usage = CompletionUsage(**chunk.usage) + usage = CompletionUsage(**chunk.usage) if isinstance(chunk.usage, dict) else chunk.usage elif hasattr(chunk.choices[0], "usage"): # The usage of some services is an attribute of chunk.choices[0], such as Moonshot usage = CompletionUsage(**chunk.choices[0].usage)