chore: structural cleanup of projects and patches
This commit is contained in:
22
system/patches/patch-neuro-trace.lisp
Normal file
22
system/patches/patch-neuro-trace.lisp
Normal file
@@ -0,0 +1,22 @@
|
||||
(in-package :org-agent)
|
||||
|
||||
(defun ask-neuro (prompt &key (system-prompt "You are the System 1 engine of a Neurosymbolic Lisp Machine.") (cascade nil) (context nil))
|
||||
(let ((backends (cond
|
||||
((listp cascade) cascade)
|
||||
((functionp cascade) (funcall cascade context))
|
||||
((functionp *provider-cascade*) (funcall *provider-cascade* context))
|
||||
(t *provider-cascade*))))
|
||||
(dolist (backend backends)
|
||||
(let ((backend-fn (gethash backend *neuro-backends*)))
|
||||
(when backend-fn
|
||||
(kernel-log "SYSTEM 1: Attempting backend ~a..." backend)
|
||||
(let* ((model (ignore-errors
|
||||
(uiop:symbol-call :org-agent.skills.org-skill-economist :economist-get-model-for-provider backend)))
|
||||
(result (if model
|
||||
(funcall backend-fn prompt system-prompt :model model)
|
||||
(funcall backend-fn prompt system-prompt))))
|
||||
(kernel-log "SYSTEM 1: Backend ~a returned: ~a" backend (if (stringp result) (subseq result 0 (min 50 (length result))) result))
|
||||
(if (and (stringp result) (search ":LOG" result) (or (search "Failure" result) (search "missing" result)))
|
||||
(kernel-log "SYSTEM 1: Backend ~a failed. Falling back..." backend)
|
||||
(return-from ask-neuro result))))))
|
||||
"(:type :LOG :payload (:text \"Neural Cascade Failure\"))"))
|
||||
Reference in New Issue
Block a user