What is a good tool interface to apply file updates (patches)? #185
-
|
After working with OpenAI API and Claude 3.7 and defining my own tools, it never knows the correct line number (even if I provide the file with line numbers). Matching lines does not work so well because of duplicates. Clearly this is a well-solved problem. What is the best practice to do file updates? Does Ruby LLM handle this? |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments
-
|
I've been working on the same problem.
And in the description of the Does this make sense for you? PS: and no, RubyLLM does not takes care of this. This is really the job of the internal implementation of your tool :) |
Beta Was this translation helpful? Give feedback.
-
|
OK, that sounds like it would work. Thanks. |
Beta Was this translation helpful? Give feedback.
-
|
Just FYI, I've investigated this a bit. |
Beta Was this translation helpful? Give feedback.
-
|
I read the blog post. That's how I found out about Ruby LLM, haha. |
Beta Was this translation helpful? Give feedback.
-
|
Found this interesting: https://github.com/x1xhlol/system-prompts-and-models-of-ai-tools/blob/5b6a82d9b403d450905bdd8a1b92632085da291f/Cursor%20Prompts/Agent%20Prompt.txt#L40 |
Beta Was this translation helpful? Give feedback.
I've been working on the same problem.
And yet, the LLM does not know the lines number. Mostly cause the whole thing is a big ball of text, with text before and after (prompts). You can't rely on the line numbers.
What you must do:
Write a tool that takes 3 parameters:
file_pathold_stringnew_stringAnd in the description of the
old_string, specify that theold_stringmust be unique in the text, and to do that, It should take a couple of lines before and couple of lines after what it actually wants to change, to compose theold_string. That way, in your tool, you can simplygsubthe original text with theold_stringand thenew_string. No line numbers. Just text matching.Does this mak…