Merge pull request #1012 from garylin2099/di_fixes

fix repeated api call bug
This commit is contained in:
garylin2099 2024-03-15 15:33:05 +08:00 committed by GitHub
commit 7b06268f24
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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)