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 7699aa4084
Signed by: libohad-dev
GPG key ID: 34FDC68B51191A4D

View file

@ -306,6 +306,14 @@
auto-mode-alist)) 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 (use-package gptel
:hook :hook
; keep-sorted start ; keep-sorted start
@ -328,7 +336,7 @@
) )
(gptel-make-ollama "Ollama" (gptel-make-ollama "Ollama"
:stream t :stream t
:models '(llama3.2:latest) :models (list-ollama-models)
) )
) )