@@ -69,6 +69,16 @@ result = api.generate_chat_completion(messages=messages, options=dict(num_tokens
69
69
print (result.message)
70
70
```
71
71
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
+
72
82
### Model Management Endpoints
73
83
#### Create a model
74
84
##### Without Streaming
@@ -139,9 +149,47 @@ api = ModelManagementAPI(base_url="http://localhost:8000")
139
149
api.delete(name = " mistral_copy" )
140
150
```
141
151
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
+
142
190
143
191
144
- ### Valid Options
192
+ ### Valid Options/Parameters
145
193
146
194
| Parameter | Description | Value Type | Example Usage |
147
195
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- | -------------------- |
0 commit comments