From a98ff295765ce4a9dc157309df763d16ce28aa2b Mon Sep 17 00:00:00 2001 From: "jeongsu.an" Date: Sun, 27 Oct 2024 23:10:13 +0900 Subject: [PATCH] fix(client/async): replace asyncify with asyncio.to_thread (#1827) --- pyproject.toml | 2 +- src/openai/_base_client.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 3bd6246e43..ea4d6c1e4f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -150,7 +150,7 @@ filterwarnings = [ # there are a couple of flags that are still disabled by # default in strict mode as they are experimental and niche. typeCheckingMode = "strict" -pythonVersion = "3.7" +pythonVersion = "3.9.18" exclude = [ "_dev", diff --git a/src/openai/_base_client.py b/src/openai/_base_client.py index e1d4849ae2..7a9e239bb7 100644 --- a/src/openai/_base_client.py +++ b/src/openai/_base_client.py @@ -62,7 +62,7 @@ HttpxRequestFiles, ModelBuilderProtocol, ) -from ._utils import is_dict, is_list, asyncify, is_given, lru_cache, is_mapping +from ._utils import is_dict, is_list, is_given, lru_cache, is_mapping from ._compat import model_copy, model_dump from ._models import GenericModel, FinalRequestOptions, validate_type, construct_type from ._response import ( @@ -1549,7 +1549,7 @@ async def _request( if self._platform is None: # `get_platform` can make blocking IO calls so we # execute it earlier while we are in an async context - self._platform = await asyncify(get_platform)() + self._platform = await asyncio.to_thread(get_platform) # create a copy of the options we were given so that if the # options are mutated later & we then retry, the retries are