mirror of
https://github.com/ollama/ollama-python.git
synced 2026-05-01 11:48:17 +08:00
Merge b82953af44 into dbccf192ac
This commit is contained in:
commit
c718975812
@ -664,6 +664,16 @@ class Client(BaseClient):
|
||||
).model_dump(exclude_none=True),
|
||||
)
|
||||
|
||||
|
||||
def exists(self, model: str) -> bool:
|
||||
"""Check if a model is available locally."""
|
||||
try:
|
||||
self.show(model)
|
||||
return True
|
||||
except ResponseError:
|
||||
return False
|
||||
|
||||
|
||||
def ps(self) -> ProcessResponse:
|
||||
return self._request(
|
||||
ProcessResponse,
|
||||
@ -1305,6 +1315,16 @@ class AsyncClient(BaseClient):
|
||||
).model_dump(exclude_none=True),
|
||||
)
|
||||
|
||||
|
||||
async def exists(self, model: str) -> bool:
|
||||
"""Check if a model is available locally."""
|
||||
try:
|
||||
await self.show(model)
|
||||
return True
|
||||
except ResponseError:
|
||||
return False
|
||||
|
||||
|
||||
async def ps(self) -> ProcessResponse:
|
||||
return await self._request(
|
||||
ProcessResponse,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user