mirror of
https://github.com/ollama/ollama-python.git
synced 2026-01-13 21:57:16 +08:00
add AbstractAsyncContextManager to BaseClient
This commit is contained in:
parent
fdb18c9c92
commit
8ac47707d8
@ -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()
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user