From the provided files in the repository, the prompts for the LLMs (Large Language Models) can be found in the following files, with descriptions of their purpose:
1. prompts.ts in ./repos/aide/extensions/codestory/src/llm/recipe/prompts.ts
This file defines multiple prompt templates and related interfaces for interaction with the LLM. Below are the key prompts found:
a) Plan and Queries Prompt
Function: generatePlanAndQueriesPrompt()
Purpose: Provides instructions to the LLM to break down a problem, generate up to three queries for a code search engine, and create additional instructions for solving the problem.
Prompt Template:
code
Think step-by-step to break down the requested problem or feature, and write up to three queries for the code search engine. These queries should find relevant code that is not already mentioned in the existing snippets. They should all mention different files and subtasks of the initial issue, avoid duplicates.
...
You MUST follow the following format delimited with XML tags:
Step-by-step thoughts with explanations:
* Thought 1 - Explanation 1
...
<queries>
* query 1
* query 2
* query 3
</queries>
<additional_instructions>
* additional instructions to be appended to the user's instructions
</additional_instructions>
XML Format ensures structured responses.
b) File Modification Prompt
Function: fileFunctionsToParsePrompt()
Purpose: Directs the LLM to identify and plan modifications to specific code symbols in the repository.
Prompt Template:
code
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Think step-by-step to break down the requested problem or feature, and then figure out what to change in the current codebase.
...
You MUST follow the following format delimited with XML tags:
Step-by-step thoughts with explanations:
* Thought 1 - Explanation 1
...
<modify_code_symbol>
* code_symbol_1: instructions_1
...
</modify_code_symbol>
c) Code Modification Prompt
Function: modifyCodeSnippetPrompt()
Purpose: Guides the LLM to modify specific code snippets based on instructions and file context.
Prompt Template:
code
File Name: ${filename}
<old_file>
${code}
</old_file>
---
User's request:
${instructions}
<code_snippet_to_change_for_instructions>
${codeSnippet}
</code_snippet_to_change_for_instructions>
---
Instructions:
1. Complete the Code Planning step
2. Complete the Code Modification step, remembering to NOT write ellipses, code things out in full, and use multiple small hunks.
d) Test Script Generation Prompt
Function: generateTestScriptGenerationPrompt()
Purpose: Instructs the LLM to create test scripts for verifying changes made to the code.
Prompt Template:
code
Think step-by-step regarding the instructions and how you can test the changes you have done to the function. You have to generate a script to test out your changes.
...
<test_framework_used>
${testFramework}
</test_framework_used>
...
<test_script>
... (fill this with the test script)
</test_script>
2. parse-completion.ts in ./repos/aide/extensions/codestory/src/completions/text-processing/parse-completion.ts
This file contains logic to parse and process completions generated by the LLM. While it doesn't directly define prompts, it processes completions using context like:
Tree-sitter parsing
Structural and semantic validation
3. parse-and-truncate-completion.ts in ./repos/aide/extensions/codestory/src/completions/text-processing/parse-and-truncate-completion.ts
This file focuses on truncating completions generated by the LLM based on context and syntax, using logic like:
Multiline truncation: Adjusting completions to ensure they fit within the expected context.
It works alongside parse-completion.ts to ensure the LLM's output adheres to expected standards.
4. provider.ts in ./repos/aide/extensions/codestory/src/completions/providers/provider.ts
This file acts as a provider interface for LLM completions. It doesn't directly define prompts but establishes the configuration and context size limits for LLM interactions:
Specifies context size (prefix, suffix, and total characters).
Handles configuration for generating completions.
Summary of Key LLM Prompts
The main prompts used for interacting with LLMs are in prompts.ts and include:
Plan generation and query prompts.
File modification planning prompts.
Code snippet modification prompts.
Test script generation prompts.
These prompts are structured with XML tags to ensure consistency and clarity in LLM responses.