Delete Unnecessary Part

This commit is contained in:
didi 2024-10-24 20:12:15 +08:00
parent bbb982468c
commit b43429ecc4
4 changed files with 0 additions and 109 deletions

View file

@ -1,30 +0,0 @@
from typing import Literal
import metagpt.ext.aflow.scripts.optimized.MATH.workflows.template.operator as operator
import metagpt.ext.aflow.scripts.optimized.MATH.workflows.round_2.prompt as prompt_custom
from metagpt.provider.llm_provider_registry import create_llm_instance
from metagpt.utils.cost_manager import CostManager
DatasetType = Literal["HumanEval", "MBPP", "GSM8K", "MATH", "HotpotQA", "DROP"]
class Workflow:
def __init__(
self,
name: str,
llm_config,
dataset: DatasetType,
) -> None:
self.name = name
self.dataset = dataset
self.llm = create_llm_instance(llm_config)
self.llm.cost_manager = CostManager()
self.custom = operator.Custom(self.llm)
self.sc_ensemble = operator.ScEnsemble(self.llm)
async def __call__(self, problem: str):
"""
Implementation of the workflow
"""
initial_solution = await self.custom(input=problem, instruction=prompt_custom.INITIAL_SOLUTION_PROMPT)
revised_solution = await self.custom(input=problem + f"\nInitial solution: {initial_solution['response']}", instruction=prompt_custom.REVISE_SOLUTION_PROMPT)
final_solution = await self.sc_ensemble(solutions=[initial_solution['response'], revised_solution['response']], problem=problem)
return final_solution['response'], self.llm.cost_manager.total_cost

View file

@ -1,17 +0,0 @@
INITIAL_SOLUTION_PROMPT = """
You are a math expert tasked with solving a complex problem. Please provide a step-by-step solution to the given problem, showing all your work and explaining your reasoning clearly. If the problem involves calculations, make sure to include them in your response.
Problem:
"""
REVISE_SOLUTION_PROMPT = """
You are a math expert tasked with reviewing and improving a solution to a complex problem. An initial solution has been provided, but it may contain errors or be incomplete. Your task is to carefully review the initial solution, identify any mistakes or areas for improvement, and provide a revised, more accurate solution.
Please follow these steps:
1. Review the initial solution thoroughly.
2. Identify any errors or areas that need improvement.
3. Provide a revised solution, explaining your changes and reasoning.
4. Ensure your revised solution is complete, accurate, and clearly explained.
Problem:
"""