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(
|
||||
self,
|
||||
timeout: httpx.Timeout | float | int | None = None
|
||||
) -> httpx.AsyncClient:
|
||||
timeout: aiohttp.ClientTimeout | float | int | None = None
|
||||
) -> aiohttp.ClientSession:
|
||||
"""
|
||||
Creates an instance for a request, with properly populated values.
|
||||
:param timeout:
|
||||
|
@ -202,11 +202,11 @@ class OllamaClient:
|
|||
"""
|
||||
if isinstance(timeout, (float, int)):
|
||||
if timeout == -1:
|
||||
timeout = None
|
||||
timeout = httpx.Timeout(timeout)
|
||||
timeout = 10800
|
||||
timeout = aiohttp.ClientTimeout(timeout)
|
||||
else:
|
||||
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]]]:
|
||||
"""
|
||||
|
|
Loading…
Reference in a new issue