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