diff --git a/ollama/_client.py b/ollama/_client.py index 18cb0fb4..bf2c7681 100644 --- a/ollama/_client.py +++ b/ollama/_client.py @@ -117,9 +117,15 @@ def __init__( **kwargs, ) + def __enter__(self): + return self + def __exit__(self, exc_type, exc_val, exc_tb): self.close() + async def __aenter__(self): + return self + async def __aexit__(self, exc_type, exc_val, exc_tb): await self.close()