Simplify inline assist to avoid spurious xml in completions (#16184)

Some prompt changes to highlight:
- Removes `<rewrite_section>` rendering, preferring to just show
`<rewrite_section_with_selections>`
- Concise, terse instructions throughout

I'd like to have experimented with prefilling the assistant response,
but I don't think OpenAI allows for that and wouldn't want to break
compatibility with gpt-4 et al.

Release Notes:

- N/A
This commit is contained in:
jvmncs 2024-08-13 17:05:50 -04:00 committed by GitHub
parent aa12ae0e3c
commit c3edbd7d9a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,52 +1,41 @@
Here's a text file that I'm going to ask you to make an edit to.
{{#if language_name}} {{#if language_name}}
The file is in {{language_name}}. File language: {{language_name}}
{{/if}} {{/if}}
You need to rewrite a portion of it.
The section you'll need to edit is marked with <rewrite_this></rewrite_this> tags.
<document> <document>
{{{document_content}}} {{{document_content}}}
</document> </document>
{{#if is_truncated}} {{#if is_truncated}}
The context around the relevant section has been truncated (possibly in the middle of a line) for brevity. Note: Context around the relevant section has been truncated for brevity.
{{/if}} {{/if}}
Rewrite the section of {{content_type}} in <rewrite_this></rewrite_this> tags based on the following prompt: Editing instructions:
1. Rewrite the section marked with <rewrite_this></rewrite_this> tags based on this prompt:
<prompt> <prompt>
{{{user_prompt}}} {{{user_prompt}}}
</prompt> </prompt>
Here's the section to edit based on that prompt again for reference: 2. Within <rewrite_this></rewrite_this>, make changes only in these subsections:
{{#if has_insertion}}
<rewrite_this> - Insert text where marked with <insert_here></insert_here> tags
{{{rewrite_section}}} {{/if}}
</rewrite_this> {{#if has_replacement}}
- Edit text surrounded by <edit_here></edit_here> tags
You'll rewrite this entire section, but you will only make changes within certain subsections. {{/if}}
{{#if has_insertion}}
Insert text anywhere you see it marked with with <insert_here></insert_here> tags. Do not include <insert_here> tags in your output.
{{/if}}
{{#if has_replacement}}
Edit edit text that you see surrounded with <edit_here></edit_here> tags. Do not include <edit_here> tags in your output.
{{/if}}
3. Section to edit:
<rewrite_this> <rewrite_this>
{{{rewrite_section_with_selections}}} {{{rewrite_section_with_selections}}}
</rewrite_this> </rewrite_this>
Only make changes that are necessary to fulfill the prompt, leave everything else as-is. All surrounding {{content_type}} will be preserved. Do not output the <rewrite_this></rewrite this> tags or anything outside of them. 4. Guidelines:
- Only make changes necessary to fulfill the prompt
- Preserve all surrounding {{content_type}}
- Maintain the original indentation level
- Rewrite the entire section, even if no changes are needed
- Do not include <rewrite_this>, <insert_here>, or <edit_here> tags in your output
Start at the indentation level in the original file in the rewritten {{content_type}}. Don't stop until you've rewritten the entire section, even if you have no more changes to make. Always write out the whole section with no unnecessary elisions. Output format:
Immediately start with the following, ensuring no leading whitespace:
Immediately start with the following format with no remarks: ```{{REWRITTEN_CODE}}```
```
\{{REWRITTEN_CODE}}
```