refactor: move LLM provider implementations to literate skill notes
This commit is contained in:
72
notes/org-skill-provider-groq.org
Normal file
72
notes/org-skill-provider-groq.org
Normal file
@@ -0,0 +1,72 @@
|
||||
:PROPERTIES:
|
||||
:ID: f7db1884-49cc-4db6-9ca1-4c69ec3a631e
|
||||
:CREATED: [2026-04-08 Wed 11:30]
|
||||
:EDITED: [2026-04-08 Wed 11:30]
|
||||
:END:
|
||||
#+TITLE: SKILL: Groq Provider Agent (Universal Literate Note)
|
||||
#+STARTUP: content
|
||||
#+FILETAGS: :llm:provider:groq:lpu:psf:
|
||||
|
||||
* Overview
|
||||
The *Groq Provider Agent* leverages Groq's LPU (Language Processing Unit) for ultra-low latency inference. It is ideal for reflexive tasks and rapid interaction loops.
|
||||
|
||||
* Phase A: Demand (PRD)
|
||||
:PROPERTIES:
|
||||
:STATUS: FROZEN
|
||||
:END:
|
||||
|
||||
** 1. Purpose
|
||||
Enable high-speed neural completion via the Groq API.
|
||||
|
||||
** 2. User Needs
|
||||
- *Latency:* Sub-second response times for System 1 "hunches".
|
||||
- *Compatibility:* OpenAI-compatible endpoint.
|
||||
- *Reliability:* Secure management of `$GROQ_API_KEY`.
|
||||
|
||||
* Phase B: Blueprint (PROTOCOL)
|
||||
:PROPERTIES:
|
||||
:STATUS: SIGNED
|
||||
:END:
|
||||
|
||||
** 1. Architectural Intent
|
||||
Interface for executing ultra-fast neural requests.
|
||||
|
||||
** 2. Semantic Interfaces
|
||||
|
||||
*** `execute-groq-request`
|
||||
:signature `(execute-groq-request prompt system-prompt &key model) :string`
|
||||
:description "Direct call to the Groq Cloud API."
|
||||
|
||||
* Phase D: Build (Implementation)
|
||||
|
||||
#+begin_src lisp :tangle ../projects/org-skill-provider-groq/src/provider-logic.lisp
|
||||
(in-package :org-agent)
|
||||
|
||||
(defun execute-groq-request (prompt system-prompt &key model)
|
||||
(let ((api-key (uiop:getenv "GROQ_API_KEY"))
|
||||
(endpoint "https://api.groq.com/openai/v1/chat/completions")
|
||||
(model-id (or model "llama-3.3-70b-versatile")))
|
||||
(unless api-key (return-from execute-groq-request "(:type :LOG :payload (:text \"Groq API Key missing\"))"))
|
||||
(let* ((headers `(("Content-Type" . "application/json")
|
||||
("Authorization" . ,(format nil "Bearer ~a" api-key))))
|
||||
(body (cl-json:encode-json-to-string
|
||||
`((model . ,model-id)
|
||||
(messages . (( (role . "system") (content . ,system-prompt) )
|
||||
( (role . "user") (content . ,prompt) )))))))
|
||||
(handler-case (let* ((response (dex:post endpoint :headers headers :content body :connect-timeout 5 :read-timeout 10))
|
||||
(json (cl-json:decode-json-from-string response)))
|
||||
(cdr (assoc :content (cdr (assoc :message (car (cdr (assoc :choices json))))))))
|
||||
(error (c) (format nil "(:type :LOG :payload (:text \"Groq Failure: ~a\"))" c))))))
|
||||
#+end_src
|
||||
|
||||
* Registration
|
||||
#+begin_src lisp
|
||||
(progn
|
||||
(org-agent:register-neuro-backend :groq #'execute-groq-request)
|
||||
|
||||
(defskill :skill-provider-groq
|
||||
:priority 80
|
||||
:trigger (lambda (context) nil)
|
||||
:neuro (lambda (context) nil)
|
||||
:symbolic (lambda (action context) action)))
|
||||
#+end_src
|
||||
Reference in New Issue
Block a user