Function: gptel--parse-directive
gptel--parse-directive is a natively compiled function defined in
gptel-request.el.
Signature
(gptel--parse-directive DIRECTIVE &optional RAW)
Documentation
Parse DIRECTIVE into a backend-appropriate form.
DIRECTIVE is a gptel directive: it can be a string, a list or a
function that returns either, see gptel-directives.
Return a cons cell consisting of the system message (a string) and a template consisting of alternating user/LLM records (a list of strings or nil).
If RAW is non-nil, the user/LLM records are not processed and are returned as a list of strings.
Source Code
;; Defined in /nix/store/q3r7g81pvghw7a523kjk2k2zih3pfk8z-emacs-packages-deps/share/emacs/site-lisp/elpa/gptel-20261002.545/gptel-request.el
(defun gptel--parse-directive (directive &optional raw)
"Parse DIRECTIVE into a backend-appropriate form.
DIRECTIVE is a gptel directive: it can be a string, a list or a
function that returns either, see `gptel-directives'.
Return a cons cell consisting of the system message (a string)
and a template consisting of alternating user/LLM
records (a list of strings or nil).
If RAW is non-nil, the user/LLM records are not processed and are
returned as a list of strings."
(and directive
(cl-etypecase directive
(string (list directive))
(function (gptel--parse-directive (funcall directive) raw))
(cons (if raw directive
(cons (car directive)
;; FIXME(augment) do this elsewhere
(gptel--parse-list
gptel-backend (cdr directive))))))))