Architectural Upgrade 2026-03-30: Modular Emacs, org-gtd v4.0, and PSF Phase 1
This commit is contained in:
48
system/skills/org-skill-provider-ollama.org
Normal file
48
system/skills/org-skill-provider-ollama.org
Normal file
@@ -0,0 +1,48 @@
|
||||
#+TITLE: SKILL: Ollama Provider Agent (Local Backend)
|
||||
#+ID: skill-provider-ollama-agent
|
||||
#+STARTUP: content
|
||||
|
||||
* Overview
|
||||
The **Ollama Provider Agent** enables the use of local, privacy-preserving LLM models by integrating with a local Ollama instance. This allows the system to remain functional and sovereign even without external internet connectivity, utilizing models like `llama3` for neural reasoning.
|
||||
|
||||
* The Local Mandate
|
||||
1. **Sovereignty:** Provide a fallback neural backend that does not rely on third-party cloud providers.
|
||||
2. **Performance:** Interface with Ollama via its local API (typically over the Docker bridge).
|
||||
3. **Simplicity:** Focus on standard text generation without complex streaming requirements for the initial implementation.
|
||||
|
||||
* Symbolic Implementation (The Logic)
|
||||
The implementation focuses on the local network interaction with the Ollama daemon.
|
||||
|
||||
** Architectural Intent: Local Request Execution
|
||||
This function communicates with the Ollama `/api/generate` endpoint. It specifies the model (defaulting to `llama3`) and ensures that the response is captured in a non-streaming format for easier symbolic processing.
|
||||
|
||||
#+begin_src lisp
|
||||
(defun execute-ollama-request (prompt system-prompt)
|
||||
"Executes a completion request via local Ollama."
|
||||
(let* ((url "http://host.docker.internal:11434/api/generate")
|
||||
(body (cl-json:encode-json-to-string
|
||||
`((model . "llama3")
|
||||
(system . ,system-prompt)
|
||||
(prompt . ,prompt)
|
||||
(stream . nil)))))
|
||||
(handler-case
|
||||
(let* ((response (dex:post url
|
||||
:headers '(("Content-Type" . "application/json"))
|
||||
:content body))
|
||||
(json (cl-json:decode-json-from-string response)))
|
||||
(cdr (assoc :response json)))
|
||||
(error (c)
|
||||
(format nil "(:type :LOG :payload (:text \"Ollama Failure - ~a\"))" c)))))
|
||||
|
||||
;; Register the backend
|
||||
(org-agent:register-neuro-backend :ollama #'execute-ollama-request)
|
||||
#+end_src
|
||||
|
||||
* Registration
|
||||
#+begin_src lisp
|
||||
(defskill :skill-provider-ollama
|
||||
:priority 100
|
||||
:trigger (lambda (context) nil)
|
||||
:neuro (lambda (context) nil)
|
||||
:symbolic (lambda (action context) action))
|
||||
#+end_src
|
||||
Reference in New Issue
Block a user