add AbstractAsyncContextManager to BaseClient

This commit is contained in:
ParthSareen 2025-02-18 15:48:39 -08:00
parent fdb18c9c92
commit 8ac47707d8

View File

@ -76,7 +76,7 @@ from ollama._types import (
T = TypeVar('T')
class BaseClient(contextlib.AbstractContextManager):
class BaseClient(contextlib.AbstractContextManager, contextlib.AbstractAsyncContextManager):
def __init__(
self,
client,
@ -120,9 +120,6 @@ class BaseClient(contextlib.AbstractContextManager):
def __exit__(self, exc_type, exc_val, exc_tb):
self.close()
async def __aenter__(self) -> Any:
return self
async def __aexit__(self, exc_type, exc_val, exc_tb):
await self.close()