mirror of
https://github.com/hwchase17/langchain.git
synced 2025-05-17 04:52:00 +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
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import asyncio
|
||||||
import json
|
import json
|
||||||
from json import JSONDecodeError
|
from json import JSONDecodeError
|
||||||
from time import sleep
|
from time import sleep
|
||||||
@ -742,5 +743,5 @@ class OpenAIAssistantRunnable(RunnableSerializable[Dict, OutputType]):
|
|||||||
)
|
)
|
||||||
in_progress = run.status in ("in_progress", "queued")
|
in_progress = run.status in ("in_progress", "queued")
|
||||||
if in_progress:
|
if in_progress:
|
||||||
sleep(self.check_every_ms / 1000)
|
await asyncio.sleep(self.check_every_ms / 1000)
|
||||||
return run
|
return run
|
||||||
|
Loading…
Reference in New Issue
Block a user