Karthik Chikmagalur <[email protected]> writes: > :callback > (lambda (response inner-info) > (cond > ((stringp response) > (with-current-buffer buffer > (goto-char (point-max)) > (text-property-search-backward 'gptel 'response) > (delete-region (point) (point-max)) > (insert "The prompt recognized from speech will be given below...") > (insert response))) > ;; Do nothing otherwise > (t nil)) > (funcall callback))) > > You are calling the (outer) callback when the (inner) :callback is > called, irrespective of whether the response is a string. The (inner) > :callback is called by gptel-request for many reasons, including > confirming tool calls, returning tool results, and providing "reasoning" > text. What you want instead is to call the (outer) callback only when > the response is a string: > (insert response)) > (funcall callback))
Hmm. That's what I have independently done in https://github.com/yantar92/emacs-config/commit/05494bc1b5a46 > I'm trying to figure out if I can provide some syntax to declaratively > thread gptel-request calls (in any acyclic graph), which should make > this kind of nested use (@voice) very simple to write. I looked at your > example as a test and found this bug. Yeah. I have tried gptel-agent, and I find custom tools as agents idea more flexible. gptel-agent silently ate my system prompt and enforced its own tool versions even when I had better custom tools that do the same. -- Ihor Radchenko // yantar92, Org mode maintainer, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92>
