fix repeated api call bug

This commit is contained in:
yzlin 2024-03-15 15:30:42 +08:00
parent 83fb239bb7
commit 0271cd7f77

View file

@ -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)