-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Update Opt Code #1720
base: main
Are you sure you want to change the base?
Update Opt Code #1720
Conversation
def _get_file_path(self, id): | ||
return os.path.join(self.root_path, f"round_{id}") | ||
|
||
def select_node(self, k=3): |
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.
search module should take care of node selection
@@ -0,0 +1,558 @@ | |||
{ |
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.
execution output should not be committed
metagpt/ext/opt_code/memory/tree.py
Outdated
pass | ||
|
||
@abstractmethod | ||
def select(self) -> TreeNode: |
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.
select method should belong to search algorithm?
Move 'select' to search module, and fix some directory bugs.
Features
Feature Docs
python -m metagpt.ext.opt_code.main
运行Update 03.21
更新内容:
MetaAgent
负责控制整个流程,为了将 Agent 划分成搜索过程中的独立主体,整个搜索逻辑如下:search_algorithm/tree_search.py
中的TreeSearch
类派生出AFlowSearch
和SelaSearch
,子类中主要实现select
、_prepare
、_expand
、_update_global_context
四种方法,其中_prepare
为 Agent 提供被实验的节点和上下文信息。只变动父类的select_with_strategy
方法可以实现简单的搜索策略的变更。memory/tree.py
中的TreeNode
类派生出AFlowNode
和SelaNode
,子类中主要实现update_from_child
、update_from_results
(从 Agent 输出结果更新节点)、extend_child
(针对 SELA,先有 action 后再 expand 节点)方法。Tree
类派生出的AFlowMemory
和SelaMemory
只需要实现init_root_node
方法即可。opt_roles/experimenter.py
中的Experimenter
类派生出AFlowRole
和SelaRole
,前者用ActionNode
实现代码的生成,而后者利用DataInterpreter
进行多步决策来生成完整的 notebook 代码,二者逻辑很难统一。需要补充的内容:
Evaluator
类负责。