mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-06-08 15:05:17 +02:00
Remove spo redundant code
This commit is contained in:
parent
2528f2bf5f
commit
424726eed9
6 changed files with 13 additions and 25 deletions
|
|
@ -97,7 +97,6 @@ # Create and run optimizer
|
|||
max_rounds=10, # Maximum optimization rounds
|
||||
template="Poem.yaml", # Template file
|
||||
name="Poem", # Project name
|
||||
iteration=True, # Enable iteration mode
|
||||
)
|
||||
|
||||
optimizer.optimize()
|
||||
|
|
@ -111,18 +110,17 @@ #### Option 2: Command Line Interface
|
|||
|
||||
Available command line options:
|
||||
```
|
||||
--optimize-model Model for optimization (default: claude-3-5-sonnet-20240620)
|
||||
--optimize-temperature Temperature for optimization (default: 0.7)
|
||||
--evaluate-model Model for evaluation (default: gpt-4o-mini)
|
||||
--evaluate-temperature Temperature for evaluation (default: 0.3)
|
||||
--execute-model Model for execution (default: gpt-4o-mini)
|
||||
--execute-temperature Temperature for execution (default: 0)
|
||||
--workspace Output directory path (default: workspace)
|
||||
--initial-round Initial round number (default: 1)
|
||||
--max-rounds Maximum number of rounds (default: 10)
|
||||
--template Template file name (default: Poem.yaml)
|
||||
--name Project name (default: Poem)
|
||||
--no-iteration Disable iteration mode (iteration enabled by default)
|
||||
--opt-model Model for optimization (default: claude-3-5-sonnet-20240620)
|
||||
--opt-temp Temperature for optimization (default: 0.7)
|
||||
--eval-model Model for evaluation (default: gpt-4o-mini)
|
||||
--eval-temp Temperature for evaluation (default: 0.3)
|
||||
--exec-model Model for execution (default: gpt-4o-mini)
|
||||
--exec-temp Temperature for execution (default: 0)
|
||||
--workspace Output directory path (default: workspace)
|
||||
--initial-round Initial round number (default: 1)
|
||||
--max-rounds Maximum number of rounds (default: 10)
|
||||
--template Template file name (default: Poem.yaml)
|
||||
--name Project name (default: Poem)
|
||||
```
|
||||
|
||||
For help:
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ def parse_args():
|
|||
parser.add_argument("--max-rounds", type=int, default=10, help="Maximum number of rounds")
|
||||
parser.add_argument("--template", type=str, default="Poem.yaml", help="Template file name")
|
||||
parser.add_argument("--name", type=str, default="Poem", help="Project name")
|
||||
parser.add_argument("--no-iteration", action="store_false", dest="iteration", help="Disable iteration mode")
|
||||
|
||||
return parser.parse_args()
|
||||
|
||||
|
|
@ -41,7 +40,6 @@ def main():
|
|||
max_rounds=args.max_rounds,
|
||||
template=args.template,
|
||||
name=args.name,
|
||||
iteration=args.iteration,
|
||||
)
|
||||
|
||||
optimizer.optimize()
|
||||
|
|
|
|||
0
metagpt/ext/spo/components/__init__.py
Normal file
0
metagpt/ext/spo/components/__init__.py
Normal file
|
|
@ -73,10 +73,3 @@ class QuickEvaluate:
|
|||
except Exception as e:
|
||||
logger.error(e)
|
||||
return False
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
executor = QuickExecute(prompt="Answer the Question")
|
||||
|
||||
answers = asyncio.run(executor.prompt_execute())
|
||||
print(answers)
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ class PromptOptimizer:
|
|||
max_rounds: int = 10,
|
||||
name: str = "",
|
||||
template: str = "",
|
||||
iteration: bool = True,
|
||||
) -> None:
|
||||
self.dataset = name
|
||||
self.root_path = f"{optimized_path}/{self.dataset}"
|
||||
|
|
|
|||
|
|
@ -18,13 +18,13 @@ class EvaluationUtils:
|
|||
def __init__(self, root_path: str):
|
||||
self.root_path = root_path
|
||||
|
||||
async def execute_prompt(self, optimizer, prompt_path, initial=False):
|
||||
async def execute_prompt(self, optimizer, prompt_path):
|
||||
optimizer.prompt = optimizer.prompt_utils.load_prompt(optimizer.round, prompt_path)
|
||||
executor = QuickExecute(prompt=optimizer.prompt)
|
||||
|
||||
answers = await executor.prompt_execute()
|
||||
|
||||
cur_round = optimizer.round + 1 if not initial else optimizer.round
|
||||
cur_round = optimizer.round
|
||||
|
||||
new_data = {"round": cur_round, "answers": answers, "prompt": optimizer.prompt}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue