Query the Ollama server for the list of installed models

This commit is contained in:
Ohad Livne 2025-11-15 16:35:19 +02:00
parent 75ed82967c
commit 73463a241f
Signed by: libohad-dev
GPG key ID: 34FDC68B51191A4D

View file

@ -306,6 +306,14 @@
auto-mode-alist))
)
(defun list-ollama-models ()
"Query the local Ollama server for the list of installed models"
(condition-case error-var
(mapcar #'intern (mapcar #'car (mapcar #'split-string (cdr (process-lines "podllama" "list")))))
(error
(message "Failed to list local models: %s" error-var)
())))
(use-package gptel
:hook
; keep-sorted start
@ -328,7 +336,7 @@
)
(gptel-make-ollama "Ollama"
:stream t
:models '(llama3.2:latest)
:models (list-ollama-models)
)
)