|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>Plugin_AI_Ollama.OllamaInterface.OllamaClient</title> |
|
4 <meta charset="UTF-8"> |
|
5 <link rel="stylesheet" href="styles.css"> |
|
6 </head> |
|
7 <body> |
|
8 <a NAME="top" ID="top"></a> |
|
9 <h1>Plugin_AI_Ollama.OllamaInterface.OllamaClient</h1> |
|
10 <p> |
|
11 Module implementing the 'ollama' client. |
|
12 </p> |
|
13 |
|
14 <h3>Global Attributes</h3> |
|
15 <table> |
|
16 <tr><td>None</td></tr> |
|
17 </table> |
|
18 |
|
19 <h3>Classes</h3> |
|
20 <table> |
|
21 <tr> |
|
22 <td><a href="#OllamaClient">OllamaClient</a></td> |
|
23 <td>Class implementing the 'ollama' client.</td> |
|
24 </tr> |
|
25 <tr> |
|
26 <td><a href="#OllamaClientState">OllamaClientState</a></td> |
|
27 <td>Class defining the various client states.</td> |
|
28 </tr> |
|
29 </table> |
|
30 |
|
31 <h3>Functions</h3> |
|
32 <table> |
|
33 <tr><td>None</td></tr> |
|
34 </table> |
|
35 |
|
36 <hr /> |
|
37 <hr /> |
|
38 <a NAME="OllamaClient" ID="OllamaClient"></a> |
|
39 <h2>OllamaClient</h2> |
|
40 <p> |
|
41 Class implementing the 'ollama' client. |
|
42 </p> |
|
43 |
|
44 <h3>Signals</h3> |
|
45 <dl> |
|
46 |
|
47 <dt>errorOccurred(error:str)</dt> |
|
48 <dd> |
|
49 emitted to indicate a network error occurred |
|
50 while processing the request |
|
51 </dd> |
|
52 <dt>finished()</dt> |
|
53 <dd> |
|
54 emitted to indicate the completion of a request |
|
55 </dd> |
|
56 <dt>modelsList(modelNames:list[str])</dt> |
|
57 <dd> |
|
58 emitted after the list of model |
|
59 names was obtained from the 'ollama' server |
|
60 </dd> |
|
61 <dt>pullError(msg:str)</dt> |
|
62 <dd> |
|
63 emitted to indicate an error during a pull operation |
|
64 </dd> |
|
65 <dt>pullStatus(msg:str, id:str, total:int, completed:int)</dt> |
|
66 <dd> |
|
67 emitted to indicate |
|
68 the status of a pull request as reported by the 'ollama' server |
|
69 </dd> |
|
70 <dt>replyReceived(content:str, role:str, done:bool)</dt> |
|
71 <dd> |
|
72 emitted after a response |
|
73 from the 'ollama' server was received |
|
74 </dd> |
|
75 <dt>serverStateChanged(ok:bool, msg:str)</dt> |
|
76 <dd> |
|
77 emitted to indicate a change of the |
|
78 server responsiveness |
|
79 </dd> |
|
80 <dt>serverVersion(version:str)</dt> |
|
81 <dd> |
|
82 emitted after the server version was obtained |
|
83 from the 'ollama' server |
|
84 </dd> |
|
85 </dl> |
|
86 <h3>Derived from</h3> |
|
87 QObject |
|
88 <h3>Class Attributes</h3> |
|
89 <table> |
|
90 <tr><td>None</td></tr> |
|
91 </table> |
|
92 |
|
93 <h3>Class Methods</h3> |
|
94 <table> |
|
95 <tr><td>None</td></tr> |
|
96 </table> |
|
97 |
|
98 <h3>Methods</h3> |
|
99 <table> |
|
100 <tr> |
|
101 <td><a href="#OllamaClient.__init__">OllamaClient</a></td> |
|
102 <td>Constructor</td> |
|
103 </tr> |
|
104 <tr> |
|
105 <td><a href="#OllamaClient.__errorOccurred">__errorOccurred</a></td> |
|
106 <td>Private method to handle a network error of the given reply.</td> |
|
107 </tr> |
|
108 <tr> |
|
109 <td><a href="#OllamaClient.__getHeartbeatUrl">__getHeartbeatUrl</a></td> |
|
110 <td>Private method to get the current heartbeat URL.</td> |
|
111 </tr> |
|
112 <tr> |
|
113 <td><a href="#OllamaClient.__getServerReply">__getServerReply</a></td> |
|
114 <td>Private method to send a request to the 'ollama' server and return a reply object.</td> |
|
115 </tr> |
|
116 <tr> |
|
117 <td><a href="#OllamaClient.__periodicHeartbeat">__periodicHeartbeat</a></td> |
|
118 <td>Private slot to do a periodic check of the 'ollama' server responsiveness.</td> |
|
119 </tr> |
|
120 <tr> |
|
121 <td><a href="#OllamaClient.__processChatResponse">__processChatResponse</a></td> |
|
122 <td>Private method to process the chat response of the 'ollama' server.</td> |
|
123 </tr> |
|
124 <tr> |
|
125 <td><a href="#OllamaClient.__processData">__processData</a></td> |
|
126 <td>Private method to receive data from the 'ollama' server and process it with a given processing function or method.</td> |
|
127 </tr> |
|
128 <tr> |
|
129 <td><a href="#OllamaClient.__processGenerateResponse">__processGenerateResponse</a></td> |
|
130 <td>Private method to process the generate response of the 'ollama' server.</td> |
|
131 </tr> |
|
132 <tr> |
|
133 <td><a href="#OllamaClient.__processModelsList">__processModelsList</a></td> |
|
134 <td>Private method to process the tags response of the 'ollama' server.</td> |
|
135 </tr> |
|
136 <tr> |
|
137 <td><a href="#OllamaClient.__processPullResponse">__processPullResponse</a></td> |
|
138 <td>Private method to process a pull response of the 'ollama' server.</td> |
|
139 </tr> |
|
140 <tr> |
|
141 <td><a href="#OllamaClient.__processVersion">__processVersion</a></td> |
|
142 <td>Private method to process the version response of the 'ollama' server.</td> |
|
143 </tr> |
|
144 <tr> |
|
145 <td><a href="#OllamaClient.__replyFinished">__replyFinished</a></td> |
|
146 <td>Private method to handle the finished signal of the reply.</td> |
|
147 </tr> |
|
148 <tr> |
|
149 <td><a href="#OllamaClient.__sendRequest">__sendRequest</a></td> |
|
150 <td>Private method to send a request to the 'ollama' server and handle its responses.</td> |
|
151 </tr> |
|
152 <tr> |
|
153 <td><a href="#OllamaClient.__sendSyncRequest">__sendSyncRequest</a></td> |
|
154 <td>Private method to send a request to the 'ollama' server and handle its responses.</td> |
|
155 </tr> |
|
156 <tr> |
|
157 <td><a href="#OllamaClient.__serverNotRespondingMessage">__serverNotRespondingMessage</a></td> |
|
158 <td>Private method to assemble and return a message for a non-responsive server.</td> |
|
159 </tr> |
|
160 <tr> |
|
161 <td><a href="#OllamaClient.__setHeartbeatTimer">__setHeartbeatTimer</a></td> |
|
162 <td>Private slot to configure the heartbeat timer.</td> |
|
163 </tr> |
|
164 <tr> |
|
165 <td><a href="#OllamaClient.abortPull">abortPull</a></td> |
|
166 <td>Public method to abort an ongoing pull operation.</td> |
|
167 </tr> |
|
168 <tr> |
|
169 <td><a href="#OllamaClient.chat">chat</a></td> |
|
170 <td>Public method to request a chat completion from the 'ollama' server.</td> |
|
171 </tr> |
|
172 <tr> |
|
173 <td><a href="#OllamaClient.generate">generate</a></td> |
|
174 <td>Public method to request to generate a completion from the 'ollama' server.</td> |
|
175 </tr> |
|
176 <tr> |
|
177 <td><a href="#OllamaClient.heartbeat">heartbeat</a></td> |
|
178 <td>Public method to check, if the 'ollama' server has started and is responsive.</td> |
|
179 </tr> |
|
180 <tr> |
|
181 <td><a href="#OllamaClient.list">list</a></td> |
|
182 <td>Public method to request a list of models available locally from the 'ollama' server.</td> |
|
183 </tr> |
|
184 <tr> |
|
185 <td><a href="#OllamaClient.listDetails">listDetails</a></td> |
|
186 <td>Public method to request a list of models available locally from the 'ollama' server with some model details.</td> |
|
187 </tr> |
|
188 <tr> |
|
189 <td><a href="#OllamaClient.listRunning">listRunning</a></td> |
|
190 <td>Public method to request a list of running models from the 'ollama' server.</td> |
|
191 </tr> |
|
192 <tr> |
|
193 <td><a href="#OllamaClient.pull">pull</a></td> |
|
194 <td>Public method to ask the 'ollama' server to pull the given model.</td> |
|
195 </tr> |
|
196 <tr> |
|
197 <td><a href="#OllamaClient.remove">remove</a></td> |
|
198 <td>Public method to ask the 'ollama' server to delete the given model.</td> |
|
199 </tr> |
|
200 <tr> |
|
201 <td><a href="#OllamaClient.setMode">setMode</a></td> |
|
202 <td>Public method to set the client mode to local.</td> |
|
203 </tr> |
|
204 <tr> |
|
205 <td><a href="#OllamaClient.state">state</a></td> |
|
206 <td>Public method to get the current client state.</td> |
|
207 </tr> |
|
208 <tr> |
|
209 <td><a href="#OllamaClient.version">version</a></td> |
|
210 <td>Public method to request the version from the 'ollama' server.</td> |
|
211 </tr> |
|
212 </table> |
|
213 |
|
214 <h3>Static Methods</h3> |
|
215 <table> |
|
216 <tr><td>None</td></tr> |
|
217 </table> |
|
218 |
|
219 |
|
220 <a NAME="OllamaClient.__init__" ID="OllamaClient.__init__"></a> |
|
221 <h4>OllamaClient (Constructor)</h4> |
|
222 <b>OllamaClient</b>(<i>plugin, parent=None</i>) |
|
223 <p> |
|
224 Constructor |
|
225 </p> |
|
226 |
|
227 <dl> |
|
228 |
|
229 <dt><i>plugin</i> (PluginOllamaInterface)</dt> |
|
230 <dd> |
|
231 reference to the plugin object |
|
232 </dd> |
|
233 <dt><i>parent</i> (QObject (optional))</dt> |
|
234 <dd> |
|
235 reference to the parent object (defaults to None) |
|
236 </dd> |
|
237 </dl> |
|
238 <a NAME="OllamaClient.__errorOccurred" ID="OllamaClient.__errorOccurred"></a> |
|
239 <h4>OllamaClient.__errorOccurred</h4> |
|
240 <b>__errorOccurred</b>(<i>errorCode, reply</i>) |
|
241 <p> |
|
242 Private method to handle a network error of the given reply. |
|
243 </p> |
|
244 |
|
245 <dl> |
|
246 |
|
247 <dt><i>errorCode</i> (QNetworkReply.NetworkError)</dt> |
|
248 <dd> |
|
249 error code reported by the reply |
|
250 </dd> |
|
251 <dt><i>reply</i> (QNetworkReply)</dt> |
|
252 <dd> |
|
253 reference to the network reply object |
|
254 </dd> |
|
255 </dl> |
|
256 <a NAME="OllamaClient.__getHeartbeatUrl" ID="OllamaClient.__getHeartbeatUrl"></a> |
|
257 <h4>OllamaClient.__getHeartbeatUrl</h4> |
|
258 <b>__getHeartbeatUrl</b>(<i></i>) |
|
259 <p> |
|
260 Private method to get the current heartbeat URL. |
|
261 </p> |
|
262 |
|
263 <dl> |
|
264 <dt>Return:</dt> |
|
265 <dd> |
|
266 URL to be contacted by the heartbeat check |
|
267 </dd> |
|
268 </dl> |
|
269 <dl> |
|
270 <dt>Return Type:</dt> |
|
271 <dd> |
|
272 str |
|
273 </dd> |
|
274 </dl> |
|
275 <a NAME="OllamaClient.__getServerReply" ID="OllamaClient.__getServerReply"></a> |
|
276 <h4>OllamaClient.__getServerReply</h4> |
|
277 <b>__getServerReply</b>(<i>endpoint, data=None, delete=False</i>) |
|
278 <p> |
|
279 Private method to send a request to the 'ollama' server and return a reply |
|
280 object. |
|
281 </p> |
|
282 |
|
283 <dl> |
|
284 |
|
285 <dt><i>endpoint</i> (str)</dt> |
|
286 <dd> |
|
287 'ollama' API endpoint to be contacted |
|
288 </dd> |
|
289 <dt><i>data</i> (dict (optional))</dt> |
|
290 <dd> |
|
291 dictionary containing the data to send to the server |
|
292 (defaults to None) |
|
293 </dd> |
|
294 <dt><i>delete</i> (bool (optional))</dt> |
|
295 <dd> |
|
296 flag indicating to send a delete request (defaults to False) |
|
297 </dd> |
|
298 </dl> |
|
299 <dl> |
|
300 <dt>Return:</dt> |
|
301 <dd> |
|
302 'ollama' server reply |
|
303 </dd> |
|
304 </dl> |
|
305 <dl> |
|
306 <dt>Return Type:</dt> |
|
307 <dd> |
|
308 QNetworkReply |
|
309 </dd> |
|
310 </dl> |
|
311 <a NAME="OllamaClient.__periodicHeartbeat" ID="OllamaClient.__periodicHeartbeat"></a> |
|
312 <h4>OllamaClient.__periodicHeartbeat</h4> |
|
313 <b>__periodicHeartbeat</b>(<i></i>) |
|
314 <p> |
|
315 Private slot to do a periodic check of the 'ollama' server responsiveness. |
|
316 </p> |
|
317 |
|
318 <a NAME="OllamaClient.__processChatResponse" ID="OllamaClient.__processChatResponse"></a> |
|
319 <h4>OllamaClient.__processChatResponse</h4> |
|
320 <b>__processChatResponse</b>(<i>response</i>) |
|
321 <p> |
|
322 Private method to process the chat response of the 'ollama' server. |
|
323 </p> |
|
324 |
|
325 <dl> |
|
326 |
|
327 <dt><i>response</i> (dict)</dt> |
|
328 <dd> |
|
329 dictionary containing the chat response |
|
330 </dd> |
|
331 </dl> |
|
332 <a NAME="OllamaClient.__processData" ID="OllamaClient.__processData"></a> |
|
333 <h4>OllamaClient.__processData</h4> |
|
334 <b>__processData</b>(<i>reply, processResponse</i>) |
|
335 <p> |
|
336 Private method to receive data from the 'ollama' server and process it with a |
|
337 given processing function or method. |
|
338 </p> |
|
339 |
|
340 <dl> |
|
341 |
|
342 <dt><i>reply</i> (QNetworkReply)</dt> |
|
343 <dd> |
|
344 reference to the network reply object |
|
345 </dd> |
|
346 <dt><i>processResponse</i> (function)</dt> |
|
347 <dd> |
|
348 processing function |
|
349 </dd> |
|
350 </dl> |
|
351 <a NAME="OllamaClient.__processGenerateResponse" ID="OllamaClient.__processGenerateResponse"></a> |
|
352 <h4>OllamaClient.__processGenerateResponse</h4> |
|
353 <b>__processGenerateResponse</b>(<i>response</i>) |
|
354 <p> |
|
355 Private method to process the generate response of the 'ollama' server. |
|
356 </p> |
|
357 |
|
358 <dl> |
|
359 |
|
360 <dt><i>response</i> (dict)</dt> |
|
361 <dd> |
|
362 dictionary containing the generate response |
|
363 </dd> |
|
364 </dl> |
|
365 <a NAME="OllamaClient.__processModelsList" ID="OllamaClient.__processModelsList"></a> |
|
366 <h4>OllamaClient.__processModelsList</h4> |
|
367 <b>__processModelsList</b>(<i>response</i>) |
|
368 <p> |
|
369 Private method to process the tags response of the 'ollama' server. |
|
370 </p> |
|
371 |
|
372 <dl> |
|
373 |
|
374 <dt><i>response</i> (dict)</dt> |
|
375 <dd> |
|
376 dictionary containing the tags response |
|
377 </dd> |
|
378 </dl> |
|
379 <a NAME="OllamaClient.__processPullResponse" ID="OllamaClient.__processPullResponse"></a> |
|
380 <h4>OllamaClient.__processPullResponse</h4> |
|
381 <b>__processPullResponse</b>(<i>response</i>) |
|
382 <p> |
|
383 Private method to process a pull response of the 'ollama' server. |
|
384 </p> |
|
385 |
|
386 <dl> |
|
387 |
|
388 <dt><i>response</i> (dict)</dt> |
|
389 <dd> |
|
390 dictionary containing the pull response |
|
391 </dd> |
|
392 </dl> |
|
393 <a NAME="OllamaClient.__processVersion" ID="OllamaClient.__processVersion"></a> |
|
394 <h4>OllamaClient.__processVersion</h4> |
|
395 <b>__processVersion</b>(<i>response</i>) |
|
396 <p> |
|
397 Private method to process the version response of the 'ollama' server. |
|
398 </p> |
|
399 |
|
400 <dl> |
|
401 |
|
402 <dt><i>response</i> (dict)</dt> |
|
403 <dd> |
|
404 dictionary containing the version response |
|
405 </dd> |
|
406 </dl> |
|
407 <a NAME="OllamaClient.__replyFinished" ID="OllamaClient.__replyFinished"></a> |
|
408 <h4>OllamaClient.__replyFinished</h4> |
|
409 <b>__replyFinished</b>(<i>reply</i>) |
|
410 <p> |
|
411 Private method to handle the finished signal of the reply. |
|
412 </p> |
|
413 |
|
414 <dl> |
|
415 |
|
416 <dt><i>reply</i> (QNetworkReply)</dt> |
|
417 <dd> |
|
418 reference to the finished network reply object |
|
419 </dd> |
|
420 </dl> |
|
421 <a NAME="OllamaClient.__sendRequest" ID="OllamaClient.__sendRequest"></a> |
|
422 <h4>OllamaClient.__sendRequest</h4> |
|
423 <b>__sendRequest</b>(<i>endpoint, data=None, processResponse=None</i>) |
|
424 <p> |
|
425 Private method to send a request to the 'ollama' server and handle its |
|
426 responses. |
|
427 </p> |
|
428 |
|
429 <dl> |
|
430 |
|
431 <dt><i>endpoint</i> (str)</dt> |
|
432 <dd> |
|
433 'ollama' API endpoint to be contacted |
|
434 </dd> |
|
435 <dt><i>data</i> (dict (optional))</dt> |
|
436 <dd> |
|
437 dictionary containing the data to send to the server |
|
438 (defaults to None) |
|
439 </dd> |
|
440 <dt><i>processResponse</i> (function (optional))</dt> |
|
441 <dd> |
|
442 function handling the received data (defaults to None) |
|
443 </dd> |
|
444 </dl> |
|
445 <a NAME="OllamaClient.__sendSyncRequest" ID="OllamaClient.__sendSyncRequest"></a> |
|
446 <h4>OllamaClient.__sendSyncRequest</h4> |
|
447 <b>__sendSyncRequest</b>(<i>endpoint, data=None, delete=False</i>) |
|
448 <p> |
|
449 Private method to send a request to the 'ollama' server and handle its |
|
450 responses. |
|
451 </p> |
|
452 |
|
453 <dl> |
|
454 |
|
455 <dt><i>endpoint</i> (str)</dt> |
|
456 <dd> |
|
457 'ollama' API endpoint to be contacted |
|
458 </dd> |
|
459 <dt><i>data</i> (dict (optional))</dt> |
|
460 <dd> |
|
461 dictionary containing the data to send to the server |
|
462 (defaults to None) |
|
463 </dd> |
|
464 <dt><i>delete</i> (bool (optional))</dt> |
|
465 <dd> |
|
466 flag indicating to send a delete request (defaults to False) |
|
467 </dd> |
|
468 </dl> |
|
469 <dl> |
|
470 <dt>Return:</dt> |
|
471 <dd> |
|
472 tuple containing the data sent by the 'ollama' server and the HTTP |
|
473 status code |
|
474 </dd> |
|
475 </dl> |
|
476 <dl> |
|
477 <dt>Return Type:</dt> |
|
478 <dd> |
|
479 tuple of (Any, int) |
|
480 </dd> |
|
481 </dl> |
|
482 <a NAME="OllamaClient.__serverNotRespondingMessage" ID="OllamaClient.__serverNotRespondingMessage"></a> |
|
483 <h4>OllamaClient.__serverNotRespondingMessage</h4> |
|
484 <b>__serverNotRespondingMessage</b>(<i></i>) |
|
485 <p> |
|
486 Private method to assemble and return a message for a non-responsive server. |
|
487 </p> |
|
488 |
|
489 <dl> |
|
490 <dt>Return:</dt> |
|
491 <dd> |
|
492 error message |
|
493 </dd> |
|
494 </dl> |
|
495 <dl> |
|
496 <dt>Return Type:</dt> |
|
497 <dd> |
|
498 str |
|
499 </dd> |
|
500 </dl> |
|
501 <a NAME="OllamaClient.__setHeartbeatTimer" ID="OllamaClient.__setHeartbeatTimer"></a> |
|
502 <h4>OllamaClient.__setHeartbeatTimer</h4> |
|
503 <b>__setHeartbeatTimer</b>(<i></i>) |
|
504 <p> |
|
505 Private slot to configure the heartbeat timer. |
|
506 </p> |
|
507 |
|
508 <a NAME="OllamaClient.abortPull" ID="OllamaClient.abortPull"></a> |
|
509 <h4>OllamaClient.abortPull</h4> |
|
510 <b>abortPull</b>(<i></i>) |
|
511 <p> |
|
512 Public method to abort an ongoing pull operation. |
|
513 </p> |
|
514 |
|
515 <a NAME="OllamaClient.chat" ID="OllamaClient.chat"></a> |
|
516 <h4>OllamaClient.chat</h4> |
|
517 <b>chat</b>(<i>model, messages, streaming=True</i>) |
|
518 <p> |
|
519 Public method to request a chat completion from the 'ollama' server. |
|
520 </p> |
|
521 |
|
522 <dl> |
|
523 |
|
524 <dt><i>model</i> (str)</dt> |
|
525 <dd> |
|
526 name of the model to be used |
|
527 </dd> |
|
528 <dt><i>messages</i> (list of dict)</dt> |
|
529 <dd> |
|
530 list of message objects |
|
531 </dd> |
|
532 <dt><i>streaming</i> (bool)</dt> |
|
533 <dd> |
|
534 flag indicating to receive a streaming response |
|
535 </dd> |
|
536 </dl> |
|
537 <a NAME="OllamaClient.generate" ID="OllamaClient.generate"></a> |
|
538 <h4>OllamaClient.generate</h4> |
|
539 <b>generate</b>(<i>model, prompt, suffix=None</i>) |
|
540 <p> |
|
541 Public method to request to generate a completion from the 'ollama' server. |
|
542 </p> |
|
543 |
|
544 <dl> |
|
545 |
|
546 <dt><i>model</i> (str)</dt> |
|
547 <dd> |
|
548 name of the model to be used |
|
549 </dd> |
|
550 <dt><i>prompt</i> (str)</dt> |
|
551 <dd> |
|
552 prompt to generate a response for |
|
553 </dd> |
|
554 <dt><i>suffix</i> (str (optional))</dt> |
|
555 <dd> |
|
556 text after the model response (defaults to None) |
|
557 </dd> |
|
558 </dl> |
|
559 <a NAME="OllamaClient.heartbeat" ID="OllamaClient.heartbeat"></a> |
|
560 <h4>OllamaClient.heartbeat</h4> |
|
561 <b>heartbeat</b>(<i></i>) |
|
562 <p> |
|
563 Public method to check, if the 'ollama' server has started and is responsive. |
|
564 </p> |
|
565 |
|
566 <dl> |
|
567 <dt>Return:</dt> |
|
568 <dd> |
|
569 flag indicating a responsive 'ollama' server |
|
570 </dd> |
|
571 </dl> |
|
572 <dl> |
|
573 <dt>Return Type:</dt> |
|
574 <dd> |
|
575 bool |
|
576 </dd> |
|
577 </dl> |
|
578 <a NAME="OllamaClient.list" ID="OllamaClient.list"></a> |
|
579 <h4>OllamaClient.list</h4> |
|
580 <b>list</b>(<i></i>) |
|
581 <p> |
|
582 Public method to request a list of models available locally from the 'ollama' |
|
583 server. |
|
584 </p> |
|
585 |
|
586 <a NAME="OllamaClient.listDetails" ID="OllamaClient.listDetails"></a> |
|
587 <h4>OllamaClient.listDetails</h4> |
|
588 <b>listDetails</b>(<i></i>) |
|
589 <p> |
|
590 Public method to request a list of models available locally from the 'ollama' |
|
591 server with some model details. |
|
592 </p> |
|
593 |
|
594 <dl> |
|
595 <dt>Return:</dt> |
|
596 <dd> |
|
597 list of dictionaries containing the available models and related data |
|
598 </dd> |
|
599 </dl> |
|
600 <dl> |
|
601 <dt>Return Type:</dt> |
|
602 <dd> |
|
603 list[dict[str, Any]] |
|
604 </dd> |
|
605 </dl> |
|
606 <a NAME="OllamaClient.listRunning" ID="OllamaClient.listRunning"></a> |
|
607 <h4>OllamaClient.listRunning</h4> |
|
608 <b>listRunning</b>(<i></i>) |
|
609 <p> |
|
610 Public method to request a list of running models from the 'ollama' server. |
|
611 </p> |
|
612 |
|
613 <dl> |
|
614 <dt>Return:</dt> |
|
615 <dd> |
|
616 list of dictionaries containing the running models and related data |
|
617 </dd> |
|
618 </dl> |
|
619 <dl> |
|
620 <dt>Return Type:</dt> |
|
621 <dd> |
|
622 list[dict[str, Any]] |
|
623 </dd> |
|
624 </dl> |
|
625 <a NAME="OllamaClient.pull" ID="OllamaClient.pull"></a> |
|
626 <h4>OllamaClient.pull</h4> |
|
627 <b>pull</b>(<i>model</i>) |
|
628 <p> |
|
629 Public method to ask the 'ollama' server to pull the given model. |
|
630 </p> |
|
631 |
|
632 <dl> |
|
633 |
|
634 <dt><i>model</i> (str)</dt> |
|
635 <dd> |
|
636 name of the model |
|
637 </dd> |
|
638 </dl> |
|
639 <a NAME="OllamaClient.remove" ID="OllamaClient.remove"></a> |
|
640 <h4>OllamaClient.remove</h4> |
|
641 <b>remove</b>(<i>model</i>) |
|
642 <p> |
|
643 Public method to ask the 'ollama' server to delete the given model. |
|
644 </p> |
|
645 |
|
646 <dl> |
|
647 |
|
648 <dt><i>model</i> (str)</dt> |
|
649 <dd> |
|
650 name of the model |
|
651 </dd> |
|
652 </dl> |
|
653 <dl> |
|
654 <dt>Return:</dt> |
|
655 <dd> |
|
656 flag indicating success |
|
657 </dd> |
|
658 </dl> |
|
659 <dl> |
|
660 <dt>Return Type:</dt> |
|
661 <dd> |
|
662 bool |
|
663 </dd> |
|
664 </dl> |
|
665 <a NAME="OllamaClient.setMode" ID="OllamaClient.setMode"></a> |
|
666 <h4>OllamaClient.setMode</h4> |
|
667 <b>setMode</b>(<i>local</i>) |
|
668 <p> |
|
669 Public method to set the client mode to local. |
|
670 </p> |
|
671 |
|
672 <dl> |
|
673 |
|
674 <dt><i>local</i> (bool)</dt> |
|
675 <dd> |
|
676 flag indicating to connect to a locally started ollama server |
|
677 </dd> |
|
678 </dl> |
|
679 <a NAME="OllamaClient.state" ID="OllamaClient.state"></a> |
|
680 <h4>OllamaClient.state</h4> |
|
681 <b>state</b>(<i></i>) |
|
682 <p> |
|
683 Public method to get the current client state. |
|
684 </p> |
|
685 |
|
686 <dl> |
|
687 <dt>Return:</dt> |
|
688 <dd> |
|
689 current client state |
|
690 </dd> |
|
691 </dl> |
|
692 <dl> |
|
693 <dt>Return Type:</dt> |
|
694 <dd> |
|
695 OllamaClientState |
|
696 </dd> |
|
697 </dl> |
|
698 <a NAME="OllamaClient.version" ID="OllamaClient.version"></a> |
|
699 <h4>OllamaClient.version</h4> |
|
700 <b>version</b>(<i></i>) |
|
701 <p> |
|
702 Public method to request the version from the 'ollama' server. |
|
703 </p> |
|
704 |
|
705 <div align="right"><a href="#top">Up</a></div> |
|
706 <hr /> |
|
707 <hr /> |
|
708 <a NAME="OllamaClientState" ID="OllamaClientState"></a> |
|
709 <h2>OllamaClientState</h2> |
|
710 <p> |
|
711 Class defining the various client states. |
|
712 </p> |
|
713 |
|
714 <h3>Derived from</h3> |
|
715 enum.Enum |
|
716 <h3>Class Attributes</h3> |
|
717 <table> |
|
718 <tr><td>Finished</td></tr> |
|
719 <tr><td>Receiving</td></tr> |
|
720 <tr><td>Requesting</td></tr> |
|
721 <tr><td>Waiting</td></tr> |
|
722 </table> |
|
723 |
|
724 <h3>Class Methods</h3> |
|
725 <table> |
|
726 <tr><td>None</td></tr> |
|
727 </table> |
|
728 |
|
729 <h3>Methods</h3> |
|
730 <table> |
|
731 <tr><td>None</td></tr> |
|
732 </table> |
|
733 |
|
734 <h3>Static Methods</h3> |
|
735 <table> |
|
736 <tr><td>None</td></tr> |
|
737 </table> |
|
738 |
|
739 |
|
740 <div align="right"><a href="#top">Up</a></div> |
|
741 <hr /> |
|
742 </body></html> |