repo stringlengths 7 90 | file_url stringlengths 81 315 | file_path stringlengths 4 228 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 14:38:15 2026-01-05 02:33:18 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/aflow/scripts/optimizer_utils/data_utils.py | metagpt/ext/aflow/scripts/optimizer_utils/data_utils.py | import datetime
import json
import os
import random
import numpy as np
import pandas as pd
from metagpt.logs import logger
from metagpt.utils.common import read_json_file, write_json_file
class DataUtils:
def __init__(self, root_path: str):
self.root_path = root_path
self.top_scores = []
de... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/aflow/scripts/optimizer_utils/graph_utils.py | metagpt/ext/aflow/scripts/optimizer_utils/graph_utils.py | import json
import os
import re
import time
import traceback
from typing import List
from metagpt.ext.aflow.scripts.prompts.optimize_prompt import (
WORKFLOW_CUSTOM_USE,
WORKFLOW_INPUT,
WORKFLOW_OPTIMIZE_PROMPT,
WORKFLOW_TEMPLATE,
)
from metagpt.logs import logger
class GraphUtils:
def __init__(s... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/aflow/scripts/optimizer_utils/experience_utils.py | metagpt/ext/aflow/scripts/optimizer_utils/experience_utils.py | import json
import os
from collections import defaultdict
from metagpt.logs import logger
from metagpt.utils.common import read_json_file, write_json_file
class ExperienceUtils:
def __init__(self, root_path: str):
self.root_path = root_path
def load_experience(self, path=None, mode: str = "Graph"):
... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/aflow/scripts/optimizer_utils/convergence_utils.py | metagpt/ext/aflow/scripts/optimizer_utils/convergence_utils.py | # -*- coding: utf-8 -*-
# @Date : 9/23/2024 10:00 AM
# @Author : Issac
# @Desc :
import json
import os
import numpy as np
from metagpt.logs import logger
class ConvergenceUtils:
def __init__(self, root_path):
self.root_path = root_path
self.data = None
self.rounds = None
... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/aflow/scripts/optimizer_utils/evaluation_utils.py | metagpt/ext/aflow/scripts/optimizer_utils/evaluation_utils.py | from metagpt.ext.aflow.scripts.evaluator import Evaluator
class EvaluationUtils:
def __init__(self, root_path: str):
self.root_path = root_path
async def evaluate_initial_round(self, optimizer, graph_path, directory, validation_n, data):
# 使用 optimizer 的 graph_utils 来加载图
optimizer.gra... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/aflow/scripts/optimized/__init__.py | metagpt/ext/aflow/scripts/optimized/__init__.py | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false | |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/aflow/benchmark/drop.py | metagpt/ext/aflow/benchmark/drop.py | import re
import string
from collections import Counter
from typing import Callable, List, Tuple
from tenacity import retry, retry_if_exception_type, stop_after_attempt, wait_fixed
from metagpt.ext.aflow.benchmark.benchmark import BaseBenchmark
from metagpt.logs import logger
class DROPBenchmark(BaseBenchmark):
... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/aflow/benchmark/gsm8k.py | metagpt/ext/aflow/benchmark/gsm8k.py | # -*- coding: utf-8 -*-
# @Date :
# @Author : all
# @Desc : test on gsm8k
import re
from typing import Callable, List, Optional, Tuple
from tenacity import retry, retry_if_exception_type, stop_after_attempt, wait_fixed
from metagpt.ext.aflow.benchmark.benchmark import BaseBenchmark
from metagpt.logs import log... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/aflow/benchmark/hotpotqa.py | metagpt/ext/aflow/benchmark/hotpotqa.py | import re
import string
from collections import Counter
from typing import Callable, List, Tuple
from tenacity import retry, retry_if_exception_type, stop_after_attempt, wait_fixed
from metagpt.ext.aflow.benchmark.benchmark import BaseBenchmark
from metagpt.logs import logger
class HotpotQABenchmark(BaseBenchmark):... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/aflow/benchmark/mbpp.py | metagpt/ext/aflow/benchmark/mbpp.py | import threading
import time
from typing import Any, Callable, Dict, List, Optional, Tuple
from tenacity import retry, retry_if_exception_type, stop_after_attempt, wait_fixed
from metagpt.ext.aflow.benchmark.benchmark import BaseBenchmark
from metagpt.logs import logger
from metagpt.utils.sanitize import sanitize
c... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/aflow/benchmark/humaneval.py | metagpt/ext/aflow/benchmark/humaneval.py | import asyncio
import threading
import time
from typing import Any, Callable, Dict, List, Optional, Tuple
from tenacity import retry, retry_if_exception_type, stop_after_attempt, wait_fixed
from metagpt.ext.aflow.benchmark.benchmark import BaseBenchmark
from metagpt.logs import logger
from metagpt.utils.sanitize impo... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/aflow/benchmark/utils.py | metagpt/ext/aflow/benchmark/utils.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@Time : 2024/7/24 16:37
@Author : didi
@File : utils.py
"""
import json
import os
import numpy as np
from metagpt.utils.common import read_json_file, write_json_file
def generate_random_indices(n, n_samples, test=False):
"""
Generate random indices
... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/aflow/benchmark/benchmark.py | metagpt/ext/aflow/benchmark/benchmark.py | import asyncio
import json
import os
from abc import ABC, abstractmethod
from datetime import datetime
from pathlib import Path
from typing import Any, Callable, List, Tuple
import aiofiles
import pandas as pd
from tqdm.asyncio import tqdm_asyncio
from metagpt.logs import logger
from metagpt.utils.common import write... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/aflow/benchmark/math.py | metagpt/ext/aflow/benchmark/math.py | import inspect
import re
from math import isclose
from typing import Any, Callable, List, Tuple
import regex
from sympy import N, simplify
from sympy.parsing.latex import parse_latex
from sympy.parsing.sympy_parser import parse_expr
from tenacity import retry, retry_if_exception_type, stop_after_attempt, wait_fixed
f... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/aflow/data/download_data.py | metagpt/ext/aflow/data/download_data.py | # -*- coding: utf-8 -*-
# @Date : 2024-10-20
# @Author : MoshiQAQ & didi
# @Desc : Download and extract dataset files
import os
import tarfile
from typing import Dict
import requests
from tqdm import tqdm
from metagpt.logs import logger
def download_file(url: str, filename: str) -> None:
"""Download a f... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/cr/__init__.py | metagpt/ext/cr/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Desc :
| python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/cr/actions/__init__.py | metagpt/ext/cr/actions/__init__.py | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false | |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/cr/actions/code_review.py | metagpt/ext/cr/actions/code_review.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Desc :
import json
import re
from pathlib import Path
import aiofiles
from unidiff import PatchSet
from metagpt.actions.action import Action
from metagpt.ext.cr.utils.cleaner import (
add_line_num_on_patch,
get_code_block_from_patch,
rm_patch_useless_par... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/cr/actions/modify_code.py | metagpt/ext/cr/actions/modify_code.py | import datetime
import itertools
import re
from pathlib import Path
from typing import Optional
from unidiff import PatchSet
from metagpt.actions.action import Action
from metagpt.ext.cr.utils.cleaner import (
add_line_num_on_patch,
get_code_block_from_patch,
rm_patch_useless_part,
)
from metagpt.utils.co... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/cr/utils/schema.py | metagpt/ext/cr/utils/schema.py | from typing import Literal
from pydantic import BaseModel, Field
class Point(BaseModel):
id: int = Field(default=0, description="ID of the point.")
text: str = Field(default="", description="Content of the point.")
language: Literal["Python", "Java"] = Field(
default="Python", description="The pr... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/cr/utils/cleaner.py | metagpt/ext/cr/utils/cleaner.py | """Cleaner."""
from unidiff import Hunk, PatchedFile, PatchSet
from metagpt.logs import logger
def rm_patch_useless_part(patch: PatchSet, used_suffix: list[str] = ["java", "py"]) -> PatchSet:
new_patch = PatchSet("")
useless_files = []
for pfile in patch:
suffix = str(pfile.target_file).split(".... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/cr/utils/__init__.py | metagpt/ext/cr/utils/__init__.py | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false | |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/sela/run_experiment.py | metagpt/ext/sela/run_experiment.py | import argparse
import asyncio
from metagpt.ext.sela.data.custom_task import get_mle_is_lower_better, get_mle_task_id
from metagpt.ext.sela.runner.autogluon import GluonRunner
from metagpt.ext.sela.runner.autosklearn import AutoSklearnRunner
from metagpt.ext.sela.runner.custom import CustomRunner
from metagpt.ext.sela... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/sela/utils.py | metagpt/ext/sela/utils.py | import os
import re
from datetime import datetime
from pathlib import Path
import nbformat
import yaml
from loguru import logger as _logger
from nbclient import NotebookClient
from nbformat.notebooknode import NotebookNode
from metagpt.roles.role import Role
def load_data_config(file_path="data.yaml"):
with ope... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/sela/experimenter.py | metagpt/ext/sela/experimenter.py | from __future__ import annotations
import asyncio
import json
import os
from pydantic import model_validator
from metagpt.actions.di.write_analysis_code import WriteAnalysisCode
from metagpt.const import SERDESER_PATH
from metagpt.ext.sela.utils import mcts_logger, save_notebook
from metagpt.roles.di.data_interprete... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/sela/insights/instruction_generator.py | metagpt/ext/sela/insights/instruction_generator.py | import json
import os
import random
from difflib import SequenceMatcher
from metagpt.ext.sela.insights.solution_designer import SolutionDesigner
from metagpt.ext.sela.utils import clean_json_from_rsp, load_data_config, mcts_logger
from metagpt.llm import LLM
from metagpt.schema import Message
REFLECTION_SYSTEM_MSG = ... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/sela/insights/solution_designer.py | metagpt/ext/sela/insights/solution_designer.py | import json
from metagpt.ext.sela.utils import clean_json_from_rsp, load_data_config
from metagpt.llm import LLM
DATA_CONFIG = load_data_config()
DATASET_DESCRIPTION_SELA_PROMPT = """
# Dataset Description
{dataset}
# Dataset Metadata
{metadata}
# Dataset Head
{head}
"""
DATASET_DESCRIPTION_CUSTOM_PROMPT = """
#... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/sela/scripts/visualize_experiment.py | metagpt/ext/sela/scripts/visualize_experiment.py | import networkx as nx
from metagpt.ext.sela.evaluation.visualize_mcts import (
build_tree_recursive,
visualize_tree,
)
from metagpt.ext.sela.MCTS import MCTS, create_initial_state, initialize_di_root_node
from metagpt.ext.sela.run_experiment import get_args
from metagpt.ext.sela.utils import DATA_CONFIG
if __... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/sela/runner/runner.py | metagpt/ext/sela/runner/runner.py | import datetime
import json
import os
import numpy as np
import pandas as pd
from metagpt.ext.sela.evaluation.evaluation import evaluate_score
from metagpt.ext.sela.experimenter import Experimenter
from metagpt.ext.sela.search.tree_search import create_initial_state
from metagpt.ext.sela.utils import DATA_CONFIG, sav... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/sela/runner/mcts.py | metagpt/ext/sela/runner/mcts.py | import shutil
from metagpt.ext.sela.evaluation.evaluation import (
node_evaluate_score_mlebench,
node_evaluate_score_sela,
)
from metagpt.ext.sela.evaluation.visualize_mcts import get_tree_text
from metagpt.ext.sela.runner.runner import Runner
from metagpt.ext.sela.search.search_algorithm import MCTS, Greedy, ... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/sela/runner/autosklearn.py | metagpt/ext/sela/runner/autosklearn.py | from datetime import datetime
from functools import partial
import pandas as pd
from metagpt.ext.sela.evaluation.evaluation import evaluate_score
from metagpt.ext.sela.runner.custom import CustomRunner
def custom_scorer(y_true, y_pred, metric_name):
return evaluate_score(y_pred, y_true, metric_name)
class ASR... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/sela/runner/autogluon.py | metagpt/ext/sela/runner/autogluon.py | import os
from datetime import datetime
import pandas as pd
from metagpt.ext.sela.runner.custom import CustomRunner
class AGRunner:
def __init__(self, state=None):
self.state = state
self.datasets = self.state["datasets_dir"]
def run(self):
from autogluon.tabular import TabularDatas... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/sela/runner/__init__.py | metagpt/ext/sela/runner/__init__.py | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false | |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/sela/runner/random_search.py | metagpt/ext/sela/runner/random_search.py | from metagpt.ext.sela.experimenter import Experimenter
from metagpt.ext.sela.insights.instruction_generator import InstructionGenerator
from metagpt.ext.sela.runner.runner import Runner
from metagpt.ext.sela.utils import get_exp_pool_path
EXPS_PROMPT = """
When doing the tasks, you can refer to the insights below:
{ex... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/sela/runner/custom.py | metagpt/ext/sela/runner/custom.py | import os
import pandas as pd
from metagpt.ext.sela.evaluation.evaluation import evaluate_score
from metagpt.ext.sela.runner.runner import Runner
from metagpt.ext.sela.search.tree_search import create_initial_state
class CustomRunner(Runner):
result_path: str = "results/custom"
def __init__(self, args, **k... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/sela/runner/aide.py | metagpt/ext/sela/runner/aide.py | import os
import time
import aide
os.environ["OPENAI_API_KEY"] = "sk-xxx"
os.environ["OPENAI_BASE_URL"] = "your url"
start_time = time.time()
data_dir = "xxx/data/titanic"
goal = f"""
# User requirement
({data_dir}, 'This is a 04_titanic dataset. Your goal is to predict the target column `Survived`.\nPerform data ... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/sela/runner/mle_bench/instructions.py | metagpt/ext/sela/runner/mle_bench/instructions.py | SUBMISSION_INSTURCTION = """
- **Submission checker**: We provide a tool for checking the validity of your submission file, in the form of a server endpoint at `http://localhost:5000/validate`. If you post a submission file to the server (e.g. `curl -X POST -F "file=@${SUBMISSION_FILE}" ${SERVER_URL}`), you will receiv... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/sela/search/search_algorithm.py | metagpt/ext/sela/search/search_algorithm.py | import numpy as np
from metagpt.ext.sela.search.tree_search import BaseTreeSearch, Node
class Greedy(BaseTreeSearch):
def best_child(self):
if len(self.children) == 0:
return self.root_node
all_children = [child for children in self.children.values() for child in children]
ret... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/sela/search/tree_search.py | metagpt/ext/sela/search/tree_search.py | import json
import os
import pickle
import shutil
import numpy as np
import pandas as pd
from metagpt.ext.sela.data.custom_task import (
get_mle_bench_requirements,
get_mle_task_id,
)
from metagpt.ext.sela.data.dataset import (
generate_task_requirement,
get_split_dataset_path,
)
from metagpt.ext.sela... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/sela/data/dataset.py | metagpt/ext/sela/data/dataset.py | import argparse
import asyncio
import json
import os
from pathlib import Path
import openml
import pandas as pd
import yaml
from sklearn.model_selection import train_test_split
from metagpt.ext.sela.insights.solution_designer import SolutionDesigner
from metagpt.ext.sela.utils import DATA_CONFIG
BASE_USER_REQUIREMEN... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/sela/data/hf_data.py | metagpt/ext/sela/data/hf_data.py | import asyncio
import io
import os
from pathlib import Path
import pandas as pd
from datasets import load_dataset
from PIL import Image
from metagpt.ext.sela.data.dataset import (
ExpDataset,
parse_args,
process_dataset,
save_datasets_dict_to_yaml,
)
from metagpt.ext.sela.insights.solution_designer im... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/sela/data/custom_task.py | metagpt/ext/sela/data/custom_task.py | import os
from metagpt.ext.sela.data.dataset import SPECIAL_INSTRUCTIONS
from metagpt.ext.sela.runner.mle_bench.instructions import (
ADDITIONAL_NOTES,
INSTRUCTIONS,
INSTRUCTIONS_OBFUSCATED,
)
MLE_BENCH_FILES = ["description.md", "description_obfuscated.md"]
MLE_REQUIREMENTS = """
{instructions}
{addit... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/sela/evaluation/visualize_mcts.py | metagpt/ext/sela/evaluation/visualize_mcts.py | import textwrap
import matplotlib.pyplot as plt
import networkx as nx
from metagpt.ext.sela.search.tree_search import Node
NODE_TEMPLATE = """\
[Node {id}]
Plans:
{plans}
Simulated: {simulated}
Score: {score}, Visits: {num_visits}
"""
NODE_SIZE = 12000
NODE_FONT_SIZE = 18
def get_role_plans(role):
plans = r... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/sela/evaluation/evaluation.py | metagpt/ext/sela/evaluation/evaluation.py | from pathlib import Path
import numpy as np
from sklearn.metrics import accuracy_score, f1_score, mean_squared_error, roc_auc_score
def evaluate_score(pred, gt, metric):
if metric == "accuracy":
return accuracy_score(gt, pred)
elif metric == "f1":
unique_classes = sorted(list(np.unique(gt)))
... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/werewolf/schema.py | metagpt/ext/werewolf/schema.py | from typing import Any
from pydantic import BaseModel, Field, field_validator
from metagpt.schema import Message
from metagpt.utils.common import any_to_str_set
class RoleExperience(BaseModel):
id: str = ""
name: str = ""
profile: str
reflection: str
instruction: str = ""
response: str
o... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/werewolf/__init__.py | metagpt/ext/werewolf/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Desc :
| python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/werewolf/werewolf_game.py | metagpt/ext/werewolf/werewolf_game.py | from typing import Any, Optional
from metagpt.actions.add_requirement import UserRequirement
from metagpt.context import Context
from metagpt.environment.werewolf.werewolf_env import WerewolfEnv
from metagpt.ext.werewolf.schema import WwMessage
from metagpt.team import Team
class WerewolfGame(Team):
"""Use the "... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/werewolf/actions/common_actions.py | metagpt/ext/werewolf/actions/common_actions.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Desc :
import json
from tenacity import retry, stop_after_attempt, wait_fixed
from metagpt.actions import Action
from metagpt.logs import logger
from metagpt.utils.common import parse_json_code_block
def log_and_parse_json(name: str, rsp: str) -> dict:
rsp = r... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/werewolf/actions/seer_actions.py | metagpt/ext/werewolf/actions/seer_actions.py | from metagpt.ext.werewolf.actions.common_actions import NighttimeWhispers
class Verify(NighttimeWhispers):
name: str = "Verify"
| python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/werewolf/actions/werewolf_actions.py | metagpt/ext/werewolf/actions/werewolf_actions.py | from metagpt.ext.werewolf.actions.common_actions import NighttimeWhispers, Speak
class Hunt(NighttimeWhispers):
name: str = "Hunt"
class Impersonate(Speak):
"""Action: werewolf impersonating a good guy in daytime speak"""
STRATEGY: str = """
Try continuously impersonating a role, such as Seer, Guar... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/werewolf/actions/experience_operation.py | metagpt/ext/werewolf/actions/experience_operation.py | import json
from typing import Optional
import chromadb
from pydantic import model_validator
from metagpt.actions import Action
from metagpt.const import DEFAULT_WORKSPACE_ROOT
from metagpt.environment.werewolf.const import RoleType
from metagpt.ext.werewolf.schema import RoleExperience
from metagpt.logs import logge... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/werewolf/actions/guard_actions.py | metagpt/ext/werewolf/actions/guard_actions.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Desc :
from metagpt.ext.werewolf.actions.common_actions import NighttimeWhispers
class Protect(NighttimeWhispers):
name: str = "Protect"
| python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/werewolf/actions/witch_actions.py | metagpt/ext/werewolf/actions/witch_actions.py | from metagpt.environment.werewolf.const import RoleActionRes
from metagpt.ext.werewolf.actions.common_actions import NighttimeWhispers
class Save(NighttimeWhispers):
name: str = "Save"
def _update_prompt_json(
self, prompt_json: dict, role_profile: str, role_name: str, context: str, reflection: str, ... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/werewolf/actions/__init__.py | metagpt/ext/werewolf/actions/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Desc :
from metagpt.ext.werewolf.actions.werewolf_actions import Hunt, Impersonate
from metagpt.ext.werewolf.actions.guard_actions import Protect
from metagpt.ext.werewolf.actions.seer_actions import Verify
from metagpt.ext.werewolf.actions.witch_actions import Save, ... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/werewolf/actions/moderator_actions.py | metagpt/ext/werewolf/actions/moderator_actions.py | from metagpt.actions import Action
from metagpt.environment.werewolf.const import STEP_INSTRUCTIONS
class InstructSpeak(Action):
name: str = "InstructSpeak"
async def run(self, step_idx, living_players, werewolf_players, player_hunted, player_current_dead):
instruction_info = STEP_INSTRUCTIONS.get(
... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/werewolf/roles/moderator.py | metagpt/ext/werewolf/roles/moderator.py | import re
from datetime import datetime
from typing import Union
from metagpt.actions.add_requirement import UserRequirement
from metagpt.const import DEFAULT_WORKSPACE_ROOT, MESSAGE_ROUTE_TO_ALL
from metagpt.environment.werewolf.const import (
STEP_INSTRUCTIONS,
RoleActionRes,
RoleState,
RoleType,
)
f... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/werewolf/roles/villager.py | metagpt/ext/werewolf/roles/villager.py | from metagpt.environment.werewolf.const import RoleType
from metagpt.ext.werewolf.roles.base_player import BasePlayer
class Villager(BasePlayer):
name: str = RoleType.VILLAGER.value
profile: str = RoleType.VILLAGER.value
special_action_names: list[str] = []
| python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/werewolf/roles/witch.py | metagpt/ext/werewolf/roles/witch.py | from metagpt.environment.werewolf.const import RoleType
from metagpt.ext.werewolf.actions import InstructSpeak, Poison, Save, Speak
from metagpt.ext.werewolf.roles.base_player import BasePlayer
from metagpt.utils.common import any_to_str
class Witch(BasePlayer):
name: str = RoleType.WITCH.value
profile: str =... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/werewolf/roles/werewolf.py | metagpt/ext/werewolf/roles/werewolf.py | from metagpt.environment.werewolf.const import RoleType
from metagpt.ext.werewolf.actions import Impersonate, Speak
from metagpt.ext.werewolf.roles.base_player import BasePlayer
class Werewolf(BasePlayer):
name: str = RoleType.WEREWOLF.value
profile: str = RoleType.WEREWOLF.value
special_action_names: lis... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/werewolf/roles/__init__.py | metagpt/ext/werewolf/roles/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Desc :
from metagpt.ext.werewolf.roles.base_player import BasePlayer
from metagpt.ext.werewolf.roles.guard import Guard
from metagpt.ext.werewolf.roles.seer import Seer
from metagpt.ext.werewolf.roles.villager import Villager
from metagpt.ext.werewolf.roles.werewolf i... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/werewolf/roles/human_player.py | metagpt/ext/werewolf/roles/human_player.py | from metagpt.environment.werewolf.const import RoleType
from metagpt.ext.werewolf.actions import Speak
from metagpt.ext.werewolf.roles import BasePlayer
from metagpt.ext.werewolf.schema import WwMessage
from metagpt.logs import logger
async def _act(self):
todo = self.rc.todo
memories = self.get_all_memories... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/werewolf/roles/guard.py | metagpt/ext/werewolf/roles/guard.py | from metagpt.environment.werewolf.const import RoleType
from metagpt.ext.werewolf.roles.base_player import BasePlayer
class Guard(BasePlayer):
name: str = RoleType.GUARD.value
profile: str = RoleType.GUARD.value
special_action_names: list[str] = ["Protect"]
| python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/werewolf/roles/base_player.py | metagpt/ext/werewolf/roles/base_player.py | import re
from pydantic import Field, SerializeAsAny, model_validator
from metagpt.actions.action import Action
from metagpt.environment.werewolf.const import RoleState, RoleType
from metagpt.ext.werewolf.actions import (
ACTIONS,
AddNewExperiences,
InstructSpeak,
NighttimeWhispers,
Reflect,
R... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/werewolf/roles/seer.py | metagpt/ext/werewolf/roles/seer.py | from metagpt.environment.werewolf.const import RoleType
from metagpt.ext.werewolf.roles.base_player import BasePlayer
class Seer(BasePlayer):
name: str = RoleType.SEER.value
profile: str = RoleType.SEER.value
special_action_names: list[str] = ["Verify"]
| python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/stanford_town/stanford_town.py | metagpt/ext/stanford_town/stanford_town.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Desc : StanfordTown to works like SoftwareCompany
from typing import Any, Optional
from metagpt.context import Context
from metagpt.environment import StanfordTownEnv
from metagpt.ext.stanford_town.roles.st_role import STRole
from metagpt.ext.stanford_town.utils.cons... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/stanford_town/__init__.py | metagpt/ext/stanford_town/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Desc : stanford town implement
| python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/stanford_town/plan/converse.py | metagpt/ext/stanford_town/plan/converse.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Desc : conversation between two agents
from typing import Tuple
from metagpt.ext.stanford_town.actions.agent_chat_sum_rel import AgentChatSumRel
from metagpt.ext.stanford_town.actions.gen_iter_chat_utt import GenIterChatUTT
from metagpt.ext.stanford_town.memory.retri... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/stanford_town/plan/__init__.py | metagpt/ext/stanford_town/plan/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Desc :
| python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/stanford_town/plan/st_plan.py | metagpt/ext/stanford_town/plan/st_plan.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Desc : st' planning execution
import datetime
import math
import random
from typing import Tuple, Union
from metagpt.ext.stanford_town.actions.decide_to_talk import DecideToTalk
from metagpt.ext.stanford_town.actions.gen_action_details import GenActionDetails
from me... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/stanford_town/actions/decide_to_talk.py | metagpt/ext/stanford_town/actions/decide_to_talk.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Desc : device to talk to another role, return yes or no
from metagpt.ext.stanford_town.actions.st_action import STAction
from metagpt.logs import logger
class DecideToTalk(STAction):
name: str = "DecideToTalk"
def _func_validate(self, llm_resp: str, prompt:... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/stanford_town/actions/new_decomp_schedule.py | metagpt/ext/stanford_town/actions/new_decomp_schedule.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Desc : new_decomp_schedule
import datetime
from metagpt.ext.stanford_town.actions.st_action import STAction
from metagpt.logs import logger
class NewDecompSchedule(STAction):
name: str = "NewDecompSchedule"
def _func_validate(self, llm_resp: str, prompt: s... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/stanford_town/actions/task_decomp.py | metagpt/ext/stanford_town/actions/task_decomp.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Desc : task_decomp
import datetime
from metagpt.ext.stanford_town.actions.st_action import STAction
from metagpt.logs import logger
class TaskDecomp(STAction):
name: str = "TaskDecomp"
def _func_cleanup(self, llm_resp: str, prompt: str) -> list:
# ... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/stanford_town/actions/inner_voice_action.py | metagpt/ext/stanford_town/actions/inner_voice_action.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Desc :
from metagpt.ext.stanford_town.actions.st_action import STAction
from metagpt.logs import logger
class AgentWhisperThoughtAction(STAction):
name: str = "AgentWhisperThoughtAction"
def _func_validate(self, llm_resp: str, prompt: str) -> bool:
... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/stanford_town/actions/summarize_conv.py | metagpt/ext/stanford_town/actions/summarize_conv.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Desc : summarize the content of agents' conversation
from metagpt.ext.stanford_town.actions.st_action import STAction
from metagpt.logs import logger
class SummarizeConv(STAction):
name: str = "SummarizeConv"
def _func_validate(self, llm_resp: str, prompt: ... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/stanford_town/actions/gen_action_details.py | metagpt/ext/stanford_town/actions/gen_action_details.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Desc : gen_action_details
import random
from metagpt.environment.stanford_town.env_space import EnvObsParams, EnvObsType
from metagpt.ext.stanford_town.actions.st_action import STAction
from metagpt.logs import logger
class GenActionSector(STAction):
name: str ... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/stanford_town/actions/agent_chat_sum_rel.py | metagpt/ext/stanford_town/actions/agent_chat_sum_rel.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Desc : summarize relationship in a agent chat
from metagpt.ext.stanford_town.actions.st_action import STAction
from metagpt.logs import logger
class AgentChatSumRel(STAction):
name: str = "AgentChatSumRel"
def _func_validate(self, llm_resp: str, prompt: str... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/stanford_town/actions/wake_up.py | metagpt/ext/stanford_town/actions/wake_up.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Desc : wake_up
from metagpt.ext.stanford_town.actions.st_action import STAction
from metagpt.logs import logger
class WakeUp(STAction):
name: str = "WakeUp"
def _func_validate(self, llm_resp: str, prompt: str = None) -> bool:
try:
self.... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/stanford_town/actions/gen_daily_schedule.py | metagpt/ext/stanford_town/actions/gen_daily_schedule.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Desc : gen_daily_schedule
from metagpt.ext.stanford_town.actions.st_action import STAction
from metagpt.logs import logger
class GenDailySchedule(STAction):
name: str = "GenDailySchedule"
def _func_validate(self, llm_resp: str, prompt: str) -> bool:
... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/stanford_town/actions/dummy_action.py | metagpt/ext/stanford_town/actions/dummy_action.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Desc : dummy action to make every STRole can deal DummyMessage which is caused by DummyAction
from metagpt.actions import Action
from metagpt.schema import Message
class DummyAction(Action):
async def run(self, *args, **kwargs):
raise NotImplementedError... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/stanford_town/actions/__init__.py | metagpt/ext/stanford_town/actions/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Desc :
| python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/stanford_town/actions/gen_hourly_schedule.py | metagpt/ext/stanford_town/actions/gen_hourly_schedule.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Desc : gen_hourly_schedule
import random
import string
from metagpt.logs import logger
from .st_action import STAction
def get_random_alphanumeric(i=6, j=6):
"""
Returns a random alpha numeric strength that has the length of somewhere
between i and j.
... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/stanford_town/actions/run_reflect_action.py | metagpt/ext/stanford_town/actions/run_reflect_action.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Desc : Integration Reflect Action
import re
from metagpt.ext.stanford_town.actions.st_action import STAction
from metagpt.logs import logger
# Run GPT Prompt Focal Point method
class AgentFocusPt(STAction):
name: str = "AgentFocusPt"
def _func_validate(sel... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/stanford_town/actions/st_action.py | metagpt/ext/stanford_town/actions/st_action.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Desc : StanfordTown Action
import json
import time
from abc import abstractmethod
from pathlib import Path
from typing import Any, Optional, Union
from metagpt.actions.action import Action
from metagpt.ext.stanford_town.utils.const import PROMPTS_DIR
from metagpt.logs... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/stanford_town/actions/gen_iter_chat_utt.py | metagpt/ext/stanford_town/actions/gen_iter_chat_utt.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Desc : generate_iterative_chat_utt
from metagpt.environment.stanford_town.env_space import EnvObsParams, EnvObsType
from metagpt.ext.stanford_town.actions.st_action import STAction
from metagpt.ext.stanford_town.utils.utils import extract_first_json_dict
from metagpt.... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/stanford_town/memory/agent_memory.py | metagpt/ext/stanford_town/memory/agent_memory.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Desc : BasicMemory,AgentMemory实现
from datetime import datetime
from pathlib import Path
from typing import Optional
from pydantic import Field, field_serializer, model_validator
from metagpt.logs import logger
from metagpt.memory.memory import Memory
from metagpt.sc... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/stanford_town/memory/retrieve.py | metagpt/ext/stanford_town/memory/retrieve.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Desc : Retrieve函数实现
import datetime
from numpy import dot
from numpy.linalg import norm
from metagpt.ext.stanford_town.memory.agent_memory import BasicMemory
from metagpt.ext.stanford_town.utils.utils import get_embedding
def agent_retrieve(
agent_memory,
... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/stanford_town/memory/scratch.py | metagpt/ext/stanford_town/memory/scratch.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Desc : Scratch类实现(角色信息类)
from datetime import datetime, timedelta
from pathlib import Path
from typing import Optional, Union
from pydantic import BaseModel, Field, field_serializer, field_validator
from metagpt.utils.common import read_json_file, write_json_file
... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/stanford_town/memory/__init__.py | metagpt/ext/stanford_town/memory/__init__.py | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false | |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/stanford_town/memory/spatial_memory.py | metagpt/ext/stanford_town/memory/spatial_memory.py | """
Author: Joon Sung Park (joonspk@stanford.edu)
File: spatial_memory.py
Description: Defines the MemoryTree class that serves as the agents' spatial
memory that aids in grounding their behavior in the game world.
"""
from pathlib import Path
from pydantic import BaseModel, Field
from metagpt.logs import logger
fro... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/stanford_town/utils/const.py | metagpt/ext/stanford_town/utils/const.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Desc :
from pathlib import Path
from metagpt.const import EXAMPLE_PATH
ST_ROOT_PATH = Path(__file__).parent.parent
STORAGE_PATH = EXAMPLE_PATH.joinpath("stanford_town/storage")
TEMP_STORAGE_PATH = EXAMPLE_PATH.joinpath("stanford_town/temp_storage")
MAZE_ASSET_PATH =... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/stanford_town/utils/utils.py | metagpt/ext/stanford_town/utils/utils.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Desc : utils
import csv
import errno
import json
import os
import shutil
import time
from pathlib import Path
from typing import Union
from openai import OpenAI
from metagpt.config2 import config
from metagpt.logs import logger
def read_csv_to_list(curr_file: str,... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/stanford_town/utils/mg_ga_transform.py | metagpt/ext/stanford_town/utils/mg_ga_transform.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Desc : data transform of mg <-> ga under storage
from pathlib import Path
from typing import Optional
from metagpt.ext.stanford_town.utils.const import STORAGE_PATH, TEMP_STORAGE_PATH
from metagpt.logs import logger
from metagpt.utils.common import read_json_file, wr... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/stanford_town/utils/__init__.py | metagpt/ext/stanford_town/utils/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Desc :
| python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/stanford_town/roles/__init__.py | metagpt/ext/stanford_town/roles/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Desc :
| python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/stanford_town/roles/st_role.py | metagpt/ext/stanford_town/roles/st_role.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Desc : Stanford Town role
"""
Do the steps following:
- perceive, receive environment(Maze) info
- retrieve, retrieve memories
- plan, do plan like long-term plan and interact with Maze
- reflect, do the High-level thinking based on memories and re-add into the memory... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/stanford_town/reflect/reflect.py | metagpt/ext/stanford_town/reflect/reflect.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Desc : Reflect function
import datetime
import time
from metagpt.ext.stanford_town.actions.run_reflect_action import (
AgentChatPoignancy,
AgentEventPoignancy,
AgentEventTriple,
AgentFocusPt,
AgentInsightAndGuidance,
AgentMemoryOnConvo,
Ag... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/stanford_town/reflect/__init__.py | metagpt/ext/stanford_town/reflect/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Desc : reflection module
| python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/stanford_town/prompts/__init__.py | metagpt/ext/stanford_town/prompts/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Desc : stanford town prompt templates
| python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/prompts/product_manager.py | metagpt/prompts/product_manager.py | from metagpt.prompts.di.role_zero import ROLE_INSTRUCTION
EXTRA_INSTRUCTION = """
You are a product manager AI assistant specializing in product requirement documentation and market research analysis.
Your work focuses on the analysis of problems and data.
You should always output a document.
## Core Tools
1. Editor... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/prompts/task_type.py | metagpt/prompts/task_type.py | # Prompt for taking on "eda" tasks
EDA_PROMPT = """
The current task is about exploratory data analysis, please note the following:
- Distinguish column types with `select_dtypes` for tailored analysis and visualization, such as correlation.
- Remember to `import numpy as np` before using Numpy functions.
"""
# Prompt... | python | MIT | fc6e8433747be02826dec818627ed5cec0950e77 | 2026-01-04T14:38:37.890126Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.