Compare commits
8 commits
ed44c92fc9
...
45e530a983
| Author | SHA1 | Date | |
|---|---|---|---|
| 45e530a983 | |||
| 1756c8c802 | |||
| 3de4e0ab1e | |||
| 91c52deda9 | |||
| 55d5c907e2 | |||
| fd645f60a2 | |||
| 90c310302d | |||
| 06d2a14d09 |
5 changed files with 22 additions and 7 deletions
|
|
@ -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)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -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"
|
||||||
|
|
|
||||||
3
.config/environment.d/ollama.conf
Normal file
3
.config/environment.d/ollama.conf
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
# keep-sorted start
|
||||||
|
HOSTALIASES=~/.config/hosts
|
||||||
|
# keep-sorted end
|
||||||
1
.config/hosts
Normal file
1
.config/hosts
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
ollama localhost
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue