diff --git a/packages/openassistants/openassistants/core/assistant.py b/packages/openassistants/openassistants/core/assistant.py index ed3f4e3..0dd37c2 100644 --- a/packages/openassistants/openassistants/core/assistant.py +++ b/packages/openassistants/openassistants/core/assistant.py @@ -348,11 +348,13 @@ async def convert_list_message(self, messages, message, idx): ) async def pre_process_messages(self, messages): - for idx, message in enumerate(messages): - if isinstance(message, OpasUserMessage) and isinstance( - message.content, list - ): - self.convert_list_message(messages, message, idx) + tasks = [ + self.convert_list_message(messages, message, idx) + for idx, message in enumerate(messages) + if isinstance(message, OpasUserMessage) + and isinstance(message.content, list) + ] + await asyncio.gather(*tasks) return messages async def run_chat(