From 7cf2119f32c1320151693f080fef36c6f06d8aec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Bj=C3=A4reholt?= Date: Sun, 15 Sep 2024 19:03:51 +0200 Subject: [PATCH] fix: extended the patch tool prompt to not strictly forbid placeholders, mention scoping strategies and fallback to save --- gptme/tools/patch.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gptme/tools/patch.py b/gptme/tools/patch.py index ae93eb6a..8f67251b 100644 --- a/gptme/tools/patch.py +++ b/gptme/tools/patch.py @@ -3,6 +3,7 @@ """ # TODO: support multiple patches in one codeblock (or make it clear that only one patch per codeblock is supported/applied) + import re from collections.abc import Generator from pathlib import Path @@ -16,7 +17,10 @@ This can be used to make changes to files, without having to rewrite the whole file. Only one patch block can be written per codeblock. Extra ORIGINAL/UPDATED blocks will be ignored. -Try to keep the patch as small as possible. Do not use placeholders, as they will make the patch fail. +Try to keep the patch as small as possible. Avoid placeholders, as they may make the patch fail. + +To keep the patch small, try to scope the patch to imports/function/class. +If the patch is large, consider using the save tool to rewrite the whole file. """ ORIGINAL = "<<<<<<< ORIGINAL\n"