update prompts to latest version (#940)

This commit is contained in:
LeonOstrez
2024-05-23 18:37:46 +01:00
committed by GitHub
parent e8c67faf7f
commit d6445af2ee
14 changed files with 80 additions and 27 deletions

1
.gitignore vendored
View File

@@ -5,6 +5,7 @@ __pycache__/
htmlcov/
dist/
workspace/
pilot-env/
.coverage
*.code-workspace

View File

@@ -54,6 +54,12 @@ class TaskSteps(BaseModel):
steps: list[Step]
class RelevantFiles(BaseModel):
relevant_files: list[str] = Field(
description="List of relevant files for the current task."
)
class Developer(BaseAgent):
agent_type = "developer"
display_name = "Developer"
@@ -124,6 +130,8 @@ class Developer(BaseAgent):
log.debug(f"Breaking down the iteration {description}")
await self.send_message("Breaking down the current task iteration ...")
await self.get_relevant_files(user_feedback, description)
await self.ui.send_task_progress(
n_tasks, # iterations and reviews can be created only one at a time, so we are always on last one
n_tasks,
@@ -189,7 +197,7 @@ class Developer(BaseAgent):
}
await self.send_message("Breaking down the task into steps ...")
convo.template("parse_task").require_schema(TaskSteps)
convo.assistant(response).template("parse_task").require_schema(TaskSteps)
response: TaskSteps = await llm(convo, parser=JSONParser(TaskSteps), temperature=0)
# There might be state leftovers from previous tasks that we need to clean here
@@ -197,18 +205,26 @@ class Developer(BaseAgent):
self.set_next_steps(response, source)
return AgentResponse.done(self)
async def get_relevant_files(self) -> AgentResponse:
async def get_relevant_files(
self,
user_feedback: Optional[str] = None,
solution_description: Optional[str] = None
) -> AgentResponse:
log.debug("Getting relevant files for the current task")
await self.send_message("Figuring out which project files are relevant for the next task ...")
llm = self.get_llm()
convo = AgentConvo(self).template("filter_files", current_task=self.current_state.current_task)
convo = AgentConvo(self).template(
"filter_files",
current_task=self.current_state.current_task,
user_feedback=user_feedback,
solution_description=solution_description,
).require_schema(RelevantFiles)
# FIXME: this doesn't validate correct structure format, we should use pydantic for that as well
llm_response: list[str] = await llm(convo, parser=JSONParser(), temperature=0)
llm_response: list[str] = await llm(convo, parser=JSONParser(RelevantFiles), temperature=0)
existing_files = {file.path for file in self.current_state.files}
self.next_state.relevant_files = [path for path in llm_response if path in existing_files]
self.next_state.relevant_files = [path for path in llm_response.relevant_files if path in existing_files]
return AgentResponse.done(self)

View File

@@ -99,7 +99,7 @@ class AgentLLMConfig(_StrictModel):
"""
provider: LLMProvider = LLMProvider.OPENAI
model: str = Field(description="Model to use", default="gpt-4-turbo")
model: str = Field(description="Model to use", default="gpt-4-turbo-preview")
temperature: float = Field(
default=0.5,
description="Temperature to use for sampling",

View File

@@ -72,16 +72,18 @@ def convert_config(values: dict) -> Config:
config.llm[provider].api_key = key
provider = "openai"
model = values.get("MODEL_NAME", "gpt-4-turbo")
if "/" in model:
provider, model = model.split("/", 1)
model = values.get("MODEL_NAME")
if model:
if "/" in model:
provider, model = model.split("/", 1)
try:
agent_provider = LLMProvider(provider.upper())
except ValueError:
agent_provider = LLMProvider.OPENAI
try:
agent_provider = LLMProvider(provider.upper())
except ValueError:
agent_provider = LLMProvider.OPENAI
config.agent["default"].model = model
config.agent["default"].model = model
config.agent["default"].provider = agent_provider
ignore_paths = [p for p in values.get("IGNORE_PATHS", "").split(",") if p]

View File

@@ -0,0 +1,2 @@
You are a world class software architect.
You focus on creating architecture for Minimum Viable Product versions of apps developed as fast as possible with as many ready-made technologies as possible.

View File

@@ -47,7 +47,7 @@ Write high-quality code, first organize it logically with clear, meaningful name
**IMPORTANT** Your reply MUST NOT omit any code in the new implementation or substitute anything with comments like `// .. rest of the code goes here ..` or `# insert existing code here`, because I will overwrite the existing file with the content you provide. Output ONLY the content for this file, without additional explanation, suggestions or notes. Your output MUST start with ``` and MUST end with ``` and include only the complete file contents.
**IMPORTANT** For hardcoded configuration values that the user needs to change, mark the line that needs user configuration with `INPUT_REQUIRED {config_description}` comment, where `config_description` is a description of the value that needs to be set by the user. Use appropriate syntax for comments in the file you're saving (for example `// INPUT_REQUIRED {config_description}` in JavaScript). NEVER ask the user to write code or provide implementation, even if the instructions suggest it! If the file type doesn't support comments (eg JSON), don't add any.
**IMPORTANT** When working with configuration files (e.g. config.json, .env,...), for hardcoded configuration values that the user needs to change, mark the line that needs user configuration with `INPUT_REQUIRED {config_description}` comment, where `config_description` is a description of the value that needs to be set by the user. Use appropriate syntax for comments in the file you're saving (for example `// INPUT_REQUIRED {config_description}` in JavaScript). NEVER ask the user to write code or provide implementation, even if the instructions suggest it! If the file type doesn't support comments (eg JSON), don't add any.
**IMPORTANT**: Logging
Whenever you write code, make sure to log code execution so that when a developer looks at the CLI output, they can understand what is happening on the server. If the description above mentions the exact code that needs to be added but doesn't contain enough logs, you need to add the logs handlers inside that code yourself.

View File

@@ -1,3 +1,3 @@
You are a full stack software developer that works in a software development agency.
You are a world class full stack software developer.
You write modular, clean, maintainable, production-ready code.
Your job is to implement tasks that your tech lead assigns you.
Your job is to implement tasks assigned by your tech lead.

View File

@@ -1,8 +1,8 @@
We're starting work on a new task for a project we're working on.
{% include "partials/project_details.prompt" %}
{% include "partials/features_list.prompt" %}
{% include "partials/files_list.prompt" %}
{% include "partials/relative_paths.prompt" %}
We've broken the development of the project down to these tasks:
```
@@ -11,6 +11,24 @@ We've broken the development of the project down to these tasks:
{% endfor %}
```
The next task we need to work on is: {{ current_task.description }}
The next task we need to work on, and have to focus on, is this task:
```
{{ current_task.description }}
```
Before we dive into solving this task, we need to determine which files which files from the above list are relevant to this task. Output the relevant files in a JSON list.
{% if user_feedback %}User who was using the app sent you this feedback:
```
{{ user_feedback }}
```
{% endif %}{% if solution_description %}
Focus on solving this issue in the following way:
```
{{ solution_description }}
```
{% endif %}
**IMPORTANT**
The files necessary for a developer to understand, modify, implement, and test the current task are considered to be relevant files.
Your job is select which of existing files are relevant for the current task. From the above list of files that app currently contains, you have to select ALL files that are relevant to the current task. Think step by step of everything that has to be done in this task and which files contain needed information. If you are unsure if a file is relevant or not, it is always better to include it in the list of relevant files.
{% include "partials/relative_paths.prompt" %}

View File

@@ -1 +1,4 @@
**IMPORTANT**: Pay attention to file paths: if the command or argument is a file or folder from the project, use paths relative to the project root (for example, use `somedir/somefile` instead of `/path/to/project/somedir/somefile`).
**IMPORTANT**: Pay attention to file paths: if the command or argument is a file or folder from the project, use paths relative to the project root.
For example:
- use `dirname/filename.py` instead of `/path/to/project/dirname/filename.py`
- use `filename.js` instead of `./filename.js`

View File

@@ -1,6 +1,10 @@
You are working on an app called "{{ state.branch.project.name }}" and you need to write code for the entire {% if state.epics|length > 1 %}feature{% else %}app{% endif %} based on the tasks that the tech lead gives you. So that you understand better what you're working on, you're given other specs for "{{ state.branch.project.name }}" as well.
{% include "partials/project_details.prompt" %}
Here is a high level description of "{{ state.branch.project.name }}":
```
{{ state.specification.description }}
```
{% include "partials/features_list.prompt" %}
We've broken the development of this {% if state.epics|length > 1 %}feature{% else %}app{% endif %} down to these tasks:

View File

@@ -5,7 +5,7 @@ Try to avoid the use of Docker, Kubernetes, microservices and single-page app fr
In your work, follow these important rules:
* In your communication with the client, be straightforward, concise, and focused on the task.
* Ask questions ONE BY ONE. This is veryy important, as the client is easily confused. If you were to ask multiple questions the user would probably miss some questions, so remember to always ask the questions one by one
* Ask questions ONE BY ONE. This is very important, as the client is easily confused. If you were to ask multiple questions the user would probably miss some questions, so remember to always ask the questions one by one
* Ask specific questions, taking into account what you already know about the project. For example, don't ask "what features do you need?" or "describe your idea"; instead ask "what is the most important feature?"
* Pay special attention to any documentation or information that the project might require (such as accessing a custom API, etc). Be sure to ask the user to provide information and examples that the developers will need to build the proof-of-concept. You will need to output all of this in the final specification.
* This is a a prototype project, it is important to have small and well-defined scope. If the scope seems to grow too large (beyond a week or two of work for one developer), ask the user if they can simplify the project.

View File

@@ -10,7 +10,10 @@ Development process of this app was split into smaller tasks. Here is the list o
{% endfor %}
```
You are currently working on task "{{ current_task.description }}" and you have to focus only on that task.
You are currently working on, and have to focus only on, this task:
```
{{ current_task.description }}
```
A part of the app is already finished.
{% include "partials/files_list.prompt" %}

View File

@@ -8,7 +8,11 @@ Development process of this app was split into smaller tasks. Here is the list o
{{ loop.index }}. {{ task.description }}
{% endfor %}
```
You are currently working on task "{{ state.current_task.description }}" and you have to focus only on that task.
You are currently working on, and have to focus only on, this task:
```
{{ current_task.description }}
```
{% endif %}
A part of the app is already finished.

View File

@@ -17,7 +17,7 @@
"agent": {
"default": {
"provider": "openai",
"model": "gpt-4-turbo",
"model": "gpt-4-turbo-preview",
"temperature": 0.5
},
"CodeMonkey.describe_files": {