Update openai_api.py

This commit is contained in:
better629 2024-03-15 15:19:18 +08:00 committed by GitHub
parent 3f12954e55
commit ba1866f7ca
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)