mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-05-15 11:02:36 +02:00
Merge branch 'betterwang-mgx_ops-patch-18744' into 'mgx_ops'
update openai_api.py See merge request pub/MetaGPT!401
This commit is contained in:
commit
6879c93080
1 changed files with 1 additions and 1 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue