Save#
Gives the assistant the ability to save whole files, or append to them.
Instructions
Create or overwrite a file with the given content.
The path can be relative to the current directory, or absolute.
If the current directory changes, the path will be relative to the new directory.
### When to use save vs patch
Use `save` for new files, full rewrites, or edits that touch most of a file.
Use `patch` for targeted edits to existing files; it keeps surrounding content intact.
Examples
| User |
write a hello world script to hello.py |
| Assistant |
|
| System |
Saved to `hello.py` |
| User |
make it all-caps |
| Assistant |
|
| System |
Saved to `hello.py` |
Instructions
Append the given content to a file.
Examples
| User |
append a print "Hello world" to hello.py |
| Assistant |
|
| System |
Appended to `hello.py` |
- gptme.tools.save.check_for_placeholders(content: str) bool
Check if content contains placeholder lines.
- gptme.tools.save.execute_append(code: str | None, args: list[str] | None, kwargs: dict[str, str] | None) Generator[Message, None, None]
Append code to a file.
- gptme.tools.save.execute_append_impl(content: str, path: Path | None) Generator[Message, None, None]
Actual append implementation.
- gptme.tools.save.execute_save(code: str | None, args: list[str] | None, kwargs: dict[str, str] | None) Generator[Message, None, None]
Save code to a file.
- gptme.tools.save.execute_save_impl(content: str, path: Path | None) Generator[Message, None, None]
Actual save implementation.