Skip to content

Commit f0c2f27

Browse files
committed
Simplify gptel tool registration in README
* README.org (llm-tool-collection-register-with-gptel): Simplify so as to simply call 'gptel-make-tool'. The latter function has a setter that manages the internal 'gptel--known-tools' and 'gptel-tools' lists and correctly handles duplicates.
1 parent 6244c85 commit f0c2f27

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

README.org

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -148,13 +148,7 @@ There will likely be many iterations necessary to get a tool to a good state. To
148148
(defun llm-tool-collection-register-with-gptel (tool-spec)
149149
"Register a tool defined by TOOL-SPEC with gptel.
150150
TOOL-SPEC is a plist that can be passed to `gptel-make-tool'."
151-
(let ((tool (apply #'gptel-make-tool tool-spec)))
152-
(setq gptel-tools
153-
(cons tool (seq-remove
154-
(lambda (existing)
155-
(string= (gptel-tool-name existing)
156-
(gptel-tool-name tool)))
157-
gptel-tools)))))
151+
(apply #'gptel-make-tool tool-spec))
158152

159153
(add-hook 'llm-tool-collection-post-define-functions
160154
#'llm-tool-collection-register-with-gptel)

0 commit comments

Comments
 (0)