-
Notifications
You must be signed in to change notification settings - Fork 2
Text edit tools for msgs #38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
# %% ../nbs/00_core.ipynb | ||
def msg_insert_line( | ||
msgid:str, # Message id to edit | ||
insert_line: int, # The line number after which to insert the text (0 for beginning of file) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using the same param comment from claude official docs for docments.
- To get the exact message use `n=0` and `relative=True` together with `msgid`. | ||
- To get a relative message use `n` (relative position index). | ||
- To get the nth message use `n` with `relative=False`, e.g `n=0` first message, `n=-1` last message. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With many different ways to read msgs, this should hopefully guide AI on how to call the read_msg
tool properly for a given use case.
- &`msg_str_replace`: Find and replace text in a message. | ||
- &`msg_strs_replace`: Find and replace multiple strings in a message. | ||
- &`msg_replace_lines`: Replace a range of lines in a message with new content. | ||
- Always first use `read_msg( msgid=msgid, n=0, relative=True, nums=True)` to view the content with line numbers.''' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we instruct AI to first read_msg
with nums=True
before using msg_replace_lines
so that it can see the line numbers before setting the start and end line numbers.
This PR updates
read_msg_
to support line numbers and range selection, and implements msg variants of the file edit tools:msg_insert_line_
msg_str_replace_
msg_strs_replace_
msg_replace_lines_
This PR depends on the solveit PR: https://github.com/AnswerDotAI/solveit/pull/926
Here is a minimal dialogue showcasing the new tools