Properly return a client in with_client
This commit is contained in:
parent
3f894c493d
commit
c219158c62
1 changed files with 2 additions and 3 deletions
|
@ -194,7 +194,7 @@ class OllamaClient:
|
||||||
def with_client(
|
def with_client(
|
||||||
self,
|
self,
|
||||||
timeout: httpx.Timeout | float | int | None = None
|
timeout: httpx.Timeout | float | int | None = None
|
||||||
) -> contextlib.AbstractContextManager[httpx.AsyncClient]:
|
) -> httpx.AsyncClient:
|
||||||
"""
|
"""
|
||||||
Creates an instance for a request, with properly populated values.
|
Creates an instance for a request, with properly populated values.
|
||||||
:param timeout:
|
:param timeout:
|
||||||
|
@ -206,8 +206,7 @@ class OllamaClient:
|
||||||
timeout = httpx.Timeout(timeout)
|
timeout = httpx.Timeout(timeout)
|
||||||
else:
|
else:
|
||||||
timeout = timeout or httpx.Timeout(60)
|
timeout = timeout or httpx.Timeout(60)
|
||||||
async with httpx.AsyncClient(base_url=self.base_url, timeout=timeout, auth=self.authorisation) as client:
|
return httpx.AsyncClient(base_url=self.base_url, timeout=timeout, auth=self.authorisation)
|
||||||
yield client
|
|
||||||
|
|
||||||
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