Compare commits
5 commits
04d9cc5eed
...
8de98519ec
| Author | SHA1 | Date | |
|---|---|---|---|
| 8de98519ec | |||
| 73463a241f | |||
| 75ed82967c | |||
| e5087f5023 | |||
| f8b80bd60d |
4 changed files with 26 additions and 2 deletions
|
|
@ -5,8 +5,9 @@ Description=A local LLM server
|
||||||
# keep-sorted start
|
# keep-sorted start
|
||||||
ContainerName=ollama
|
ContainerName=ollama
|
||||||
Image=docker.io/ollama/ollama:latest
|
Image=docker.io/ollama/ollama:latest
|
||||||
|
Network=ollama.network
|
||||||
PublishPort=11434:11434
|
PublishPort=11434:11434
|
||||||
Volume=%h/.local/share/ollama:/root/.ollama:Z
|
Volume=%h/.local/share/ollama:/root/.ollama:ro,z
|
||||||
# keep-sorted end
|
# keep-sorted end
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
|
|
|
||||||
5
.config/containers/systemd/ollama.network
Normal file
5
.config/containers/systemd/ollama.network
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Isolated network for my local LLM server
|
||||||
|
|
||||||
|
[Network]
|
||||||
|
Internal=true
|
||||||
|
|
@ -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
|
||||||
|
|
@ -318,6 +326,7 @@
|
||||||
; keep-sorted start
|
; keep-sorted start
|
||||||
(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-highlight-methods '(face margin))
|
(gptel-highlight-methods '(face margin))
|
||||||
(gptel-model 'llama3.2:latest)
|
(gptel-model 'llama3.2:latest)
|
||||||
; keep-sorted end
|
; keep-sorted end
|
||||||
|
|
@ -328,7 +337,7 @@
|
||||||
)
|
)
|
||||||
(gptel-make-ollama "Ollama"
|
(gptel-make-ollama "Ollama"
|
||||||
:stream t
|
:stream t
|
||||||
:models '(llama3.2:latest)
|
:models (list-ollama-models)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
9
.local/bin/podllama
Executable file
9
.local/bin/podllama
Executable file
|
|
@ -0,0 +1,9 @@
|
||||||
|
#! /usr/bin/bash
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
IFS=$'\n\t'
|
||||||
|
|
||||||
|
mkdir --parents ~/.local/share/ollama/
|
||||||
|
pod_id=$(podman run --detach --rm --volume ~/.local/share/ollama/:/root/.ollama ollama:latest)
|
||||||
|
podman exec --interactive --tty "${pod_id}" ollama "$@"
|
||||||
|
podman kill "${pod_id}" > /dev/null
|
||||||
Loading…
Add table
Add a link
Reference in a new issue