mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-04-25 00:36:55 +02:00
Update Readme News & Update AFLOW's entrance.
This commit is contained in:
parent
dbfd37bb4d
commit
bbb087b5c3
10 changed files with 78 additions and 362 deletions
|
|
@ -27,6 +27,8 @@ # MetaGPT: The Multi-Agent Framework
|
|||
</p>
|
||||
|
||||
## News
|
||||
🚀 Oct. 29, 2024: We introduce three papers: [AFLOW: Automating Agentic Workflow Generation](https://arxiv.org/abs/2410.10762), [FACT: Examining the Effectiveness of Iterative Context Rewriting for Multi-fact Retrieval](https://arxiv.org/abs/2410.21012), and [SELA: Tree-Search Enhanced LLM Agents for Automated Machine Learning](https://arxiv.org/abs/2410.17238), along with code implementations available in the `examples` directory. Welcome your usage and feedback!
|
||||
|
||||
🚀 Mar. 29, 2024: [v0.8.0](https://github.com/geekan/MetaGPT/releases/tag/v0.8.0) released. Now you can use Data Interpreter ([arxiv](https://arxiv.org/abs/2402.18679), [example](https://docs.deepwisdom.ai/main/en/DataInterpreter/), [code](https://github.com/geekan/MetaGPT/tree/main/examples/di)) via pypi package import. Meanwhile, we integrated the RAG module and supported multiple new LLMs.
|
||||
|
||||
🚀 Feb. 08, 2024: [v0.7.0](https://github.com/geekan/MetaGPT/releases/tag/v0.7.0) released, supporting assigning different LLMs to different Roles. We also introduced [Data Interpreter](https://github.com/geekan/MetaGPT/blob/main/examples/di/README.md), a powerful agent capable of solving a wide range of real-world problems.
|
||||
|
|
|
|||
|
|
@ -37,15 +37,14 @@ ## Quick Start
|
|||
1. Configure optimization parameters:
|
||||
- Use command line arguments or modify default parameters in `examples/aflow/optimize.py`:
|
||||
```python
|
||||
--dataset MATH # Dataset type (HumanEval/MBPP/GSM8K/MATH/HotpotQA/DROP)
|
||||
--dataset # (Required) Dataset type (HumanEval/MBPP/GSM8K/MATH/HotpotQA/DROP)
|
||||
--sample 4 # Sample count - number of workflows to be resampled
|
||||
--question_type math # Question type (math/code/qa)
|
||||
--optimized_path PATH # Optimized result save path
|
||||
--initial_round 1 # Initial round
|
||||
--max_rounds 20 # Max iteration rounds for AFLOW
|
||||
--check_convergence # Whether to enable early stop
|
||||
--validation_rounds 5 # Validation rounds for AFLOW
|
||||
--if_first_optimize # Set True for first optimization, False afterwards
|
||||
--if_first_optimize # Set True for first optimization, False afterwards
|
||||
```
|
||||
|
||||
2. Configure LLM parameters in `config/config2.yaml` (see `examples/aflow/config2.example.yaml` for reference)
|
||||
|
|
@ -61,15 +60,15 @@ ## Quick Start
|
|||
7. Run the optimization:
|
||||
```bash
|
||||
# Using default parameters
|
||||
python -m examples.aflow.optimize
|
||||
python -m examples.aflow.optimize --dataset MATH
|
||||
|
||||
# Or with custom parameters
|
||||
python -m examples.aflow.optimize --dataset MATH --sample 4 --question_type math
|
||||
python -m examples.aflow.optimize --dataset MATH --sample n --optimized_path xxx ...
|
||||
```
|
||||
|
||||
## Reproduce the Results in the Paper
|
||||
1. We provide the raw data obtained from our experiments in this [link](https://drive.google.com/uc?export=download&id=1Sr5wjgKf3bN8OC7G6cO3ynzJqD4w6_Dv), including the workflows and prompts generated in each iteration, as well as their trajectories on the validation dataset. We also provide the optimal workflow for each dataset and the corresponding data on the test dataset. You can download these data using `metagpt/ext/aflow/data/download_data.py`.
|
||||
2. You can directly reproduce our experimental results by running the scripts in `examples/aflow/experiments`.
|
||||
2. You can directly reproduce our experimental results by use different `ExperimentConfig` of `examples/aflow/optimize.py`.
|
||||
|
||||
|
||||
## Citation
|
||||
|
|
|
|||
|
|
@ -1,53 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# @Date : 8/23/2024 20:00 PM
|
||||
# @Author : didi
|
||||
# @Desc : Entrance of AFlow.
|
||||
|
||||
import argparse
|
||||
|
||||
from metagpt.configs.models_config import ModelsConfig
|
||||
from metagpt.ext.aflow.scripts.evaluator import Optimizer
|
||||
|
||||
|
||||
def parse_args():
|
||||
parser = argparse.ArgumentParser(description="AFlow Optimizer for DROP")
|
||||
parser.add_argument("--dataset", type=str, default="DROP", help="Dataset type")
|
||||
parser.add_argument("--sample", type=int, default=4, help="Sample count")
|
||||
parser.add_argument("--question_type", type=str, default="qa", help="Question type")
|
||||
parser.add_argument(
|
||||
"--optimized_path", type=str, default="metagpt/ext/aflow/scripts/optimized", help="Optimized result save path"
|
||||
)
|
||||
parser.add_argument("--initial_round", type=int, default=1, help="Initial round")
|
||||
parser.add_argument("--max_rounds", type=int, default=20, help="Max iteration rounds")
|
||||
parser.add_argument("--check_convergence", type=bool, default=True, help="Whether to enable early stop")
|
||||
parser.add_argument("--validation_rounds", type=int, default=5, help="Validation rounds")
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
args = parse_args()
|
||||
|
||||
mini_llm_config = ModelsConfig.default().get("gpt-4o-mini")
|
||||
claude_llm_config = ModelsConfig.default().get("claude-3-5-sonnet-20240620")
|
||||
|
||||
operators = [
|
||||
"Custom",
|
||||
"AnswerGenerate",
|
||||
"ScEnsemble",
|
||||
]
|
||||
|
||||
optimizer = Optimizer(
|
||||
dataset=args.dataset,
|
||||
question_type=args.question_type,
|
||||
opt_llm_config=claude_llm_config,
|
||||
exec_llm_config=mini_llm_config,
|
||||
check_convergence=args.check_convergence,
|
||||
operators=operators,
|
||||
optimized_path=args.optimized_path,
|
||||
sample=args.sample,
|
||||
initial_round=args.initial_round,
|
||||
max_rounds=args.max_rounds,
|
||||
validation_rounds=args.validation_rounds,
|
||||
)
|
||||
|
||||
optimizer.optimize("Graph")
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# @Date : 8/23/2024 20:00 PM
|
||||
# @Author : didi
|
||||
# @Desc : Entrance of AFlow.
|
||||
|
||||
import argparse
|
||||
|
||||
from metagpt.configs.models_config import ModelsConfig
|
||||
from metagpt.ext.aflow.scripts.evaluator import Optimizer
|
||||
|
||||
|
||||
def parse_args():
|
||||
parser = argparse.ArgumentParser(description="AFlow Optimizer for GSM8K")
|
||||
parser.add_argument("--dataset", type=str, default="GSM8K", help="Dataset type")
|
||||
parser.add_argument("--sample", type=int, default=4, help="Sample count")
|
||||
parser.add_argument("--question_type", type=str, default="math", help="Question type")
|
||||
parser.add_argument(
|
||||
"--optimized_path", type=str, default="metagpt/ext/aflow/scripts/optimized", help="Optimized result save path"
|
||||
)
|
||||
parser.add_argument("--initial_round", type=int, default=1, help="Initial round")
|
||||
parser.add_argument("--max_rounds", type=int, default=20, help="Max iteration rounds")
|
||||
parser.add_argument("--check_convergence", type=bool, default=True, help="Whether to enable early stop")
|
||||
parser.add_argument("--validation_rounds", type=int, default=5, help="Validation rounds")
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
args = parse_args()
|
||||
|
||||
mini_llm_config = ModelsConfig.default().get("gpt-4o-mini")
|
||||
claude_llm_config = ModelsConfig.default().get("claude-3-5-sonnet-20240620")
|
||||
|
||||
operators = [
|
||||
"Custom",
|
||||
"ScEnsemble",
|
||||
"Programmer",
|
||||
]
|
||||
|
||||
optimizer = Optimizer(
|
||||
dataset=args.dataset,
|
||||
question_type=args.question_type,
|
||||
opt_llm_config=claude_llm_config,
|
||||
exec_llm_config=mini_llm_config,
|
||||
check_convergence=args.check_convergence,
|
||||
operators=operators,
|
||||
optimized_path=args.optimized_path,
|
||||
sample=args.sample,
|
||||
initial_round=args.initial_round,
|
||||
max_rounds=args.max_rounds,
|
||||
validation_rounds=args.validation_rounds,
|
||||
)
|
||||
|
||||
optimizer.optimize("Graph")
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# @Date : 8/23/2024 20:00 PM
|
||||
# @Author : didi
|
||||
# @Desc : Entrance of AFlow.
|
||||
|
||||
import argparse
|
||||
|
||||
from metagpt.configs.models_config import ModelsConfig
|
||||
from metagpt.ext.aflow.scripts.evaluator import Optimizer
|
||||
|
||||
|
||||
def parse_args():
|
||||
parser = argparse.ArgumentParser(description="AFlow Optimizer for HotpotQA")
|
||||
parser.add_argument("--dataset", type=str, default="HotpotQA", help="Dataset type")
|
||||
parser.add_argument("--sample", type=int, default=4, help="Sample count")
|
||||
parser.add_argument("--question_type", type=str, default="qa", help="Question type")
|
||||
parser.add_argument(
|
||||
"--optimized_path", type=str, default="metagpt/ext/aflow/scripts/optimized", help="Optimized result save path"
|
||||
)
|
||||
parser.add_argument("--initial_round", type=int, default=1, help="Initial round")
|
||||
parser.add_argument("--max_rounds", type=int, default=20, help="Max iteration rounds")
|
||||
parser.add_argument("--check_convergence", type=bool, default=True, help="Whether to enable early stop")
|
||||
parser.add_argument("--validation_rounds", type=int, default=5, help="Validation rounds")
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
args = parse_args()
|
||||
|
||||
mini_llm_config = ModelsConfig.default().get("gpt-4o-mini")
|
||||
claude_llm_config = ModelsConfig.default().get("claude-3-5-sonnet-20240620")
|
||||
|
||||
operators = [
|
||||
"Custom",
|
||||
"AnswerGenerate",
|
||||
"ScEnsemble",
|
||||
]
|
||||
|
||||
optimizer = Optimizer(
|
||||
dataset=args.dataset,
|
||||
question_type=args.question_type,
|
||||
opt_llm_config=claude_llm_config,
|
||||
exec_llm_config=mini_llm_config,
|
||||
check_convergence=args.check_convergence,
|
||||
operators=operators,
|
||||
optimized_path=args.optimized_path,
|
||||
sample=args.sample,
|
||||
initial_round=args.initial_round,
|
||||
max_rounds=args.max_rounds,
|
||||
validation_rounds=args.validation_rounds,
|
||||
)
|
||||
|
||||
optimizer.optimize("Graph")
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# @Date : 8/23/2024 20:00 PM
|
||||
# @Author : didi
|
||||
# @Desc : Entrance of AFlow.
|
||||
|
||||
import argparse
|
||||
|
||||
from metagpt.configs.models_config import ModelsConfig
|
||||
from metagpt.ext.aflow.scripts.evaluator import Optimizer
|
||||
|
||||
|
||||
def parse_args():
|
||||
parser = argparse.ArgumentParser(description="AFlow Optimizer for HumanEval")
|
||||
parser.add_argument("--dataset", type=str, default="HumanEval", help="Dataset type")
|
||||
parser.add_argument("--sample", type=int, default=4, help="Sample count")
|
||||
parser.add_argument("--question_type", type=str, default="code", help="Question type")
|
||||
parser.add_argument(
|
||||
"--optimized_path", type=str, default="metagpt/ext/aflow/scripts/optimized", help="Optimized result save path"
|
||||
)
|
||||
parser.add_argument("--initial_round", type=int, default=1, help="Initial round")
|
||||
parser.add_argument("--max_rounds", type=int, default=20, help="Max iteration rounds")
|
||||
parser.add_argument("--check_convergence", type=bool, default=True, help="Whether to enable early stop")
|
||||
parser.add_argument("--validation_rounds", type=int, default=5, help="Validation rounds")
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
args = parse_args()
|
||||
|
||||
mini_llm_config = ModelsConfig.default().get("gpt-4o-mini")
|
||||
claude_llm_config = ModelsConfig.default().get("claude-3-5-sonnet-20240620")
|
||||
|
||||
operators = [
|
||||
"Custom",
|
||||
"CustomCodeGenerate",
|
||||
"ScEnsemble",
|
||||
"Test",
|
||||
]
|
||||
|
||||
optimizer = Optimizer(
|
||||
dataset=args.dataset,
|
||||
question_type=args.question_type,
|
||||
opt_llm_config=claude_llm_config,
|
||||
exec_llm_config=mini_llm_config,
|
||||
check_convergence=args.check_convergence,
|
||||
operators=operators,
|
||||
optimized_path=args.optimized_path,
|
||||
sample=args.sample,
|
||||
initial_round=args.initial_round,
|
||||
max_rounds=args.max_rounds,
|
||||
validation_rounds=args.validation_rounds,
|
||||
)
|
||||
|
||||
optimizer.optimize("Graph")
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# @Date : 8/23/2024 20:00 PM
|
||||
# @Author : didi
|
||||
# @Desc : Entrance of AFlow.
|
||||
|
||||
import argparse
|
||||
|
||||
from metagpt.configs.models_config import ModelsConfig
|
||||
from metagpt.ext.aflow.scripts.evaluator import Optimizer
|
||||
|
||||
|
||||
def parse_args():
|
||||
parser = argparse.ArgumentParser(description="AFlow Optimizer for MATH")
|
||||
parser.add_argument("--dataset", type=str, default="MATH", help="Dataset type")
|
||||
parser.add_argument("--sample", type=int, default=4, help="Sample count")
|
||||
parser.add_argument("--question_type", type=str, default="math", help="Question type")
|
||||
parser.add_argument(
|
||||
"--optimized_path", type=str, default="metagpt/ext/aflow/scripts/optimized", help="Optimized result save path"
|
||||
)
|
||||
parser.add_argument("--initial_round", type=int, default=1, help="Initial round")
|
||||
parser.add_argument("--max_rounds", type=int, default=20, help="Max iteration rounds")
|
||||
parser.add_argument("--check_convergence", type=bool, default=True, help="Whether to enable early stop")
|
||||
parser.add_argument("--validation_rounds", type=int, default=5, help="Validation rounds")
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
args = parse_args()
|
||||
|
||||
mini_llm_config = ModelsConfig.default().get("gpt-4o-mini")
|
||||
claude_llm_config = ModelsConfig.default().get("claude-3-5-sonnet-20240620")
|
||||
|
||||
operators = [
|
||||
"Custom",
|
||||
"ScEnsemble",
|
||||
"Programmer",
|
||||
]
|
||||
|
||||
optimizer = Optimizer(
|
||||
dataset=args.dataset,
|
||||
question_type=args.question_type,
|
||||
opt_llm_config=claude_llm_config,
|
||||
exec_llm_config=mini_llm_config,
|
||||
check_convergence=args.check_convergence,
|
||||
operators=operators,
|
||||
optimized_path=args.optimized_path,
|
||||
sample=args.sample,
|
||||
initial_round=args.initial_round,
|
||||
max_rounds=args.max_rounds,
|
||||
validation_rounds=args.validation_rounds,
|
||||
)
|
||||
|
||||
optimizer.optimize("Graph")
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# @Date : 8/23/2024 20:00 PM
|
||||
# @Author : didi
|
||||
# @Desc : Entrance of AFlow.
|
||||
|
||||
import argparse
|
||||
|
||||
from metagpt.configs.models_config import ModelsConfig
|
||||
from metagpt.ext.aflow.scripts.evaluator import Optimizer
|
||||
|
||||
|
||||
def parse_args():
|
||||
parser = argparse.ArgumentParser(description="AFlow Optimizer for MBPP")
|
||||
parser.add_argument("--dataset", type=str, default="MBPP", help="Dataset type")
|
||||
parser.add_argument("--sample", type=int, default=4, help="Sample count")
|
||||
parser.add_argument("--question_type", type=str, default="code", help="Question type")
|
||||
parser.add_argument(
|
||||
"--optimized_path", type=str, default="metagpt/ext/aflow/scripts/optimized", help="Optimized result save path"
|
||||
)
|
||||
parser.add_argument("--initial_round", type=int, default=1, help="Initial round")
|
||||
parser.add_argument("--max_rounds", type=int, default=20, help="Max iteration rounds")
|
||||
parser.add_argument("--check_convergence", type=bool, default=True, help="Whether to enable early stop")
|
||||
parser.add_argument("--validation_rounds", type=int, default=5, help="Validation rounds")
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
args = parse_args()
|
||||
|
||||
mini_llm_config = ModelsConfig.default().get("gpt-4o-mini")
|
||||
claude_llm_config = ModelsConfig.default().get("claude-3-5-sonnet-20240620")
|
||||
|
||||
operators = [
|
||||
"Custom",
|
||||
"CustomCodeGenerate",
|
||||
"ScEnsemble",
|
||||
"Test",
|
||||
]
|
||||
|
||||
optimizer = Optimizer(
|
||||
dataset=args.dataset,
|
||||
question_type=args.question_type,
|
||||
opt_llm_config=claude_llm_config,
|
||||
exec_llm_config=mini_llm_config,
|
||||
check_convergence=args.check_convergence,
|
||||
operators=operators,
|
||||
optimized_path=args.optimized_path,
|
||||
sample=args.sample,
|
||||
initial_round=args.initial_round,
|
||||
max_rounds=args.max_rounds,
|
||||
validation_rounds=args.validation_rounds,
|
||||
)
|
||||
|
||||
optimizer.optimize("Graph")
|
||||
|
|
@ -4,68 +4,103 @@
|
|||
# @Desc : Entrance of AFlow.
|
||||
|
||||
import argparse
|
||||
from typing import Dict, List
|
||||
|
||||
from metagpt.configs.models_config import ModelsConfig
|
||||
from metagpt.ext.aflow.data.download_data import download
|
||||
from metagpt.ext.aflow.scripts.optimizer import Optimizer
|
||||
|
||||
|
||||
class ExperimentConfig:
|
||||
def __init__(self, dataset: str, question_type: str, operators: List[str]):
|
||||
self.dataset = dataset
|
||||
self.question_type = question_type
|
||||
self.operators = operators
|
||||
|
||||
|
||||
EXPERIMENT_CONFIGS: Dict[str, ExperimentConfig] = {
|
||||
"DROP": ExperimentConfig(
|
||||
dataset="DROP",
|
||||
question_type="qa",
|
||||
operators=["Custom", "AnswerGenerate", "ScEnsemble"],
|
||||
),
|
||||
"HotpotQA": ExperimentConfig(
|
||||
dataset="HotpotQA",
|
||||
question_type="qa",
|
||||
operators=["Custom", "AnswerGenerate", "ScEnsemble"],
|
||||
),
|
||||
"MATH": ExperimentConfig(
|
||||
dataset="MATH",
|
||||
question_type="math",
|
||||
operators=["Custom", "ScEnsemble", "Programmer"],
|
||||
),
|
||||
"GSM8K": ExperimentConfig(
|
||||
dataset="GSM8K",
|
||||
question_type="math",
|
||||
operators=["Custom", "ScEnsemble", "Programmer"],
|
||||
),
|
||||
"MBPP": ExperimentConfig(
|
||||
dataset="MBPP",
|
||||
question_type="code",
|
||||
operators=["Custom", "CustomCodeGenerate", "ScEnsemble", "Test"],
|
||||
),
|
||||
"HumanEval": ExperimentConfig(
|
||||
dataset="HumanEval",
|
||||
question_type="code",
|
||||
operators=["Custom", "CustomCodeGenerate", "ScEnsemble", "Test"],
|
||||
),
|
||||
}
|
||||
|
||||
|
||||
def parse_args():
|
||||
parser = argparse.ArgumentParser(description="AFlow Optimizer")
|
||||
parser.add_argument(
|
||||
"--dataset",
|
||||
type=str,
|
||||
default="MATH",
|
||||
help="Dataset type, including HumanEval, MBPP, GSM8K, MATH, HotpotQA, DROP",
|
||||
choices=list(EXPERIMENT_CONFIGS.keys()),
|
||||
required=True,
|
||||
help="Dataset type",
|
||||
)
|
||||
parser.add_argument("--sample", type=int, default=4, help="Sample count")
|
||||
parser.add_argument("--question_type", type=str, default="math", help="Question type, including math, code, qa")
|
||||
parser.add_argument(
|
||||
"--optimized_path", type=str, default="metagpt/ext/aflow/scripts/optimized", help="Optimized result save path"
|
||||
"--optimized_path",
|
||||
type=str,
|
||||
default="metagpt/ext/aflow/scripts/optimized",
|
||||
help="Optimized result save path",
|
||||
)
|
||||
parser.add_argument("--initial_round", type=int, default=1, help="Initial round")
|
||||
parser.add_argument("--max_rounds", type=int, default=20, help="Max iteration rounds")
|
||||
parser.add_argument("--check_convergence", type=bool, default=True, help="Whether to enable early stop")
|
||||
parser.add_argument("--validation_rounds", type=int, default=5, help="Validation rounds")
|
||||
parser.add_argument("--if_first_optimize", type=bool, default=True, help="Whether this is first optimization")
|
||||
parser.add_argument("--if_first_optimize", type=bool, default=True, help="Whether it's the first optimization")
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
# Config llm model, you can modify `config/config2.yaml` to use more llms.
|
||||
mini_llm_config = ModelsConfig.default().get("gpt-4o-mini")
|
||||
claude_llm_config = ModelsConfig.default().get("claude-3-5-sonnet-20240620")
|
||||
|
||||
# Config operators.
|
||||
operators = [
|
||||
"Custom", # It's basic unit of a fixed node. optimizer can modify its prompt to get vairous nodes.
|
||||
# "AnswerGenerate", # It's for qa
|
||||
# "CustomCodeGenerate", # It's for code
|
||||
"ScEnsemble", # It's for code, math and qa
|
||||
# "Test", # It's for code
|
||||
"Programmer", # It's for math
|
||||
]
|
||||
|
||||
if __name__ == "__main__":
|
||||
args = parse_args()
|
||||
|
||||
# Create an optimizer instance
|
||||
download(["datasets", "initial_rounds"], if_first_download=args.if_first_optimize)
|
||||
config = EXPERIMENT_CONFIGS[args.dataset]
|
||||
|
||||
mini_llm_config = ModelsConfig.default().get("gpt-4o-mini")
|
||||
claude_llm_config = ModelsConfig.default().get("claude-3-5-sonnet-20240620")
|
||||
|
||||
optimizer = Optimizer(
|
||||
dataset=args.dataset, # Config dataset
|
||||
question_type=args.question_type, # Config Question Type
|
||||
opt_llm_config=claude_llm_config, # Config Optimizer LLM
|
||||
exec_llm_config=mini_llm_config, # Config Execution LLM
|
||||
check_convergence=args.check_convergence, # Whether Early Stop
|
||||
operators=operators, # Config Operators you want to use
|
||||
optimized_path=args.optimized_path, # Config Optimized workflow's file path
|
||||
sample=args.sample, # Only Top(sample) rounds will be selected.
|
||||
initial_round=args.initial_round, # Optimize from initial round
|
||||
max_rounds=args.max_rounds, # The max iteration of AFLOW.
|
||||
validation_rounds=args.validation_rounds, # The validation rounds of AFLOW.
|
||||
dataset=config.dataset,
|
||||
question_type=config.question_type,
|
||||
opt_llm_config=claude_llm_config,
|
||||
exec_llm_config=mini_llm_config,
|
||||
check_convergence=args.check_convergence,
|
||||
operators=config.operators,
|
||||
optimized_path=args.optimized_path,
|
||||
sample=args.sample,
|
||||
initial_round=args.initial_round,
|
||||
max_rounds=args.max_rounds,
|
||||
validation_rounds=args.validation_rounds,
|
||||
)
|
||||
|
||||
# When you fisrt use, please download the datasets and initial rounds; If you want to get a look of the results, please download the results.
|
||||
download(["datasets", "initial_rounds"], if_first_download=args.if_first_optimize)
|
||||
# Optimize workflow via setting the optimizer's mode to 'Graph'
|
||||
optimizer.optimize("Graph")
|
||||
|
||||
# Test workflow via setting the optimizer's mode to 'Test'
|
||||
# optimizer.optimize("Test")
|
||||
|
|
|
|||
|
|
@ -497,21 +497,21 @@ class ActionNode:
|
|||
|
||||
def get_field_names(self):
|
||||
"""
|
||||
获取与此ActionNode关联的Pydantic模型的字段名称。
|
||||
Get the field names associated with this ActionNode's Pydantic model.
|
||||
"""
|
||||
model_class = self.create_class()
|
||||
return model_class.model_fields.keys()
|
||||
|
||||
def get_field_types(self):
|
||||
"""
|
||||
获取与此ActionNode关联的Pydantic模型的字段类型。
|
||||
Get the field types associated with this ActionNode's Pydantic model.
|
||||
"""
|
||||
model_class = self.create_class()
|
||||
return {field_name: field.annotation for field_name, field in model_class.model_fields.items()}
|
||||
|
||||
def xml_compile(self, context):
|
||||
"""
|
||||
Compile the prompt to make it easier for the model to understand the format.
|
||||
Compile the prompt to make it easier for the model to understand the xml format.
|
||||
"""
|
||||
field_names = self.get_field_names()
|
||||
# Construct the example using the field names
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue