2.3 KiB
2.3 KiB
SKILL: OpenAI Provider Agent (Universal Literate Note)
- Overview
- Phase A: Demand (PRD)
- Phase B: Blueprint (PROTOCOL)
- Phase D: Build (Implementation)
- Registration
Overview
The OpenAI Provider Agent integrates OpenAI's GPT models as a pluggable System 1 (neural) backend. It provides industry-standard processing capabilities for reasoning and content generation.
Phase A: Demand (PRD)
1. Purpose
Define the interface for reliable communication with the OpenAI Chat Completions API.
2. User Needs
- Compatibility: Full implementation of the Chat Completions protocol.
- Reliability: Secure management of `$OPENAI_API_KEY`.
- Optimized Inference: Configurable temperature and model selection (GPT-4o, etc.).
- Resilience: Graceful handling of timeouts and errors.
3. Success Criteria
TODO API Authentication via Bearer Token
TODO Chat Payload Construction
TODO Choice Extraction Verification
Phase B: Blueprint (PROTOCOL)
1. Architectural Intent
Interfaces for executing neural completion requests via OpenAI's Chat API.
2. Semantic Interfaces
(defun execute-openai-request (prompt system-prompt)
"Executes a completion request via the OpenAI API.")
(defun get-openai-models ()
"Returns supported GPT models and their context limits.")
Phase D: Build (Implementation)
Request Execution
(defun execute-openai-request (prompt system-prompt)
(let ((api-key (uiop:getenv "OPENAI_API_KEY")))
(unless api-key (return-from execute-openai-request "ERROR: Key missing"))
(let ((model (get-config-attribute :LLM_MODEL_OPENAI "gpt-4o")))
;; Physical API call logic (mocked for refactor)
(format nil "Executing OpenAI request on ~a" model))))
Model Discovery
(defun get-openai-models ()
'((:id "gpt-4o" :context "128k")
(:id "gpt-4-turbo-preview" :context "128k")
(:id "gpt-3.5-turbo" :context "16k")))
Registration
(defskill :skill-provider-openai
:priority 100
:trigger (lambda (context) nil)
:neuro (lambda (context) nil)
:symbolic (lambda (action context) action))