mirror of
https://github.com/ollama/ollama-python.git
synced 2026-05-03 04:42:42 +00:00
@@ -125,6 +125,12 @@ ollama.push('user/llama3')
|
||||
ollama.embeddings(model='llama3', prompt='The sky is blue because of rayleigh scattering')
|
||||
```
|
||||
|
||||
### Ps
|
||||
|
||||
```python
|
||||
ollama.ps()
|
||||
```
|
||||
|
||||
## Custom client
|
||||
|
||||
A custom client can be created with the following fields:
|
||||
|
||||
@@ -29,6 +29,7 @@ __all__ = [
|
||||
'list',
|
||||
'copy',
|
||||
'show',
|
||||
'ps',
|
||||
]
|
||||
|
||||
_client = Client()
|
||||
@@ -43,3 +44,4 @@ delete = _client.delete
|
||||
list = _client.list
|
||||
copy = _client.copy
|
||||
show = _client.show
|
||||
ps = _client.ps
|
||||
|
||||
@@ -336,6 +336,9 @@ class Client(BaseClient):
|
||||
def show(self, model: str) -> Mapping[str, Any]:
|
||||
return self._request('POST', '/api/show', json={'name': model}).json()
|
||||
|
||||
def ps(self) -> Mapping[str, Any]:
|
||||
return self._request('GET', '/api/ps').json()
|
||||
|
||||
|
||||
class AsyncClient(BaseClient):
|
||||
def __init__(self, host: Optional[str] = None, **kwargs) -> None:
|
||||
@@ -629,6 +632,10 @@ class AsyncClient(BaseClient):
|
||||
response = await self._request('POST', '/api/show', json={'name': model})
|
||||
return response.json()
|
||||
|
||||
async def ps(self) -> Mapping[str, Any]:
|
||||
response = await self._request('GET', '/api/ps')
|
||||
return response.json()
|
||||
|
||||
|
||||
def _encode_image(image) -> str:
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user