Skip to content

🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming

fix repeated api call bug

yzlin0271cd7f7715
diff --git a/metagpt/provider/openai_api.py b/metagpt/provider/openai_api.py
index 8f3b71c42..e99707ab9 100644
--- a/metagpt/provider/openai_api.py
+++ b/metagpt/provider/openai_api.py
@@ -142,7 +142,7 @@ class OpenAILLM(BaseLLM):
async def acompletion_text(self, messages: list[dict], stream=False, timeout=3) -> str:
"""when streaming, print each token in place."""
if stream:
- await self._achat_completion_stream(messages, timeout=timeout)
+ return await self._achat_completion_stream(messages, timeout=timeout)
rsp = await self._achat_completion(messages, timeout=timeout)
return self.get_choice_text(rsp)