-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[Enhancement 3.2 3.3] COT, TOT strategy for engineer role #341
base: main
Are you sure you want to change the base?
Conversation
|
||
import asyncio | ||
|
||
@pytest.mark.asyncio |
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.
PEP8
@@ -0,0 +1,29 @@ | |||
#!/usr/bin/env python | |||
# -*- coding: utf-8 -*- |
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.
加上合适的带作者的文件头
metagpt/actions/action.py
Outdated
@@ -39,11 +41,20 @@ def __str__(self): | |||
def __repr__(self): | |||
return self.__str__() | |||
|
|||
async def _aask(self, prompt: str, system_msgs: Optional[list[str]] = None) -> str: | |||
async def _aask(self, prompt: str, strategy: PromptStrategyType = None, task: Task = None, system_msgs: Optional[list[str]] = None) -> str: |
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.
使用Optional装饰可能None的字段
metagpt/actions/action.py
Outdated
task.task_args_pool[output_key] = await self._aask(PROMPT) | ||
prompt = PROMPT | ||
elif strategy == PromptStrategyType.TREE_OF_THOUGHT: | ||
pass |
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.
这里应该要raise SomeException
@@ -0,0 +1,12 @@ | |||
from typing import Dict |
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.
需要合适的文件头
ATTENTION: Use '##' to SPLIT SECTIONS, not '#'. Output format carefully referenced "Format example". | ||
----- | ||
## Step by Step Implementation Plan: {filename} | ||
""" |
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.
我比较建议如果是写代码,建议这里就直接让它写伪代码
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.
并且在伪代码上加合适的注释,或者写多份伪代码
metagpt/actions/write_code.py
Outdated
}, | ||
# an ordered list of prompt output keys | ||
task_output_keys = ["plan", "code"]) | ||
code = await self.write_code('', strategy = strategy, task = task) |
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.
没有处理TOT等其他状态
|
||
for _ in max_num_rounds: | ||
for prompt_template, step_output in zip(self.task.prompts, self.task.task_output_keys): | ||
message = self.prompter.generate_initial_prompt(prompt_template, **self.task.task_args_pool) |
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.
what is prompter? I think init first would be better
@@ -0,0 +1,31 @@ | |||
class ChainOfThoughtBase(object): |
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.
from abc import ABC
class ChainOfThoughtBase(ABC):
Please resolve all conflicts and Review comments @LeonZh0u |
WIP implemented COT, will push TOT if the current way of calling aask() makes sense