Files
memex/notes/org-skill-provider-anthropic.org

73 lines
2.4 KiB
Org Mode

#+TITLE: SKILL: Anthropic Provider Agent (Universal Literate Note)
#+ID: skill-provider-anthropic
#+STARTUP: content
#+FILETAGS: :llm:provider:anthropic:claude:psf:
* Overview
The **Anthropic Provider Agent** integrates Anthropic's Claude family of models as a pluggable System 1 (neural) backend. It enables high-intelligence reasoning, drafting, and analysis within the PSF.
* Phase A: Demand (PRD)
:PROPERTIES:
:STATUS: FROZEN
:END:
** 1. Purpose
Define the interface for reliable communication with the Anthropic Messages API.
** 2. User Needs
- **Connectivity:** Reliable I/O with Claude models.
- **Configurability:** Model selection via Environment Configuration.
- **Context Management:** Leverage Claude's large context windows.
- **Safety:** Graceful error handling for API failures or missing keys.
** 3. Success Criteria
*** TODO API Authentication
*** TODO Model Resolution Loop
*** TODO Response Parsing Verification
* Phase B: Blueprint (PROTOCOL)
:PROPERTIES:
:STATUS: SIGNED
:END:
** 1. Architectural Intent
Interfaces for executing neural completion requests. Source of truth is the Anthropic API and `$ANTHROPIC_API_KEY`.
** 2. Semantic Interfaces
#+begin_src lisp
(defun execute-anthropic-request (prompt system-prompt)
"Executes a completion request via the Anthropic API.")
(defun get-anthropic-models ()
"Returns supported models and their context limits.")
#+end_src
* Phase D: Build (Implementation)
** Request Execution
#+begin_src lisp :tangle projects/org-skill-provider-anthropic/src/provider-logic.lisp
(defun execute-anthropic-request (prompt system-prompt)
(let ((api-key (uiop:getenv "ANTHROPIC_API_KEY")))
(unless api-key (return-from execute-anthropic-request "ERROR: Key missing"))
(let ((model (get-config-attribute :LLM_MODEL_ANTHROPIC "claude-3-5-sonnet-20240620")))
;; Physical API call logic (mocked for refactor)
(format nil "Executing Anthropic request on ~a" model))))
#+end_src
** Model Discovery
#+begin_src lisp :tangle projects/org-skill-provider-anthropic/src/provider-logic.lisp
(defun get-anthropic-models ()
'((:id "claude-3-5-sonnet-20240620" :context "200k")
(:id "claude-3-opus-20240229" :context "200k")
(:id "claude-3-haiku-20240307" :context "200k")))
#+end_src
* Registration
#+begin_src lisp
(defskill :skill-provider-anthropic
:priority 100
:trigger (lambda (context) nil)
:neuro (lambda (context) nil)
:symbolic (lambda (action context) action))
#+end_src