Skip to content

🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming

Rename insight generate to instruction generator

Yizhou Chi16d1bf0da0e4
diff --git a/expo/MCTS.py b/expo/MCTS.py
index 5c448e3ac..42c93f650 100644
--- a/expo/MCTS.py
+++ b/expo/MCTS.py
@@ -3,7 +3,7 @@ import math
import os
import pandas as pd
from expo.research_assistant import ResearchAssistant
-from expo.insights.InsightGenerate import InsightGenerator
+from exp_optimizer.expo.insights.instruction_generator import InstructionGenerator
from expo.dataset import get_split_dataset_path, generate_task_requirement
from expo.evaluation.evaluation import evaluate_score
from expo.utils import mcts_logger, load_execute_notebook, get_exp_pool_path
diff --git a/expo/experimenter/aug.py b/expo/experimenter/aug.py
index 28643d47f..299c053cd 100644
--- a/expo/experimenter/aug.py
+++ b/expo/experimenter/aug.py
@@ -2,7 +2,7 @@ from experimenter import Experimenter
from expo.MCTS import create_initial_state
from expo.dataset import generate_task_requirement
from expo.utils import mcts_logger, load_execute_notebook, get_exp_pool_path
-from expo.insights.InsightGenerate import InsightGenerator
+from exp_optimizer.expo.insights.instruction_generator import InstructionGenerator
from expo.research_assistant import ResearchAssistant
EXPS_PROMPT = """
@@ -21,12 +21,12 @@ class AugExperimenter(Experimenter):
state = create_initial_state(self.args.task, start_task_id=1, data_config=self.data_config, low_is_better=self.args.low_is_better, name="")
user_requirement = state["requirement"]
exp_pool_path = get_exp_pool_path(self.args.task, self.data_config, pool_name="ds_analysis_pool")
- exp_pool = InsightGenerator.load_analysis_pool(exp_pool_path)
+ exp_pool = InstructionGenerator.load_analysis_pool(exp_pool_path)
if self.args.aug_mode == "single":
- exps = InsightGenerator._random_sample(exp_pool, self.args.num_experiments)
+ exps = InstructionGenerator._random_sample(exp_pool, self.args.num_experiments)
exps = [exp["Analysis"] for exp in exps]
elif self.args.aug_mode == "set":
- exp_set = InsightGenerator.sample_instruction_set(exp_pool)
+ exp_set = InstructionGenerator.sample_instruction_set(exp_pool)
exp_set_text = "\n".join([f"{exp['task_id']}: {exp['Analysis']}" for exp in exp_set])
exps = [exp_set_text] * self.args.num_experiments
else:
diff --git a/expo/insights/InsightGenerate.py b/expo/insights/instruction_generator.py
similarity index 91%
rename from expo/insights/InsightGenerate.py
rename to expo/insights/instruction_generator.py
index 35bed976a..4f4155ff8 100644
--- a/expo/insights/InsightGenerate.py
+++ b/expo/insights/instruction_generator.py
@@ -27,7 +27,7 @@ from expo.utils import load_data_config, mcts_logger, clean_json_from_rsp
DATA_CONFIG = load_data_config()
-class InsightGenerator:
+class InstructionGenerator:
data_config = DATA_CONFIG
@staticmethod
@@ -68,7 +68,7 @@ class InsightGenerator:
@staticmethod
def load_analysis_pool(file_path, task_id=None):
- data = InsightGenerator.load_json_data(file_path)
+ data = InstructionGenerator.load_json_data(file_path)
for item in data:
if "task_id" not in item:
raise ValueError("task_id is not found in the analysis pool")
@@ -79,14 +79,14 @@ class InsightGenerator:
@staticmethod
async def generate_new_instructions(task_id, original_instruction, max_num, file_path):
- data = InsightGenerator.load_analysis_pool(file_path, task_id)
+ data = InstructionGenerator.load_analysis_pool(file_path, task_id)
new_instructions = []
if len(data) == 0:
mcts_logger.log("MCTS", f"No insights available for task {task_id}")
return [original_instruction] # Return the original instruction if no insights are available
for item in data[:max_num]:
insights = item["Analysis"]
- new_instruction = await InsightGenerator.generate_new_instruction(original_instruction, insights)
+ new_instruction = await InstructionGenerator.generate_new_instruction(original_instruction, insights)
new_instructions.append(new_instruction)
return new_instructions
diff --git a/expo/run_exp_augmentation.py b/expo/run_exp_augmentation.py
index f4d22093f..edf01c164 100644
--- a/expo/run_exp_augmentation.py
+++ b/expo/run_exp_augmentation.py
@@ -3,7 +3,7 @@ from expo.research_assistant import ResearchAssistant
import asyncio
from expo.utils import DATA_CONFIG, get_exp_pool_path
from expo.dataset import generate_task_requirement
-from expo.insights.InsightGenerate import InsightGenerator
+from exp_optimizer.expo.insights.instruction_generator import InstructionGenerator
from expo.MCTS import create_initial_state
from expo.evaluation.evaluation import evaluate_score
import json
@@ -48,12 +48,12 @@ async def main(task_name, use_reflection=True, mode="single", num_experiments=2)
user_requirement = generate_task_requirement(task_name, data_config)
exp_pool_path = get_exp_pool_path(task_name, data_config, pool_name="ds_analysis_pool")
- exp_pool = InsightGenerator.load_analysis_pool(exp_pool_path)
+ exp_pool = InstructionGenerator.load_analysis_pool(exp_pool_path)
if mode == "single":
- exps = InsightGenerator._random_sample(exp_pool, num_experiments)
+ exps = InstructionGenerator._random_sample(exp_pool, num_experiments)
exps = [exp["Analysis"] for exp in exps]
elif mode == "set":
- exp_set = InsightGenerator.sample_instruction_set(exp_pool)
+ exp_set = InstructionGenerator.sample_instruction_set(exp_pool)
exp_set_text = "\n".join([f"{exp['task_id']}: {exp['Analysis']}" for exp in exp_set])
exps = [exp_set_text] * num_experiments
else: