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/utils/reflection.py
metagpt/utils/reflection.py
"""class tools, including method inspection, class attributes, inheritance relationships, etc.""" def check_methods(C, *methods): """Check if the class has methods. borrow from _collections_abc. Useful when implementing implicit interfaces, such as defining an abstract class, isinstance can be used for deter...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/utils/singleton.py
metagpt/utils/singleton.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @Time : 2023/5/11 16:15 @Author : alexanderwu @File : singleton.py """ import abc class Singleton(abc.ABCMeta, type): """ Singleton metaclass for ensuring only one instance of a class. """ _instances = {} def __call__(cls, *args, **kwargs)...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/utils/common.py
metagpt/utils/common.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @Time : 2023/4/29 16:07 @Author : alexanderwu @File : common.py @Modified By: mashenquan, 2023-11-1. According to Chapter 2.2.2 of RFC 116: Add generic class-to-string and object-to-string conversion functionality. @Modified By: mashenquan, 2023/11/27. Bu...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
true
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/utils/tree.py
metagpt/utils/tree.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @Time : 2024/3/11 @Author : mashenquan @File : tree.py @Desc : Implement the same functionality as the `tree` command. Example: >>> print_tree(".") utils +-- serialize.py +-- project_repo.py +...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/utils/json_to_markdown.py
metagpt/utils/json_to_markdown.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @Time : 2023/9/11 11:50 @Author : femto Zheng @File : json_to_markdown.py """ # since we original write docs/*.md in markdown format, so I convert json back to markdown def json_to_markdown(data, depth=2): """ Convert a JSON object to Markdown with head...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/utils/serialize.py
metagpt/utils/serialize.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Desc : the implement of serialization and deserialization import copy import pickle from metagpt.utils.common import import_class def actionoutout_schema_to_mapping(schema: dict) -> dict: """ directly traverse the `properties` in the first level. schema...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/utils/a11y_tree.py
metagpt/utils/a11y_tree.py
"""See https://github.com/web-arena-x/webarena """ from __future__ import annotations import re from playwright.async_api import BrowserContext, Page async def get_accessibility_tree(page: Page): cdp_session = await get_page_cdp_session(page) resp = await cdp_session.send("Accessibility.getFullAXTree") ...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/utils/human_interaction.py
metagpt/utils/human_interaction.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Desc : human interaction to get required type text import json from typing import Any, Tuple, Type from pydantic import BaseModel from metagpt.logs import logger from metagpt.utils.common import import_class class HumanInteraction(object): stop_list = ("q", "q...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/utils/di_graph_repository.py
metagpt/utils/di_graph_repository.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @Time : 2023/12/19 @Author : mashenquan @File : di_graph_repository.py @Desc : Graph repository based on DiGraph. This script defines a graph repository class based on a directed graph (DiGraph), providing functionalities specific to handling directed ...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/utils/dependency_file.py
metagpt/utils/dependency_file.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @Time : 2023/11/22 @Author : mashenquan @File : dependency_file.py @Desc: Implementation of the dependency file described in Section 2.2.3.2 of RFC 135. """ from __future__ import annotations import json import re from pathlib import Path from typing import Set ...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/utils/role_zero_utils.py
metagpt/utils/role_zero_utils.py
from __future__ import annotations import json import re import traceback from typing import Tuple from metagpt.const import IMAGES from metagpt.logs import logger from metagpt.prompts.di.role_zero import ( ASK_HUMAN_COMMAND, ASK_HUMAN_GUIDANCE_FORMAT, END_COMMAND, JSON_REPAIR_PROMPT, REGENERATE_P...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/utils/omniparse_client.py
metagpt/utils/omniparse_client.py
import mimetypes from pathlib import Path from typing import Union import httpx from metagpt.rag.schema import OmniParsedResult from metagpt.utils.common import aread_bin class OmniParseClient: """ OmniParse Server Client This client interacts with the OmniParse server to parse different types of media,...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/utils/exceptions.py
metagpt/utils/exceptions.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @Time : 2023/12/19 14:46 @Author : alexanderwu @File : exceptions.py """ import asyncio import functools import traceback from typing import Any, Callable, Tuple, Type, TypeVar, Union from metagpt.logs import logger ReturnType = TypeVar("ReturnType") def ha...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/utils/redis.py
metagpt/utils/redis.py
# !/usr/bin/python3 # -*- coding: utf-8 -*- """ @Time : 2023/12/27 @Author : mashenquan @File : redis.py """ from __future__ import annotations import traceback from datetime import timedelta import redis.asyncio as aioredis from metagpt.configs.redis_config import RedisConfig from metagpt.logs import logger ...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/utils/stream_pipe.py
metagpt/utils/stream_pipe.py
# -*- coding: utf-8 -*- # @Time : 2024/3/27 10:00 # @Author : leiwu30 # @File : stream_pipe.py # @Version : None # @Description : None import json import time from multiprocessing import Pipe class StreamPipe: def __init__(self, name=None): self.name = name self.parent_conn, self.child_con...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/utils/save_code.py
metagpt/utils/save_code.py
# -*- coding: utf-8 -*- # @Date : 12/12/2023 4:14 PM # @Author : stellahong (stellahong@fuzhi.ai) # @Desc : import os import nbformat from metagpt.const import DATA_PATH from metagpt.utils.common import write_json_file def save_code_file(name: str, code_context: str, file_format: str = "py") -> None: """...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/utils/project_repo.py
metagpt/utils/project_repo.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @Time : 2024/1/8 @Author : mashenquan @File : project_repo.py @Desc : Wrapper for GitRepository and FileRepository of project. Implementation of Chapter 4.6 of https://deepwisdom.feishu.cn/wiki/CUK4wImd7id9WlkQBNscIe9cnqh """ from __future__ import annotat...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/utils/ahttp_client.py
metagpt/utils/ahttp_client.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Desc : pure async http_client from typing import Any, Mapping, Optional, Union import aiohttp from aiohttp.client import DEFAULT_TIMEOUT async def apost( url: str, params: Optional[Mapping[str, str]] = None, json: Any = None, data: Any = None, h...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/utils/git_repository.py
metagpt/utils/git_repository.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @Time : 2023/11/20 @Author : mashenquan @File : git_repository.py @Desc: Git repository management. RFC 135 2.2.3.3. """ from __future__ import annotations import re import shutil import uuid from enum import Enum from pathlib import Path from subprocess import ...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/utils/mmdc_ink.py
metagpt/utils/mmdc_ink.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @Time : 2023/9/4 16:12 @Author : alitrack @File : mermaid.py """ import base64 from typing import List, Optional from aiohttp import ClientError, ClientSession from metagpt.logs import logger async def mermaid_to_file(mermaid_code, output_file_without_suffix,...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/utils/repo_to_markdown.py
metagpt/utils/repo_to_markdown.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This file provides functionality to convert a local repository into a markdown representation. """ from __future__ import annotations import re from pathlib import Path from typing import Tuple, Union from gitignore_parser import parse_gitignore from metagpt.logs imp...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/utils/async_helper.py
metagpt/utils/async_helper.py
import asyncio import threading from typing import Any def run_coroutine_in_new_loop(coroutine) -> Any: """Runs a coroutine in a new, separate event loop on a different thread. This function is useful when try to execute an async function within a sync function, but encounter the error `RuntimeError: This ev...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/utils/repair_llm_raw_output.py
metagpt/utils/repair_llm_raw_output.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Desc : repair llm raw output with particular conditions import copy from enum import Enum from typing import Callable, Optional, Union import regex as re from tenacity import RetryCallState, retry, stop_after_attempt, wait_fixed from metagpt.config2 import Config fr...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/utils/__init__.py
metagpt/utils/__init__.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @Time : 2023/4/29 15:50 @Author : alexanderwu @File : __init__.py """ from metagpt.utils.read_document import read_docx from metagpt.utils.singleton import Singleton from metagpt.utils.token_counter import ( TOKEN_COSTS, count_message_tokens, count_o...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/utils/cost_manager.py
metagpt/utils/cost_manager.py
# -*- coding: utf-8 -*- """ @Time : 2023/8/28 @Author : mashenquan @File : openai.py @Desc : mashenquan, 2023/8/28. Separate the `CostManager` class to support user-level cost accounting. """ import re from typing import NamedTuple from pydantic import BaseModel from metagpt.logs import logger from metagpt...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/utils/sanitize.py
metagpt/utils/sanitize.py
""" @Time : 2024/7/24 16:37 @Author : didi @File : utils.py @Acknowledgement https://github.com/evalplus/evalplus/blob/master/evalplus/sanitize.py """ import ast import traceback from enum import Enum from typing import Dict, Generator, List, Optional, Set, Tuple import tree_sitter_python from tree_sitter impo...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/utils/recovery_util.py
metagpt/utils/recovery_util.py
# -*- coding: utf-8 -*- # @Date : 12/20/2023 11:07 AM # @Author : stellahong (stellahong@fuzhi.ai) # @Desc : import json from datetime import datetime from pathlib import Path import nbformat from metagpt.const import DATA_PATH from metagpt.roles.role import Role from metagpt.utils.common import read_json_file...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/utils/embedding.py
metagpt/utils/embedding.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @Time : 2024/1/4 20:58 @Author : alexanderwu @File : embedding.py """ from llama_index.embeddings.openai import OpenAIEmbedding from metagpt.config2 import config def get_embedding() -> OpenAIEmbedding: llm = config.get_openai_llm() if llm is None: ...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/utils/text.py
metagpt/utils/text.py
from typing import Generator, Sequence from metagpt.utils.token_counter import TOKEN_MAX, count_output_tokens def reduce_message_length( msgs: Generator[str, None, None], model_name: str, system_text: str, reserved: int = 0, ) -> str: """Reduce the length of concatenated message segments to fit w...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/utils/parse_html.py
metagpt/utils/parse_html.py
#!/usr/bin/env python from __future__ import annotations from typing import Generator, Optional from urllib.parse import urljoin, urlparse import htmlmin from bs4 import BeautifulSoup from pydantic import BaseModel, PrivateAttr class WebPage(BaseModel): inner_text: str html: str url: str _soup: Opt...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/utils/visual_graph_repo.py
metagpt/utils/visual_graph_repo.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @Time : 2023/12/19 @Author : mashenquan @File : visualize_graph.py @Desc : Visualization tool to visualize the class diagrams or sequence diagrams of the graph repository. """ from __future__ import annotations import re from abc import ABC from pathlib impor...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/utils/mmdc_pyppeteer.py
metagpt/utils/mmdc_pyppeteer.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @Time : 2023/9/4 16:12 @Author : alitrack @File : mmdc_pyppeteer.py """ import os from typing import List, Optional from urllib.parse import urljoin from pyppeteer import launch from metagpt.config2 import Config from metagpt.logs import logger async def merm...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/utils/parse_docstring.py
metagpt/utils/parse_docstring.py
import re from typing import Tuple def remove_spaces(text): return re.sub(r"\s+", " ", text).strip() if text else "" class DocstringParser: @staticmethod def parse(docstring: str) -> Tuple[str, str]: """Parse the docstring and return the overall description and the parameter description. ...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/utils/s3.py
metagpt/utils/s3.py
import base64 import os.path import traceback import uuid from pathlib import Path from typing import Optional import aioboto3 import aiofiles from metagpt.config2 import S3Config from metagpt.const import BASE64_FORMAT from metagpt.logs import logger class S3: """A class for interacting with Amazon S3 storage....
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/utils/make_sk_kernel.py
metagpt/utils/make_sk_kernel.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @Time : 2023/9/13 12:29 @Author : femto Zheng @File : make_sk_kernel.py """ import semantic_kernel as sk from semantic_kernel.connectors.ai.open_ai.services.azure_chat_completion import ( AzureChatCompletion, ) from semantic_kernel.connectors.ai.open_ai.servi...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/utils/mmdc_playwright.py
metagpt/utils/mmdc_playwright.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @Time : 2023/9/4 16:12 @Author : Steven Lee @File : mmdc_playwright.py """ import os from typing import List, Optional from urllib.parse import urljoin from playwright.async_api import async_playwright from metagpt.logs import logger async def mermaid_to_fil...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/utils/mermaid.py
metagpt/utils/mermaid.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @Time : 2023/7/4 10:53 @Author : alexanderwu alitrack @File : mermaid.py """ import asyncio import os import re from pathlib import Path from typing import List, Optional from metagpt.config2 import Config from metagpt.logs import logger from metagpt.utils.commo...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/roles/product_manager.py
metagpt/roles/product_manager.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @Time : 2023/5/11 14:43 @Author : alexanderwu @File : product_manager.py @Modified By: liushaojie, 2024/10/17. """ from metagpt.actions import UserRequirement, WritePRD from metagpt.actions.prepare_documents import PrepareDocuments from metagpt.actions.search_enh...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/roles/project_manager.py
metagpt/roles/project_manager.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @Time : 2023/5/11 15:04 @Author : alexanderwu @File : project_manager.py """ from metagpt.actions import WriteTasks from metagpt.actions.design_api import WriteDesign from metagpt.roles.di.role_zero import RoleZero class ProjectManager(RoleZero): """ Re...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/roles/researcher.py
metagpt/roles/researcher.py
#!/usr/bin/env python """ @Modified By: mashenquan, 2023/8/22. A definition has been provided for the return value of _think: returning false indicates that further reasoning cannot continue. @Modified By: mashenquan, 2023-11-1. According to Chapter 2.2.1 and 2.2.2 of RFC 116, change the data type of the `cause...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/roles/architect.py
metagpt/roles/architect.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @Time : 2023/5/11 14:43 @Author : alexanderwu @File : architect.py """ from pydantic import Field from metagpt.actions.design_api import WriteDesign from metagpt.actions.write_prd import WritePRD from metagpt.prompts.di.architect import ARCHITECT_EXAMPLE, ARCHIT...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/roles/assistant.py
metagpt/roles/assistant.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @Time : 2023/8/7 @Author : mashenquan @File : assistant.py @Desc : I am attempting to incorporate certain symbol concepts from UML into MetaGPT, enabling it to have the ability to freely construct flows through symbol concatenation. Simultaneously, ...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/roles/invoice_ocr_assistant.py
metagpt/roles/invoice_ocr_assistant.py
#!/usr/bin/env python3 # _*_ coding: utf-8 _*_ """ @Time : 2023/9/21 14:10:05 @Author : Stitch-z @File : invoice_ocr_assistant.py """ import json from pathlib import Path from typing import Optional import pandas as pd from pydantic import BaseModel from metagpt.actions.invoice_ocr import GenerateTable, Invo...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/roles/engineer.py
metagpt/roles/engineer.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @Time : 2023/5/11 14:43 @Author : alexanderwu @File : engineer.py @Modified By: mashenquan, 2023-11-1. In accordance with Chapter 2.2.1 and 2.2.2 of RFC 116: 1. Modify the data type of the `cause_by` value in the `Message` to a string, and utilize the new mes...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/roles/role.py
metagpt/roles/role.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @Time : 2023/5/11 14:42 @Author : alexanderwu @File : role.py @Modified By: mashenquan, 2023/8/22. A definition has been provided for the return value of _think: returning false indicates that further reasoning cannot continue. @Modified By: mashenquan, 2023-11-1...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/roles/teacher.py
metagpt/roles/teacher.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @Time : 2023/7/27 @Author : mashenquan @File : teacher.py @Desc : Used by Agent Store @Modified By: mashenquan, 2023/8/22. A definition has been provided for the return value of _think: returning false indicates that further reasoning cannot continue. """ im...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/roles/sales.py
metagpt/roles/sales.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @Time : 2023/5/25 17:21 @Author : alexanderwu @File : sales.py """ from typing import Optional from pydantic import Field, model_validator from metagpt.actions import SearchAndSummarize, UserRequirement from metagpt.roles import Role from metagpt.tools.search_...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/roles/customer_service.py
metagpt/roles/customer_service.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @Time : 2023/5/25 17:21 @Author : alexanderwu @File : sales.py """ from typing import Optional from pydantic import Field from metagpt.document_store.base_store import BaseStore from metagpt.roles import Sales DESC = """ ## Principles (all things must not bypa...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/roles/qa_engineer.py
metagpt/roles/qa_engineer.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @Time : 2023/5/11 14:43 @Author : alexanderwu @File : qa_engineer.py @Modified By: mashenquan, 2023-11-1. In accordance with Chapter 2.2.1 and 2.2.2 of RFC 116, modify the data type of the `cause_by` value in the `Message` to a string, and utilize the new...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/roles/prompt.py
metagpt/roles/prompt.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @Time : 2023/5/18 22:43 @Author : alexanderwu @File : prompt.py """ from enum import Enum PREFIX = """Answer the questions to the best of your ability. You can use the following tools:""" FORMAT_INSTRUCTIONS = """Please follow the format below: Question: The in...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/roles/__init__.py
metagpt/roles/__init__.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @Time : 2023/5/11 14:43 @Author : alexanderwu @File : __init__.py """ from metagpt.roles.role import Role from metagpt.roles.architect import Architect from metagpt.roles.project_manager import ProjectManager from metagpt.roles.product_manager import ProductMana...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/roles/tutorial_assistant.py
metagpt/roles/tutorial_assistant.py
#!/usr/bin/env python3 # _*_ coding: utf-8 _*_ """ @Time : 2023/9/4 15:40:40 @Author : Stitch-z @File : tutorial_assistant.py """ from datetime import datetime from typing import Dict from metagpt.actions.write_tutorial import WriteContent, WriteDirectory from metagpt.const import TUTORIAL_PATH from metagpt.lo...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/roles/searcher.py
metagpt/roles/searcher.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @Time : 2023/5/23 17:25 @Author : alexanderwu @File : searcher.py @Modified By: mashenquan, 2023-11-1. According to Chapter 2.2.1 and 2.2.2 of RFC 116, change the data type of the `cause_by` value in the `Message` to a string to support the new message di...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/roles/di/data_analyst.py
metagpt/roles/di/data_analyst.py
from __future__ import annotations from typing import Annotated from pydantic import Field, model_validator from metagpt.actions.di.execute_nb_code import ExecuteNbCode from metagpt.actions.di.write_analysis_code import CheckData, WriteAnalysisCode from metagpt.logs import logger from metagpt.prompts.di.data_analyst...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/roles/di/data_interpreter.py
metagpt/roles/di/data_interpreter.py
from __future__ import annotations import json from typing import Literal from pydantic import Field, model_validator # from metagpt.actions.di.ask_review import ReviewConst from metagpt.actions.di.execute_nb_code import ExecuteNbCode from metagpt.actions.di.write_analysis_code import CheckData, WriteAnalysisCode fr...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/roles/di/role_zero.py
metagpt/roles/di/role_zero.py
from __future__ import annotations import inspect import json import re import traceback from datetime import datetime from typing import Annotated, Callable, Literal, Optional, Tuple from pydantic import Field, model_validator from metagpt.actions import Action, UserRequirement from metagpt.actions.di.run_command i...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/roles/di/engineer2.py
metagpt/roles/di/engineer2.py
from __future__ import annotations import os from pathlib import Path from pydantic import Field from metagpt.logs import logger # from metagpt.actions.write_code_review import ValidateAndRewriteCode from metagpt.prompts.di.engineer2 import ( CURRENT_STATE, ENGINEER2_INSTRUCTION, WRITE_CODE_PROMPT, ...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/roles/di/team_leader.py
metagpt/roles/di/team_leader.py
from __future__ import annotations from typing import Annotated from pydantic import Field from metagpt.actions.di.run_command import RunCommand from metagpt.const import TEAMLEADER_NAME from metagpt.prompts.di.role_zero import QUICK_THINK_TAG from metagpt.prompts.di.team_leader import ( FINISH_CURRENT_TASK_CMD,...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/roles/di/__init__.py
metagpt/roles/di/__init__.py
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/roles/di/swe_agent.py
metagpt/roles/di/swe_agent.py
import json from pydantic import Field from metagpt.logs import logger from metagpt.prompts.di.swe_agent import ( CURRENT_BASH_STATE, MINIMAL_EXAMPLE, NEXT_STEP_TEMPLATE, ) from metagpt.roles.di.role_zero import RoleZero from metagpt.schema import Message from metagpt.tools.libs.git import git_create_pull...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/__init__.py
metagpt/ext/__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/android_assistant/__init__.py
metagpt/ext/android_assistant/__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/android_assistant/actions/self_learn_reflect_an.py
metagpt/ext/android_assistant/actions/self_learn_reflect_an.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Desc : the ActionNode to parse Reflection from metagpt.actions.action_node import ActionNode DECISION = ActionNode( key="Decision", expected_type=str, instruction="explain why you made this decision", example="BACK" ) THOUGHT = ActionNode(key="Thought", expecte...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/android_assistant/actions/screenshot_parse_an.py
metagpt/ext/android_assistant/actions/screenshot_parse_an.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Desc : the ActionNode to parse screenshot from metagpt.actions.action_node import ActionNode OBSERVATION = ActionNode( key="Observation", expected_type=str, instruction="Describe what you observe in the image", example="" ) THOUGHT = ActionNode( key="Thought...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/android_assistant/actions/parse_record.py
metagpt/ext/android_assistant/actions/parse_record.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Desc : parse record to generate learned standard operations in stage=learn & mode=manual, # LIKE scripts/document_generation.py import ast import re from pathlib import Path from metagpt.actions.action import Action from metagpt.config2 import config from m...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/android_assistant/actions/manual_record.py
metagpt/ext/android_assistant/actions/manual_record.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Desc : manual record user interaction in stage=learn & mode=manual, LIKE scripts/step_recorder.py import time from pathlib import Path import cv2 from metagpt.actions.action import Action from metagpt.config2 import config from metagpt.environment.android.android_env...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/android_assistant/actions/__init__.py
metagpt/ext/android_assistant/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/android_assistant/actions/parse_record_an.py
metagpt/ext/android_assistant/actions/parse_record_an.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Desc : the ActionNode to parse record from metagpt.actions.action_node import ActionNode OBSERVATION = ActionNode( key="Observation", expected_type=str, instruction="Provide a description of your observations of the two images. " "Subsequently, deline...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/android_assistant/actions/self_learn_and_reflect.py
metagpt/ext/android_assistant/actions/self_learn_and_reflect.py
# !/usr/bin/env python # -*- coding: utf-8 -*- # @Desc : LIKE scripts/self_explorer.py in stage=learn & mode=auto self_explore_task stage import ast from pathlib import Path from metagpt.actions.action import Action from metagpt.config2 import config from metagpt.environment.android.android_env import AndroidEnv fr...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/android_assistant/actions/screenshot_parse.py
metagpt/ext/android_assistant/actions/screenshot_parse.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Desc : LIKE scripts/task_executor.py in stage=act import ast from pathlib import Path from metagpt.actions.action import Action from metagpt.config2 import config from metagpt.environment.android.android_env import AndroidEnv from metagpt.environment.android.const im...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/android_assistant/utils/schema.py
metagpt/ext/android_assistant/utils/schema.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Desc : from enum import Enum from pydantic import BaseModel, Field, field_validator class ActionOp(Enum): TAP = "tap" LONG_PRESS = "long_press" TEXT = "text" SWIPE = "swipe" VERTICAL_SWIPE = "v_swipe" HORIZONTAL_SWIPE = "h_swipe" GRID = ...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/android_assistant/utils/utils.py
metagpt/ext/android_assistant/utils/utils.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Desc : import re from pathlib import Path from typing import Union from xml.etree.ElementTree import Element, iterparse import cv2 import pyshine as ps from metagpt.config2 import config from metagpt.ext.android_assistant.utils.schema import ( ActionOp, Andr...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/android_assistant/utils/__init__.py
metagpt/ext/android_assistant/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/android_assistant/roles/__init__.py
metagpt/ext/android_assistant/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/android_assistant/roles/android_assistant.py
metagpt/ext/android_assistant/roles/android_assistant.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Desc : android assistant to learn from app operations and operate apps import time from datetime import datetime from pathlib import Path from typing import Optional from pydantic import Field from metagpt.actions.add_requirement import UserRequirement from metagpt.c...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/android_assistant/prompts/assistant_prompt.py
metagpt/ext/android_assistant/prompts/assistant_prompt.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Desc : the prompt templates of assistant learning and acting screenshot_parse_template = """You are an agent that is trained to perform some basic tasks on a smartphone. You will be given a smartphone screenshot. The interactive UI elements on the screenshot are labe...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/android_assistant/prompts/__init__.py
metagpt/ext/android_assistant/prompts/__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/android_assistant/prompts/operation_prompt.py
metagpt/ext/android_assistant/prompts/operation_prompt.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Desc : the prompt templates of phone operation tap_doc_template = """I will give you the screenshot of a mobile app before and after tapping the UI element labeled with the number {ui_element} on the screen. The numeric tag of each element is located at the center of...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/spo/__init__.py
metagpt/ext/spo/__init__.py
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/spo/app.py
metagpt/ext/spo/app.py
import asyncio from pathlib import Path from typing import Dict import streamlit as st import yaml from loguru import logger as _logger from metagpt.const import METAGPT_ROOT from metagpt.ext.spo.components.optimizer import PromptOptimizer from metagpt.ext.spo.utils.llm_client import SPO_LLM, RequestType def load_y...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/spo/components/optimizer.py
metagpt/ext/spo/components/optimizer.py
# -*- coding: utf-8 -*- # @Date : 8/12/2024 22:00 PM # @Author : issac # @Desc : optimizer for prompt import asyncio from pathlib import Path from typing import List from metagpt.ext.spo.prompts.optimize_prompt import PROMPT_OPTIMIZE_PROMPT from metagpt.ext.spo.utils import load from metagpt.ext.spo.utils.data...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/spo/components/evaluator.py
metagpt/ext/spo/components/evaluator.py
# -*- coding: utf-8 -*- # @Date : 8/23/2024 10:00 AM # @Author : all # @Desc : Evaluation for different datasets import asyncio import random from typing import Any, Dict from metagpt.ext.spo.prompts.evaluate_prompt import EVALUATE_PROMPT from metagpt.ext.spo.utils import load from metagpt.ext.spo.utils.llm_cli...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/spo/components/__init__.py
metagpt/ext/spo/components/__init__.py
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/spo/utils/data_utils.py
metagpt/ext/spo/utils/data_utils.py
import datetime import json from pathlib import Path from typing import Dict, List, Union import pandas as pd from metagpt.logs import logger class DataUtils: def __init__(self, root_path: Path): self.root_path = root_path self.top_scores = [] def load_results(self, path: Path) -> list: ...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/spo/utils/load.py
metagpt/ext/spo/utils/load.py
import random from pathlib import Path import yaml FILE_NAME = "" SAMPLE_K = 3 def set_file_name(name: str): global FILE_NAME FILE_NAME = name def load_meta_data(k: int = SAMPLE_K): # load yaml file config_path = Path(__file__).parent.parent / "settings" / FILE_NAME if not config_path.exists(...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/spo/utils/prompt_utils.py
metagpt/ext/spo/utils/prompt_utils.py
from pathlib import Path from metagpt.logs import logger class PromptUtils: def __init__(self, root_path: Path): self.root_path = root_path def create_round_directory(self, prompt_path: Path, round_number: int) -> Path: directory = prompt_path / f"round_{round_number}" directory.mkdi...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/spo/utils/llm_client.py
metagpt/ext/spo/utils/llm_client.py
import asyncio import re from enum import Enum from typing import Any, List, Optional from metagpt.configs.models_config import ModelsConfig from metagpt.llm import LLM from metagpt.logs import logger class RequestType(Enum): OPTIMIZE = "optimize" EVALUATE = "evaluate" EXECUTE = "execute" class SPO_LLM...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/spo/utils/__init__.py
metagpt/ext/spo/utils/__init__.py
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/spo/utils/evaluation_utils.py
metagpt/ext/spo/utils/evaluation_utils.py
import asyncio from pathlib import Path from typing import Any, List, Optional, Tuple import tiktoken from metagpt.ext.spo.components.evaluator import QuickEvaluate, QuickExecute from metagpt.logs import logger EVALUATION_REPETITION = 4 def count_tokens(sample: dict): if not sample: return 0 else: ...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/spo/prompts/evaluate_prompt.py
metagpt/ext/spo/prompts/evaluate_prompt.py
EVALUATE_PROMPT = """ Based on the original requirements, evaluate the two responses, A and B, and determine which one better meets the requirements. If a reference answer is provided, strictly follow the format/content of the reference answer. # Requirement {requirement} # A {sample} # B {new_sample} # Golden answ...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/spo/prompts/optimize_prompt.py
metagpt/ext/spo/prompts/optimize_prompt.py
PROMPT_OPTIMIZE_PROMPT = """ You are building a prompt to address user requirement. Based on the given prompt, please reconstruct and optimize it. You can add, modify, or delete prompts. Please include a single modification in XML tags in your reply. During the optimization, you can incorporate any thinking models. T...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/aflow/scripts/operator.py
metagpt/ext/aflow/scripts/operator.py
# -*- coding: utf-8 -*- # @Date : 6/27/2024 17:36 PM # @Author : didi # @Desc : operator demo of aflow import asyncio import concurrent.futures import random import sys import traceback from collections import Counter from typing import Dict, List, Tuple from tenacity import retry, stop_after_attempt, wait_fixe...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/aflow/scripts/operator_an.py
metagpt/ext/aflow/scripts/operator_an.py
# -*- coding: utf-8 -*- # @Date : 6/27/2024 19:46 PM # @Author : didi # @Desc : action nodes for operator from pydantic import BaseModel, Field class GenerateOp(BaseModel): response: str = Field(default="", description="Your solution for this problem") class CodeGenerateOp(BaseModel): code: str = Fi...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/aflow/scripts/optimizer.py
metagpt/ext/aflow/scripts/optimizer.py
# -*- coding: utf-8 -*- # @Date : 8/12/2024 22:00 PM # @Author : issac # @Desc : optimizer for graph import asyncio import time from typing import List, Literal from pydantic import BaseModel, Field from metagpt.actions.action_node import ActionNode from metagpt.ext.aflow.scripts.evaluator import DatasetType ...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/aflow/scripts/evaluator.py
metagpt/ext/aflow/scripts/evaluator.py
# -*- coding: utf-8 -*- # @Date : 8/23/2024 10:00 AM # @Author : all # @Desc : Evaluation for different datasets from typing import Dict, Literal, Tuple from metagpt.ext.aflow.benchmark.benchmark import BaseBenchmark from metagpt.ext.aflow.benchmark.drop import DROPBenchmark from metagpt.ext.aflow.benchmark.gs...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/aflow/scripts/interface.py
metagpt/ext/aflow/scripts/interface.py
# -*- coding: utf-8 -*- # @Date : 2024-03-21 # @Author : Your Name # @Desc : Interface for AFLOW import asyncio import importlib.util import sys from pathlib import Path from typing import Optional, Tuple from metagpt.configs.models_config import ModelsConfig from metagpt.ext.aflow.scripts.evaluator import Dat...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/aflow/scripts/utils.py
metagpt/ext/aflow/scripts/utils.py
""" @Time : 2024/7/24 16:37 @Author : didi @File : utils.py """ import json import re from enum import Enum from typing import Any, List, Tuple class CodeDataset(Enum): HUMAN_EVAL = "HumanEval" MBPP = "MBPP" def extract_test_cases_from_jsonl(entry_point: str, dataset: CodeDataset = CodeDataset.HUMAN...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/aflow/scripts/workflow.py
metagpt/ext/aflow/scripts/workflow.py
# -*- coding: utf-8 -*- # @Date : 6/27/2024 22:07 PM # @Author : didi # @Desc : Basic Graph Class from metagpt.ext.aflow.scripts.evaluator import DatasetType from metagpt.provider.llm_provider_registry import create_llm_instance from metagpt.utils.cost_manager import CostManager class Workflow: def __ini...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/aflow/scripts/prompts/prompt.py
metagpt/ext/aflow/scripts/prompts/prompt.py
# -*- coding: utf-8 -*- # @Date : 6/26/2024 17:07 PM # @Author : didi # @Desc : prompts of operators ANSWER_GENERATION_PROMPT = """ Think step by step and solve the problem. 1. In the "thought" field, explain your thinking process in detail. 2. In the "answer" field, provide the final answer concisely and clear...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false
FoundationAgents/MetaGPT
https://github.com/FoundationAgents/MetaGPT/blob/fc6e8433747be02826dec818627ed5cec0950e77/metagpt/ext/aflow/scripts/prompts/optimize_prompt.py
metagpt/ext/aflow/scripts/prompts/optimize_prompt.py
WORKFLOW_OPTIMIZE_PROMPT = """You are building a Graph and corresponding Prompt to jointly solve {type} problems. Referring to the given graph and prompt, which forms a basic example of a {type} solution approach, please reconstruct and optimize them. You can add, modify, or delete nodes, parameters, or prompts. Incl...
python
MIT
fc6e8433747be02826dec818627ed5cec0950e77
2026-01-04T14:38:37.890126Z
false