From f0b60a0052a487fc07b898e9131b001e7924fe36 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Sun, 17 Dec 2023 15:25:15 -0800 Subject: [PATCH] Add clear instruction on how to make a new file --- aider/coders/udiff_prompts.py | 2 ++ docs/unified-diffs.md | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/aider/coders/udiff_prompts.py b/aider/coders/udiff_prompts.py index 068949e15..4ab30bfc4 100644 --- a/aider/coders/udiff_prompts.py +++ b/aider/coders/udiff_prompts.py @@ -93,6 +93,8 @@ Hunks don't need to be in any particular order. When editing a function, method, loop, etc use a hunk to replace the *entire* code block. Delete the entire existing version with `-` lines and then add a new, updated version with `+` lines. This will help you generate correct code and correct diffs. + +To make a new file, show a diff from `--- /dev/null` to `+++ path/to/new/file.ext`. """ files_content_prefix = "These are the *read-write* files:\n" diff --git a/docs/unified-diffs.md b/docs/unified-diffs.md index 85f2d707f..f679cbc68 100644 --- a/docs/unified-diffs.md +++ b/docs/unified-diffs.md @@ -127,7 +127,7 @@ helped clarify some general principles, which I think are applicable to any effe GPT-4 code editing format: - FAMILIAR - Choose an edit format that GPT is already familiar with. -- SIMPLE - Choose a simple format that avoid escaping, syntactic overhead and brittle specifiers like line numbers or line counts. +- SIMPLE - Choose a simple format that avoids escaping, syntactic overhead and brittle specifiers like line numbers or line counts. - HIGH LEVEL - Encourage GPT to structure edits as new versions of substantive code blocks (functions, methods, etc), not as a series of surgical/minimal changes to individual lines of code. - FLEXIBLE - Strive to be maximally flexible when interpreting GPT's edit instructions.