mirror of
https://github.com/ollama/ollama-python.git
synced 2026-05-01 11:48:17 +08:00
parent
14d7f8c1b7
commit
d5316d023a
@ -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:
|
||||
"""
|
||||
|
||||
Loading…
Reference in New Issue
Block a user