class RelaceEditToolSchema(ToolSchema, name="edit_file"):
"""Use this tool to propose an edit to an existing file or create a new file.
If you are performing an edit follow these formatting rules:
- Abbreviate sections of the code in your response that will remain the same by replacing those sections with a comment like "// ... rest of code ...", "// ... keep existing code ...", "// ... code remains the same".
- Be precise with the location of these comments within your edit snippet. A less intelligent model will use the context clues you provide to accurately merge your edit snippet.
- If applicable, it can help to include some concise information about the specific code segments you wish to retain "// ... keep calculateTotalFunction ... ".
- If you plan on deleting a section, you must provide the context to delete it. Some options:
1. If the initial code is ```code \n Block 1 \n Block 2 \n Block 3 \n code```, and you want to remove Block 2, you would output ```// ... keep existing code ... \n Block 1 \n Block 3 \n // ... rest of code ...```.
2. If the initial code is ```code \n Block \n code```, and you want to remove Block, you can also specify ```// ... keep existing code ... \n // remove Block \n // ... rest of code ...```.
- You must use the comment format applicable to the specific code provided to express these truncations.
- Preserve the indentation and code structure of exactly how you believe the final code will look (do not output lines that will not be in the final code after they are merged).
- Be as length efficient as possible without omitting key context.
To create a new file, simply specify the content of the file in the `edit` field.
"""
path: Path = Field(
...,
description="""The target file to modify. You must use an absolute path""",
)
instruction: str = Field(
...,
description="""A single sentence instruction describing the edit to be made.
This helps guide the apply model in merging the changes correctly.
Use first person perspective and focus on clarifying any ambiguous aspects of the edit.
Keep it brief and avoid repeating information from previous messages.""",
)
edit: str = Field(
...,
description="""
Only include the exact code lines that need modification.
Do not include any code that stays the same - those sections should be marked with comments appropriate for the language, like: `// ... existing code ...`
""",
)