Properly return a client in with_client

This commit is contained in:
Nexus 2024-04-14 18:34:04 +01:00
parent 3f894c493d
commit c219158c62
Signed by: nex
GPG key ID: 0FA334385D0B689F

View file

@ -194,7 +194,7 @@ class OllamaClient:
def with_client(
self,
timeout: httpx.Timeout | float | int | None = None
) -> contextlib.AbstractContextManager[httpx.AsyncClient]:
) -> httpx.AsyncClient:
"""
Creates an instance for a request, with properly populated values.
:param timeout:
@ -206,8 +206,7 @@ class OllamaClient:
timeout = httpx.Timeout(timeout)
else:
timeout = timeout or httpx.Timeout(60)
async with httpx.AsyncClient(base_url=self.base_url, timeout=timeout, auth=self.authorisation) as client:
yield client
return httpx.AsyncClient(base_url=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]]]:
"""