Function: gptel--handle-tool-steer

gptel--handle-tool-steer is a natively compiled function defined in gptel.el.

Signature

(gptel--handle-tool-steer FSM)

Documentation

Handle steering messages during tool use for FSM.

Source Code

;; Defined in /nix/store/q3r7g81pvghw7a523kjk2k2zih3pfk8z-emacs-packages-deps/share/emacs/site-lisp/elpa/gptel-20261002.545/gptel.el
(defun gptel--handle-tool-steer (fsm)
  "Handle steering messages during tool use for FSM."
  (when-let* ((info (gptel-fsm-info fsm))
              (steer-list (plist-get info :steering-message))
              ;; TODO(steer) We support multiple steering messages but there is
              ;; no support for it in the UI yet (in-buffer or from the menu)
              (steer (apply #'concat (ensure-list steer-list))))
    ;; Inject the steering message into the messages array as a user message
    (gptel--inject-prompt
     (plist-get info :backend) (plist-get info :data)
     (gptel--parse-list (plist-get info :backend) (list steer)))
    ;; Close reasoning block if required
    (when (eq (plist-get info :reasoning-block) 'in)
      (funcall (plist-get info :callback) '(reasoning . t) info))
    ;; Insert the steering message response buffer
    (funcall (plist-get info :callback) (concat "\n" steer "\n") info 'raw)
    (plist-put info :steering-message nil))
  (gptel--fsm-transition fsm))