🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming
fix empty choices error when using azure
yzlin19c0db882189
diff --git a/metagpt/provider/openai_api.py b/metagpt/provider/openai_api.pyindex 2126505c7..8f3b71c42 100644--- a/metagpt/provider/openai_api.py+++ b/metagpt/provider/openai_api.py@@ -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: