mirror of
https://github.com/hwchase17/langchain.git
synced 2025-05-16 20:42:01 +00:00
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:
parent
d93ae756e6
commit
b0aa915dea
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user