This commit is contained in:
Pawan Singh Kapkoti 2026-04-05 16:41:39 +01:00 committed by GitHub
commit c718975812
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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,