73 lines
2.3 KiB
Org Mode
73 lines
2.3 KiB
Org Mode
#+TITLE: SKILL: OpenAI Provider Agent (Universal Literate Note)
|
|
#+ID: skill-provider-openai
|
|
#+STARTUP: content
|
|
#+FILETAGS: :llm:provider:openai:gpt:psf:
|
|
|
|
* 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)
|
|
:PROPERTIES:
|
|
:STATUS: FROZEN
|
|
:END:
|
|
|
|
** 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)
|
|
:PROPERTIES:
|
|
:STATUS: SIGNED
|
|
:END:
|
|
|
|
** 1. Architectural Intent
|
|
Interfaces for executing neural completion requests via OpenAI's Chat API.
|
|
|
|
** 2. Semantic Interfaces
|
|
#+begin_src lisp
|
|
(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.")
|
|
#+end_src
|
|
|
|
* Phase D: Build (Implementation)
|
|
|
|
** Request Execution
|
|
#+begin_src lisp :tangle projects/org-skill-provider-openai/src/provider-logic.lisp
|
|
(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))))
|
|
#+end_src
|
|
|
|
** Model Discovery
|
|
#+begin_src lisp :tangle projects/org-skill-provider-openai/src/provider-logic.lisp
|
|
(defun get-openai-models ()
|
|
'((:id "gpt-4o" :context "128k")
|
|
(:id "gpt-4-turbo-preview" :context "128k")
|
|
(:id "gpt-3.5-turbo" :context "16k")))
|
|
#+end_src
|
|
|
|
* Registration
|
|
#+begin_src lisp
|
|
(defskill :skill-provider-openai
|
|
:priority 100
|
|
:trigger (lambda (context) nil)
|
|
:neuro (lambda (context) nil)
|
|
:symbolic (lambda (action context) action))
|
|
#+end_src
|