Skip to content

Commit 5d90aff

Browse files
committed
Update documentation
1 parent b3756d0 commit 5d90aff

File tree

2 files changed

+50
-1
lines changed

2 files changed

+50
-1
lines changed

README.md

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,16 @@ result = api.generate_chat_completion(messages=messages, options=dict(num_tokens
6969
print(result.message)
7070
```
7171

72+
73+
### Embeddings Endpoint
74+
#### Generate Embeddings
75+
```python
76+
from ollama_python.endpoints import EmbeddingAPI
77+
78+
api = EmbeddingAPI(base_url="http://localhost:8000", model="mistral")
79+
result = api.get_embedding(prompt="Hello World", options=dict(seed=10))
80+
```
81+
7282
### Model Management Endpoints
7383
#### Create a model
7484
##### Without Streaming
@@ -139,9 +149,47 @@ api = ModelManagementAPI(base_url="http://localhost:8000")
139149
api.delete(name="mistral_copy")
140150
```
141151

152+
### Pull a model
153+
##### Without Streaming
154+
```python
155+
from ollama_python.endpoints import ModelManagementAPI
156+
157+
api = ModelManagementAPI(base_url="http://localhost:8000")
158+
result = api.pull(name="mistral")
159+
print(result.status)
160+
```
161+
162+
##### With Streaming
163+
```python
164+
from ollama_python.endpoints import ModelManagementAPI
165+
166+
api = ModelManagementAPI(base_url="http://localhost:8000")
167+
for res in api.pull(name="mistral", stream=True):
168+
print(res.status)
169+
```
170+
171+
### Push a model
172+
##### Without Streaming
173+
```python
174+
from ollama_python.endpoints import ModelManagementAPI
175+
176+
api = ModelManagementAPI(base_url="http://localhost:8000")
177+
result = api.push(name="mistral")
178+
print(result.status)
179+
```
180+
181+
##### With Streaming
182+
```python
183+
from ollama_python.endpoints import ModelManagementAPI
184+
185+
api = ModelManagementAPI(base_url="http://localhost:8000")
186+
for res in api.push(name="mistral", stream=True):
187+
print(res.status)
188+
```
189+
142190

143191

144-
### Valid Options
192+
### Valid Options/Parameters
145193

146194
| Parameter | Description | Value Type | Example Usage |
147195
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- | -------------------- |

ollama_python/endpoints/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
from ollama_python.endpoints.generate import GenerateAPI # noqa
22
from ollama_python.endpoints.model_management import ModelManagementAPI # noqa
3+
from ollama_python.endpoints.embedding import EmbeddingAPI # noqa

0 commit comments

Comments
 (0)