community[patch]: use asyncio.sleep instead of sleep in OpenAI Assistant async (#24275)

**Description:** Implemented async sleep using asyncio instead of
synchronous sleep in openAI Assistants
**Issue:** 24194
**Dependencies:** asyncio
**Twitter handle:** pietromald60939
This commit is contained in:
pm390 2024-07-15 20:14:39 +02:00 committed by GitHub
parent d93ae756e6
commit b0aa915dea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,5 +1,6 @@
from __future__ import annotations
import asyncio
import json
from json import JSONDecodeError
from time import sleep
@ -742,5 +743,5 @@ class OpenAIAssistantRunnable(RunnableSerializable[Dict, OutputType]):
)
in_progress = run.status in ("in_progress", "queued")
if in_progress:
sleep(self.check_every_ms / 1000)
await asyncio.sleep(self.check_every_ms / 1000)
return run