Replies: 3 comments 3 replies
-
First, you have extra quotes ( LLMs won't generate function call arguments that are elisp data structures. They only speak JSON. In this case you want the second argument to be a list of replacements (old -> new), so you can structure this as a JSON array of objects, where each object has two keys, Working backwards from there, the '(:name "edits"
:type array
:items (:type object
:properties
(:old_string
(:type string :description "The old-string to be replaced.")
:new_string
(:type string :description "The new-string to replace old.")))
:description "The list of edits to apply on the file") How well this works depends on the LLM you're using. The Anthropic models should be able to handle this fine, at least. (When you receive the function call arguments, you may need to parse the JSON yourself. You can do this using |
Beta Was this translation helpful? Give feedback.
-
Thanks a lot, I will try it myself, and it the tool works, I will publish it to the gptel wiki. |
Beta Was this translation helpful? Give feedback.
-
Hi @karthink ,
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Please update gptel first -- errors are often fixed by the time they're reported.
Bug Description
Hi @karthink,
I got another question to ask you about:
I wanna create an edit file tool like the following:
the first param is a file-path, while the second is a list of cons whose car is old-string, cdr is new-string.
how should I define the params with array ?
I tried to define one like the following, but seems not work.
could u plz help to suggest the right way to define the tool?
many thanks.
Backend
None
Steps to Reproduce
Hi @karthink,
I got another question to ask you about:
I wanna create an edit file tool like the following:
the first param is a file-path, while the second is a list of cons whose car is old-string, cdr is new-string.
how should I define the params with array ?
I tried to define one like the following, but seems not work.
could u plz help to suggest the right way to define the tool?
many thanks.
Additional Context
Emacs 30.1
Backtrace
Log Information
Beta Was this translation helpful? Give feedback.
All reactions