Use clientsession instead of httpx
This commit is contained in:
parent
ec89cc95b9
commit
38bc54d37f
1 changed files with 5 additions and 5 deletions
|
@ -193,8 +193,8 @@ class OllamaClient:
|
||||||
|
|
||||||
def with_client(
|
def with_client(
|
||||||
self,
|
self,
|
||||||
timeout: httpx.Timeout | float | int | None = None
|
timeout: aiohttp.ClientTimeout | float | int | None = None
|
||||||
) -> httpx.AsyncClient:
|
) -> aiohttp.ClientSession:
|
||||||
"""
|
"""
|
||||||
Creates an instance for a request, with properly populated values.
|
Creates an instance for a request, with properly populated values.
|
||||||
:param timeout:
|
:param timeout:
|
||||||
|
@ -202,11 +202,11 @@ class OllamaClient:
|
||||||
"""
|
"""
|
||||||
if isinstance(timeout, (float, int)):
|
if isinstance(timeout, (float, int)):
|
||||||
if timeout == -1:
|
if timeout == -1:
|
||||||
timeout = None
|
timeout = 10800
|
||||||
timeout = httpx.Timeout(timeout)
|
timeout = aiohttp.ClientTimeout(timeout)
|
||||||
else:
|
else:
|
||||||
timeout = timeout or httpx.Timeout(60)
|
timeout = timeout or httpx.Timeout(60)
|
||||||
return httpx.AsyncClient(base_url=self.base_url, timeout=timeout, auth=self.authorisation)
|
return aiohttp.ClientSession(self.base_url, timeout=timeout, auth=self.authorisation)
|
||||||
|
|
||||||
async def get_tags(self) -> dict[typing.Literal["models"], dict[str, str, int, dict[str, str, None]]]:
|
async def get_tags(self) -> dict[typing.Literal["models"], dict[str, str, int, dict[str, str, None]]]:
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in a new issue