From ebdafd0ed1a1f29dd1a78d602ee2c65c005e09bd Mon Sep 17 00:00:00 2001 From: LeonOstrez Date: Mon, 22 Jan 2024 12:43:48 -0800 Subject: [PATCH 1/2] make more detailed tasks descriptions and programmatic_goal --- pilot/const/function_calls.py | 6 ++-- pilot/prompts/components/project_tasks.prompt | 29 ++++++++++++++++--- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/pilot/const/function_calls.py b/pilot/const/function_calls.py index 6e4235d234..1e3e4bdeba 100644 --- a/pilot/const/function_calls.py +++ b/pilot/const/function_calls.py @@ -458,15 +458,15 @@ DEVELOPMENT_PLAN = { "description": 'List of development tasks that need to be done to implement the entire plan.', "items": { "type": "object", - 'description': 'Development task that needs to be done to implement the entire plan.', + 'description': 'Development task that needs to be done to implement the entire plan. It contains all details that developer who is not familiar with project needs to know to implement the task.', 'properties': { 'description': { 'type': 'string', - 'description': 'Description of the development task that needs to be done to implement the entire plan.', + 'description': 'Very detailed description of the development task that needs to be done to implement the entire plan.', }, 'programmatic_goal': { 'type': 'string', - 'description': 'Detailed description of programmatic goal. Programmatic goal that will determine if a task can be marked as done from a programmatic perspective (this will result in an automated test that is run before the task is sent to you for a review). All details previously specified by user that are important for this task must be included in this programmatic goal.', + 'description': 'Very detailed description of programmatic goal. Programmatic goal that will determine if a task can be marked as done from a programmatic perspective. All details previously specified by user that are important for this task must be included in this programmatic goal.', }, 'user_review_goal': { 'type': 'string', diff --git a/pilot/prompts/components/project_tasks.prompt b/pilot/prompts/components/project_tasks.prompt index 051f5c9e95..3e30d60c94 100644 --- a/pilot/prompts/components/project_tasks.prompt +++ b/pilot/prompts/components/project_tasks.prompt @@ -11,7 +11,9 @@ Rule #1 There should never be a task that is only testing or ensuring something works, every task must have coding involved. Have this in mind for every task, but it is extremely important for last task of project. Testing if {{ task_type }} works will be done as part of each task. Rule #2 -You have to make sure the project is not split into tasks that are too small or simple for no reason but also not too big or complex so that they are hard to develop, debug and review. Here are examples of poorly created tasks: +You have to make sure the project is not split into tasks that are too small or simple for no reason but also not too big or complex so that they are hard to develop, debug and review. +Have in mind that project already has workspace folder created and only system dependencies installed. You don't have to create tasks for that. +Here are examples of poorly created tasks: **too simple tasks** - Set up a Node.js project and install all necessary dependencies. @@ -31,12 +33,31 @@ Every {{ task_type }} should have different number of tasks depending on complex Example #1: app description: "I want to create an app that will just say 'Hello World' when I open it on my localhost:3000." -number of tasks: 1-3 +number of tasks: 1-2 Example #2: app description: "Create a node.js app that enables users to register and log into the app. On frontend it should have /home (shows user data), /register and /login. It should use sessions to keep user logged in." -number of tasks: 2-6 +number of tasks: 2-4 Example #3: app description: "A cool online shoe store, with a sleek look. In terms of data models, there are shoes, categories and user profiles. For web pages: product listing, details, shopping cart. It must look cool and jazzy." -number of tasks: 5-15 \ No newline at end of file +number of tasks: 5-15 + +Rule #4 +This rule applies to both 'description' and 'programmatic_goal'. +Every task must have a clear and very detailed (must be minimum of 4 sentences but can be more) 'description' and 'programmatic_goal'. It must be very clear so that even developers who just moved to this project can execute them without additional questions. It is not enough to just write "Create a route for /home". You have to describe what needs to be done in that route, what data needs to be returned, what should be the status code, etc. Give as many details as possible and make sure no information is missing that could be needed for this task. +Here are some examples of good and bad task descriptions: + +**bad task** +{ + "description": "Create a route for /dashboard", + "programmatic_goal": "In 'route.js', the route is created for /dashboard", + "user_review_goal": "Reviewer should confirming the /dashboard endpoint is working correct." +} + +**good task** +{ + "description": "Create a route for /dashboard that returns the status 200 and a message "Hello World". Route should be accessible only for logged in users. If user is not logged in, it should redirect to /login. If user is logged in, it should return the user data. User data should be fetched from database using the user id from session.", + "programmatic_goal": "In 'route.js' add a route for /dashboard that returns the status 200. In 'middlewares.js' there should be a check if user is logged in using session. If user is not logged in, it should redirect the user to /login. If user is logged in, it should open dashboard with all the user data. First get user data from database 'users' collection, filter only data needed for dashboard and send it to frontend.", + "user_review_goal": "Reviewer should be able to navigate to '/dashboard' page without error. If user is logged in it should show user data, if not it should redirect to /login." +} From a55757c71fdeccd7cffe0ea9cfa088d5703b9017 Mon Sep 17 00:00:00 2001 From: LeonOstrez Date: Mon, 22 Jan 2024 13:07:47 -0800 Subject: [PATCH 2/2] remove programmatic_goal from tasks creation --- pilot/const/function_calls.py | 6 +----- pilot/helpers/agents/test_TechLead.py | 1 - pilot/helpers/test_Project.py | 1 - pilot/prompts/components/project_tasks.prompt | 12 ++++++------ pilot/utils/test_llm_connection.py | 5 ----- 5 files changed, 7 insertions(+), 18 deletions(-) diff --git a/pilot/const/function_calls.py b/pilot/const/function_calls.py index 1e3e4bdeba..fd6ad2b55a 100644 --- a/pilot/const/function_calls.py +++ b/pilot/const/function_calls.py @@ -464,16 +464,12 @@ DEVELOPMENT_PLAN = { 'type': 'string', 'description': 'Very detailed description of the development task that needs to be done to implement the entire plan.', }, - 'programmatic_goal': { - 'type': 'string', - 'description': 'Very detailed description of programmatic goal. Programmatic goal that will determine if a task can be marked as done from a programmatic perspective. All details previously specified by user that are important for this task must be included in this programmatic goal.', - }, 'user_review_goal': { 'type': 'string', 'description': 'User review goal that will determine if a task is done or not, but from a user perspective since it will be reviewed by a human.', } }, - 'required': ['description', 'programmatic_goal', 'user_review_goal'], + 'required': ['description', 'user_review_goal'], }, }, }, diff --git a/pilot/helpers/agents/test_TechLead.py b/pilot/helpers/agents/test_TechLead.py index 158b45c8c9..3b3101bef9 100644 --- a/pilot/helpers/agents/test_TechLead.py +++ b/pilot/helpers/agents/test_TechLead.py @@ -65,5 +65,4 @@ The development process will include the creation of user stories and tasks, bas # Then assert development_plan is not None assert_non_empty_string(development_plan[0]['description']) - assert_non_empty_string(development_plan[0]['programmatic_goal']) assert_non_empty_string(development_plan[0]['user_review_goal']) diff --git a/pilot/helpers/test_Project.py b/pilot/helpers/test_Project.py index 33ff7d28b3..18d57f8e1d 100644 --- a/pilot/helpers/test_Project.py +++ b/pilot/helpers/test_Project.py @@ -355,7 +355,6 @@ class TestProjectFileLists: project.project_description = 'Test Project' project.development_plan = [{ 'description': 'Test User Story', - 'programmatic_goal': 'Test Programmatic Goal', 'user_review_goal': 'Test User Review Goal', }] diff --git a/pilot/prompts/components/project_tasks.prompt b/pilot/prompts/components/project_tasks.prompt index 3e30d60c94..ce766a74e8 100644 --- a/pilot/prompts/components/project_tasks.prompt +++ b/pilot/prompts/components/project_tasks.prompt @@ -11,6 +11,7 @@ Rule #1 There should never be a task that is only testing or ensuring something works, every task must have coding involved. Have this in mind for every task, but it is extremely important for last task of project. Testing if {{ task_type }} works will be done as part of each task. Rule #2 +This rule applies to the complexity of tasks. You have to make sure the project is not split into tasks that are too small or simple for no reason but also not too big or complex so that they are hard to develop, debug and review. Have in mind that project already has workspace folder created and only system dependencies installed. You don't have to create tasks for that. Here are examples of poorly created tasks: @@ -29,6 +30,7 @@ You must to avoid creating tasks that are too simple or too complex. You have to - Establish a MongoDB database connection and implement the message schema using Mongoose for persistent storage of messages. Rule #3 +This rule applies to the number of tasks you will create. Every {{ task_type }} should have different number of tasks depending on complexity. Think task by task and create the minimum number of tasks that are relevant for this specific {{ task_type }}.{% if task_type == 'feature' %} If the feature is small, it is ok to have only 1 task.{% endif %} Here are some examples of apps with different complexity that can give you guidance on how many tasks you should create: Example #1: @@ -44,20 +46,18 @@ app description: "A cool online shoe store, with a sleek look. In terms of data number of tasks: 5-15 Rule #4 -This rule applies to both 'description' and 'programmatic_goal'. -Every task must have a clear and very detailed (must be minimum of 4 sentences but can be more) 'description' and 'programmatic_goal'. It must be very clear so that even developers who just moved to this project can execute them without additional questions. It is not enough to just write "Create a route for /home". You have to describe what needs to be done in that route, what data needs to be returned, what should be the status code, etc. Give as many details as possible and make sure no information is missing that could be needed for this task. -Here are some examples of good and bad task descriptions: +This rule applies to writing task 'description'. +Every task must have a clear and very detailed (must be minimum of 4 sentences but can be more) 'description'. It must be very clear so that even developers who just moved to this project can execute them without additional questions. It is not enough to just write something like "Create a route for /home". You have to describe what needs to be done in that route, what data needs to be returned, what should be the status code, etc. Give as many details as possible and make sure no information is missing that could be needed for this task. +Here is an example of good and bad task description: **bad task** { "description": "Create a route for /dashboard", - "programmatic_goal": "In 'route.js', the route is created for /dashboard", "user_review_goal": "Reviewer should confirming the /dashboard endpoint is working correct." } **good task** { - "description": "Create a route for /dashboard that returns the status 200 and a message "Hello World". Route should be accessible only for logged in users. If user is not logged in, it should redirect to /login. If user is logged in, it should return the user data. User data should be fetched from database using the user id from session.", - "programmatic_goal": "In 'route.js' add a route for /dashboard that returns the status 200. In 'middlewares.js' there should be a check if user is logged in using session. If user is not logged in, it should redirect the user to /login. If user is logged in, it should open dashboard with all the user data. First get user data from database 'users' collection, filter only data needed for dashboard and send it to frontend.", + "description": "In 'route.js' add a route for /dashboard that returns the status 200. Route should be accessible only for logged in users. In 'middlewares.js' there should be a check if user is logged in using session. If user is not logged in, it should redirect to /login. If user is logged in, it should return the user data. User data should be fetched from database in 'users' collection using the user id from session.", "user_review_goal": "Reviewer should be able to navigate to '/dashboard' page without error. If user is logged in it should show user data, if not it should redirect to /login." } diff --git a/pilot/utils/test_llm_connection.py b/pilot/utils/test_llm_connection.py index 50c28e3736..6d7ba9d207 100644 --- a/pilot/utils/test_llm_connection.py +++ b/pilot/utils/test_llm_connection.py @@ -338,22 +338,18 @@ class TestSchemaValidation: "plan": [ { "description": "Set up project structure including creation of necessary directories and files. Initialize Node.js and install necessary libraries such as express and socket.io.", - "programmatic_goal": "Project structure should be set up and Node.js initialized. Express and socket.io libraries should be installed and reflected in the package.json file.", "user_review_goal": "Developer should be able to start an empty express server by running `npm start` command without any errors." }, { "description": "Create a simple front-end HTML page with CSS and JavaScript that includes input for typing messages and area for displaying messages.", - "programmatic_goal": "There should be an HTML file containing an input box for typing messages and an area for displaying the messages. This HTML page should be served when user navigates to the root URL.", "user_review_goal": "Navigating to the root URL (http://localhost:3000) should display the chat front-end with an input box and a message area." }, { "description": "Set up socket.io on the back-end to handle websocket connections and broadcasting messages to the clients.", - "programmatic_goal": "Server should be able to handle websocket connections using socket.io and broadcast messages to all connected clients.", "user_review_goal": "By using two different browsers or browser tabs, when one user sends a message from one tab, it should appear in the other user's browser tab in real-time." }, { "description": "Integrate front-end with socket.io client to send messages from the input field to the server and display incoming messages in the message area.", - "programmatic_goal": "Front-end should be able to send messages to server and display incoming messages in the message area using socket.io client.", "user_review_goal": "Typing a message in the chat input and sending it should then display the message in the chat area." } ] @@ -556,5 +552,4 @@ The development process will include the creation of user stories and tasks, bas assert response is not None response = parse_agent_response(response, function_calls) assert_non_empty_string(response['plan'][0]['description']) - assert_non_empty_string(response['plan'][0]['programmatic_goal']) assert_non_empty_string(response['plan'][0]['user_review_goal'])