even more demo cleanup, making run_llm play well with asyncio

This commit is contained in:
Moishe Lettvin
2024-01-04 18:14:28 -05:00
parent cd2c9700ad
commit 5b4c085cd2
3 changed files with 15 additions and 4 deletions

View File

@@ -84,7 +84,7 @@ class AzureLLMService(LLMService):
messages_for_log = json.dumps(messages)
self.logger.debug(f"Generating chat via azure: {messages_for_log}")
response = self.get_response(messages, stream=False)
response = await asyncio.to_thread(self.get_response, messages, False)
if response and len(response.choices) > 0:
return response.choices[0].message.content
else: