Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

metagpt/provider/openai_api.py 94行存在bug #1738

Open
moseshu opened this issue Mar 4, 2025 · 0 comments
Open

metagpt/provider/openai_api.py 94行存在bug #1738

moseshu opened this issue Mar 4, 2025 · 0 comments

Comments

@moseshu
Copy link

moseshu commented Mar 4, 2025

if hasattr(chunk, "usage"):
# Some services have usage as an attribute of the chunk, such as Fireworks
    usage = CompletionUsage(**chunk.usage)
usage会出现None的情况
最好加上
if chunk.usage:
   usage = CompletionUsage(**chunk.usage)

日志
ChatCompletionChunk(id='chatcmpl-B7OpXSFxuj3RCEYCnFslLUchlZDiJ', choices=[Choice(delta=ChoiceDelta(content=None, function_call=None, refusal=None, role=None, tool_calls=None), finish_reason='stop', index=0, logprobs=None)], created=1741103443, model='gpt-4-0613', object='chat.completion.chunk', service_tier='default', system_fingerprint=None, usage=None)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant