Compare commits

...

8 commits

5 changed files with 22 additions and 7 deletions

View file

@ -307,11 +307,12 @@
(defun list-ollama-models () (defun list-ollama-models ()
"Query the local Ollama server for the list of installed models." "Query the local Ollama server for the list of installed models."
(condition-case error-var (let* ((tags-buffer (url-retrieve-synchronously "http://ollama:11434/api/tags"))
(mapcar #'intern (mapcar #'car (mapcar #'split-string (cdr (process-lines "podllama" "list"))))) (raw-response (with-current-buffer tags-buffer (buffer-string)))
(error (tags-payload (nth 1 (split-string raw-response "\n\n")))
(message "Failed to list local models: %s" error-var) (models (gethash "models" (json-parse-string tags-payload)))
()))) (model-names (mapcar (lambda (model) (gethash "name" model)) models)))
model-names))
(defun enrich-ollama-models (available library) (defun enrich-ollama-models (available library)
"Enrich the available models with metadata from the library of known models." "Enrich the available models with metadata from the library of known models."
@ -330,11 +331,12 @@
;; keep-sorted end ;; keep-sorted end
:custom :custom
;; keep-sorted start ;; keep-sorted start
(gptel--system-message "You are a sassy, sharp-tongued personal assistant. I need you to assist me in crafting responses to questions, dripping with ascerbic wit and sarcasm.")
(gptel-backend (gptel-get-backend "Ollama")) (gptel-backend (gptel-get-backend "Ollama"))
(gptel-default-mode 'org-mode) (gptel-default-mode 'org-mode)
(gptel-expert-commands t) (gptel-expert-commands t)
(gptel-highlight-methods '(face margin)) (gptel-highlight-methods '(face margin))
(gptel-model 'llama3.2:latest) (gptel-model 'hf.co/unsloth/Devstral-Small-2507-GGUF:latest)
;; keep-sorted end ;; keep-sorted end
:preface :preface
(load "local-models.el") (load "local-models.el")
@ -343,6 +345,7 @@
:key 'gptel-api-key-from-auth-source :key 'gptel-api-key-from-auth-source
) )
(gptel-make-ollama "Ollama" (gptel-make-ollama "Ollama"
:host "ollama:11434"
:stream t :stream t
:models (enrich-ollama-models (list-ollama-models) gptel--local-models) :models (enrich-ollama-models (list-ollama-models) gptel--local-models)
) )

View file

@ -1,3 +1,5 @@
;; -*- lexical-binding: t; -*-
(defconst gptel--local-models (defconst gptel--local-models
'( '(
;; keep-sorted start ;; keep-sorted start
@ -18,6 +20,11 @@
:context-window 32 :context-window 32
:cutoff-date "2023-10" :cutoff-date "2023-10"
) )
(
hf.co/unsloth/Devstral-Small-2507-GGUF:latest
:description "Agentic LLM for software engineering tasks"
:context-window 128
)
( (
llama3.2:latest llama3.2:latest
:description "Instruction-tuned model optimized for multilingual dialogue" :description "Instruction-tuned model optimized for multilingual dialogue"

View file

@ -0,0 +1,3 @@
# keep-sorted start
HOSTALIASES=~/.config/hosts
# keep-sorted end

1
.config/hosts Normal file
View file

@ -0,0 +1 @@
ollama localhost

View file

@ -8,8 +8,9 @@ podman --transient-store run --rm -ti \
--env XDG_RUNTIME_DIR=/tmp \ --env XDG_RUNTIME_DIR=/tmp \
--hostname localhost \ --hostname localhost \
--mount type=bind,source="${XDG_RUNTIME_DIR}"/"${WAYLAND_DISPLAY}",target=/tmp/"${WAYLAND_DISPLAY}" \ --mount type=bind,source="${XDG_RUNTIME_DIR}"/"${WAYLAND_DISPLAY}",target=/tmp/"${WAYLAND_DISPLAY}" \
--mount type=bind,source="$(systemd-path user-configuration)"/emacs/site-lisp/local-models.el,target=/root/.config/emacs/site-lisp/local-models.el \
--mount type=bind,readonly=true,source="$(systemd-path user)"/.keys/vaults,target=/root/.age/key \ --mount type=bind,readonly=true,source="$(systemd-path user)"/.keys/vaults,target=/root/.age/key \
--mount type=bind,readonly=true,source="$(systemd-path user)"/.keys/vaults.pub,target=/root/.age/key.pub \ --mount type=bind,readonly=true,source="$(systemd-path user)"/.keys/vaults.pub,target=/root/.age/key.pub \
--mount type=bind,source="$(systemd-path user)"/Vaults,target=/root/Vaults \ --mount type=bind,source="$(systemd-path user)"/Vaults,target=/root/Vaults \
--network none \ --network systemd-ollama \
vaulter:latest vaulter:latest