From b5a5297ec54dff3d7a3ff158134abf7cd600961d Mon Sep 17 00:00:00 2001 From: Zvonimir Sabljic Date: Mon, 31 Jul 2023 10:01:20 +0200 Subject: [PATCH] Implemented getting development plan + outline for AgentConvo class --- euclid/const/function_calls.py | 39 +++++++++++++++++++++++++ euclid/main.py | 4 +-- euclid/prompts/development/plan.prompt | 2 +- euclid/steps/development/development.py | 24 ++++++++++++--- 4 files changed, 62 insertions(+), 7 deletions(-) diff --git a/euclid/const/function_calls.py b/euclid/const/function_calls.py index 525572f..aff4c45 100644 --- a/euclid/const/function_calls.py +++ b/euclid/const/function_calls.py @@ -73,4 +73,43 @@ COMMANDS_TO_RUN = { 'functions': { 'process_commands': run_commands }, +} + +DEVELOPMENT_PLAN = { + 'definitions': [{ + 'name': 'implement_development_plan', + 'description': 'Implements the development plan.', + 'parameters': { + 'type': 'object', + "properties": { + "plan": { + "type": "array", + "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.', + 'properties': { + 'task_description': { + 'type': 'string', + 'description': 'Description of the development task that needs to be done to implement the entire plan.', + }, + 'programmatic_goal': { + 'type': 'string', + 'description': '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)', + }, + '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': ['command', 'timeout'], + }, + }, + }, + "required": ['plan'], + }, + }], + 'functions': { + 'implement_development_plan': lambda plan: (plan, None) + }, } \ No newline at end of file diff --git a/euclid/main.py b/euclid/main.py index 17d074c..d8e429c 100644 --- a/euclid/main.py +++ b/euclid/main.py @@ -36,12 +36,12 @@ if __name__ == "__main__": architecture, architecture_messages = get_architecture(high_level_summary, user_stories, user_tasks, args) - development_plan, development_plan_messages = create_development_plan(user_stories, user_tasks, architecture, args) - # TODO REMOVE THIS architecture = architecture.split('\n') # TODO END + development_plan = create_development_plan(high_level_summary, user_stories, user_tasks, architecture, args) + set_up_environment(architecture, args); start_development(user_stories, user_tasks, architecture, args) diff --git a/euclid/prompts/development/plan.prompt b/euclid/prompts/development/plan.prompt index c155216..324cf32 100644 --- a/euclid/prompts/development/plan.prompt +++ b/euclid/prompts/development/plan.prompt @@ -2,7 +2,7 @@ You are working in a software development agency and a project manager and softw Here is a high level description of Euclid: ``` -{{ prompt }} +{{ app_summary }} ``` Here are some additional questions and answers to clarify the apps description: diff --git a/euclid/steps/development/development.py b/euclid/steps/development/development.py index dfa6480..3e3ca00 100644 --- a/euclid/steps/development/development.py +++ b/euclid/steps/development/development.py @@ -1,11 +1,12 @@ import json from termcolor import colored +from helpers.AgentConvo import AgentConvo from utils.utils import execute_step, find_role_from_step, generate_app_data from database.database import save_progress, get_progress_steps from logger.logger import logger from prompts.prompts import get_additional_info_from_user, execute_chat_prompt -from const.function_calls import FILTER_OS_TECHNOLOGIES, COMMANDS_TO_RUN +from const.function_calls import FILTER_OS_TECHNOLOGIES, DEVELOPMENT_PLAN from const.code_execution import MAX_COMMAND_DEBUG_TRIES from utils.utils import get_os_info from helpers.cli import execute_command @@ -155,9 +156,9 @@ def set_up_environment(technologies, args): # ENVIRONMENT SETUP END -def create_development_plan(user_stories, user_tasks, technologies_to_use, args): +def create_development_plan(high_level_summary, user_stories, user_tasks, technologies_to_use, args): current_step = 'development_planning' - role = find_role_from_step(current_step) + convo_development_plan = AgentConvo(current_step) steps = get_progress_steps(args['app_id'], current_step) if steps and not execute_step(args['step'], current_step): @@ -177,8 +178,23 @@ def create_development_plan(user_stories, user_tasks, technologies_to_use, args) print(colored(f"Starting to create the action plan for development...\n", "green")) logger.info(f"Starting to create the action plan for development...") + # TODO add clarifications + development_plan = convo_development_plan.send_message('development/plan.prompt', + { + "app_summary": high_level_summary, + "clarification": [], + "user_stories": user_stories.split('\n\n'), + "user_tasks": user_tasks.split('\n\n'), + "technologies": technologies_to_use + }, DEVELOPMENT_PLAN) - pass + logger.info('Plan for development is created.') + + save_progress(args['app_id'], current_step, { + "development_plan": development_plan, "app_data": generate_app_data(args) + }) + + return development_plan def start_development(user_stories, user_tasks, technologies_to_use, args): pass \ No newline at end of file