mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-06-08 15:05:17 +02:00
fix empty choices error when using azure
This commit is contained in:
parent
a585ef52a6
commit
19c0db8821
1 changed files with 3 additions and 1 deletions
|
|
@ -87,7 +87,9 @@ class OpenAILLM(BaseLLM):
|
|||
collected_messages = []
|
||||
async for chunk in response:
|
||||
chunk_message = chunk.choices[0].delta.content or "" if chunk.choices else "" # extract the message
|
||||
finish_reason = chunk.choices[0].finish_reason if hasattr(chunk.choices[0], "finish_reason") else None
|
||||
finish_reason = (
|
||||
chunk.choices[0].finish_reason if chunk.choices and hasattr(chunk.choices[0], "finish_reason") else None
|
||||
)
|
||||
log_llm_stream(chunk_message)
|
||||
collected_messages.append(chunk_message)
|
||||
if finish_reason:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue