-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/plan and solve #125
Feat/plan and solve #125
Conversation
Apply Sweep Rules to your PR?
This is an automated message generated by Sweep AI. |
Walkthroughこのプルリクエストでは、開発計画の再計画と詳細なテンプレート作成機能が追加され、新たなパラメータ Changes
Uplevel your code reviews with CodeRabbit ProCodeRabbit ProIf you like this project, please support us by purchasing the Pro version. The Pro version has advanced context, superior noise reduction and several proprietary improvements compared to the open source version. Moreover, CodeRabbit Pro is free for open source projects. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Files selected (10)
- gpt_all_star/core/agents/chain.py (2)
- gpt_all_star/core/project.py (2)
- gpt_all_star/core/steps/development/development.py (1)
- gpt_all_star/core/steps/development/planning_prompt.py (1)
- gpt_all_star/core/steps/development/replanning_prompt.py (1)
- gpt_all_star/core/steps/specification/additional_tasks.py (1)
- gpt_all_star/core/steps/step.py (1)
- gpt_all_star/core/steps/steps.py (1)
- gpt_all_star/core/team.py (6)
- gpt_all_star/main.py (1)
Review comments generated (18)
- Review: 8
- LGTM: 10
Tips
Chat with CodeRabbit Bot (@coderabbitai
)
- Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
- Invite the bot into a review comment chain by tagging
@coderabbitai
in a reply.
Code suggestions
- The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
- You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.
Pausing incremental reviews
- Add
@coderabbitai: ignore
anywhere in the PR description to pause further reviews from the bot.
@@ -10,6 +10,7 @@ def __init__( | |||
) -> None: | |||
super().__init__(copilot) | |||
self.working_directory = self.copilot.storages.app.path.absolute() | |||
self.plan_and_solve = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def create_replanning_chain(self, profile: str = ""): | ||
system_prompt = f"""{profile} | ||
Based on the user request provided and the current implementation, your task is to update the original plan that includes following items: | ||
- action: it must be one of {", ".join(ACTIONS)} | ||
- working_directory: a directory where the command is to be executed or the file is to be placed, it should be started from '.', e.g. './src' | ||
- filename: specify only if the name of the file to be added or changed is specifically determined | ||
- command: command to be executed if necessary | ||
- context: all contextual information that should be communicated to the person performing the task | ||
- objective: very detailed description of the objective to be achieved for the task to be executed to accomplish the entire plan | ||
- reason: clear reasons why the task should be performed | ||
|
||
If no more steps are needed and you can return to the user, then respond with that. | ||
Otherwise, fill out the plan. | ||
""" | ||
function_def = { | ||
"name": "replanning", | ||
"description": "Create the replan.", | ||
"parameters": { | ||
"title": "planSchema", | ||
"type": "object", | ||
"properties": { | ||
"plan": { | ||
"type": "array", | ||
"items": { | ||
"type": "object", | ||
"description": "Task to do.", | ||
"properties": { | ||
"action": { | ||
"type": "string", | ||
"description": "Task", | ||
"anyOf": [ | ||
{"enum": ACTIONS}, | ||
], | ||
}, | ||
"working_directory": { | ||
"type": "string", | ||
"description": "Directory where the command is to be executed or the file is to be located, it should be started from '.', e.g. './src'", | ||
}, | ||
"filename": { | ||
"type": "string", | ||
"description": "Specify only if the name of the file to be added or changed is specifically determined", | ||
}, | ||
"command": { | ||
"type": "string", | ||
"description": "Command to be executed if necessary", | ||
}, | ||
"context": { | ||
"type": "string", | ||
"description": "All contextual information that should be communicated to the person performing the task", | ||
}, | ||
"objective": { | ||
"type": "string", | ||
"description": "Very detailed description of the goals to be achieved for the task to be executed to accomplish the entire plan", | ||
}, | ||
"reason": { | ||
"type": "string", | ||
"reason": "Clear reasons why the task should be performed", | ||
}, | ||
}, | ||
}, | ||
} | ||
}, | ||
"required": ["plan"], | ||
}, | ||
} | ||
prompt = ChatPromptTemplate.from_messages( | ||
[ | ||
("system", system_prompt), | ||
MessagesPlaceholder(variable_name="messages"), | ||
( | ||
"system", | ||
""" | ||
Given the conversation above, update the original plan to fully meet the user's requirements." | ||
""", | ||
), | ||
] | ||
).partial() | ||
|
||
return ( | ||
prompt | ||
| self._llm.bind_functions( | ||
functions=[function_def], function_call="replanning" | ||
) | ||
| JsonOutputFunctionsParser() | ||
) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
plan_and_solve: bool = False, | ||
) -> None: | ||
self.copilot = Copilot() | ||
self.start_time = None | ||
self.plan_and_solve = plan_and_solve |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -118,6 +120,7 @@ def start(self) -> None: | |||
copilot=self.copilot, | |||
members=self.agents, | |||
japanese_mode=self.japanese_mode, | |||
plan_and_solve=self.plan_and_solve, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
plan_and_solve: bool = False, | ||
): | ||
self.japanese_mode = japanese_mode | ||
self.plan_and_solve = plan_and_solve |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MAX_REPLANNING = 5 | ||
replanning = 0 | ||
completed_plan = [] | ||
while len(tasks["plan"]) > 0: | ||
task = tasks["plan"][0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Task: {todo} | ||
Context: {task['context']} | ||
Objective: {task['objective']} | ||
Reason: {task['reason']} | ||
--- | ||
""" | ||
) | ||
else: | ||
self.supervisor.state(f"({(i+1)}/{len(tasks['plan'])}) {todo}") | ||
self.supervisor.state( | ||
f"({(1/len(tasks['plan']) * 100):.1f}%) {todo}" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tasks["plan"].pop(0) | ||
|
||
if ( | ||
self.plan_and_solve | ||
and step_plan_and_solve | ||
and replanning < MAX_REPLANNING | ||
): | ||
completed_plan.append(task) | ||
tasks = ( | ||
Chain() | ||
.create_replanning_chain(self.supervisor.profile) | ||
.invoke( | ||
{ | ||
"messages": [ | ||
Message.create_human_message( | ||
replanning_template.format( | ||
original_plan=tasks, | ||
completed_plan=completed_plan, | ||
implementation=self.copilot.storages.current_source_code(), | ||
specifications=self.copilot.storages.docs.get( | ||
"specifications.md", "N/A" | ||
), | ||
technologies=self.copilot.storages.docs.get( | ||
"technologies.md", "N/A" | ||
), | ||
) | ||
) | ||
], | ||
} | ||
) | ||
) | ||
replanning += 1 | ||
if self.supervisor.debug_mode: | ||
self.supervisor.console.print( | ||
json.dumps(tasks, indent=4, ensure_ascii=False) | ||
) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary by CodeRabbit
create_replanning_chain
関数と開発計画の詳細なテンプレート作成機能を追加しました。これにより、ユーザーの要求と現在の実装に基づいて元の計画を更新するタスクを生成し、開発計画を詳細に作成することが可能になりました。plan_and_solve
を導入しました。これにより、タスクの再計画が可能になり、アプリケーションの仕様が明確化されました。StepType
列挙型からUIDesign
を削除し、ステップのタイプとタスクリストを変更しました。