mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-05-03 12:52:37 +02:00
Merge pull request #1727 from jason-jszhang/feat_merge_cr
Feat merge cr
This commit is contained in:
commit
4cc44c5da7
38 changed files with 47 additions and 85 deletions
|
|
@ -6,13 +6,12 @@ Author: garylin2099
|
|||
import re
|
||||
|
||||
from metagpt.actions import Action
|
||||
from metagpt.config2 import Config
|
||||
from metagpt.config2 import config
|
||||
from metagpt.const import METAGPT_ROOT
|
||||
from metagpt.logs import logger
|
||||
from metagpt.roles import Role
|
||||
from metagpt.schema import Message
|
||||
|
||||
config = Config.default()
|
||||
EXAMPLE_CODE_FILE = METAGPT_ROOT / "examples/build_customized_agent.py"
|
||||
MULTI_ACTION_AGENT_CODE_EXAMPLE = EXAMPLE_CODE_FILE.read_text()
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import fire
|
||||
|
||||
from metagpt.environment.mgx.mgx_env import MGXEnv
|
||||
from metagpt.logs import logger
|
||||
from metagpt.roles.di.team_leader import TeamLeader
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""RAG benchmark pipeline"""
|
||||
|
||||
import asyncio
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
from pathlib import Path
|
||||
|
||||
import chainlit as cl
|
||||
from init_setup import ChainlitEnv
|
||||
|
||||
|
|
@ -67,8 +69,8 @@ async def startup(message: cl.Message) -> None:
|
|||
|
||||
await company.run(n_round=5)
|
||||
|
||||
workdir = company.env.context.git_repo.workdir
|
||||
files = company.env.context.git_repo.get_files(workdir)
|
||||
workdir = Path(company.env.context.config.project_path)
|
||||
files = [file.name for file in workdir.iterdir() if file.is_file()]
|
||||
files = "\n".join([f"{workdir}/{file}" for file in files if not file.startswith(".git")])
|
||||
|
||||
await cl.Message(
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
import asyncio
|
||||
|
||||
from metagpt.environment.mgx.mgx_env import MGXEnv
|
||||
from metagpt.logs import logger
|
||||
from metagpt.roles.architect import Architect
|
||||
from metagpt.environment.mgx.mgx_env import MGXEnv
|
||||
from metagpt.schema import Message
|
||||
from metagpt.roles.di.team_leader import TeamLeader
|
||||
from metagpt.schema import Message
|
||||
|
||||
|
||||
async def main():
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ from pydantic import BaseModel
|
|||
|
||||
from metagpt.actions.requirement_analysis.framework.evaluate_framework import EvaluateFramework
|
||||
from metagpt.actions.requirement_analysis.framework.write_framework import WriteFramework
|
||||
from metagpt.config2 import Config
|
||||
from metagpt.config2 import config
|
||||
from metagpt.utils.common import awrite
|
||||
|
||||
|
||||
|
|
@ -54,7 +54,7 @@ async def save_framework(
|
|||
output_dir = (
|
||||
Path(output_dir)
|
||||
if output_dir
|
||||
else Config.default().workspace.path / (datetime.now().strftime("%Y%m%d%H%M%ST") + uuid.uuid4().hex[0:8])
|
||||
else config.workspace.path / (datetime.now().strftime("%Y%m%d%H%M%ST") + uuid.uuid4().hex[0:8])
|
||||
)
|
||||
output_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
|
|
|
|||
|
|
@ -178,3 +178,4 @@ def merge_dict(dicts: Iterable[Dict]) -> Dict:
|
|||
|
||||
|
||||
_CONFIG_CACHE = {}
|
||||
config = Config.default()
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import numpy.typing as npt
|
|||
from gymnasium import spaces
|
||||
from pydantic import ConfigDict, Field, field_validator
|
||||
|
||||
from metagpt.environment.base_env_space import (
|
||||
from metagpt.base.base_env_space import (
|
||||
BaseEnvAction,
|
||||
BaseEnvActionType,
|
||||
BaseEnvObsParams,
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
from gymnasium import spaces
|
||||
from pydantic import ConfigDict, Field
|
||||
|
||||
from metagpt.environment.base_env_space import BaseEnvAction, BaseEnvActionType
|
||||
from metagpt.base.base_env_space import BaseEnvAction, BaseEnvActionType
|
||||
from metagpt.environment.werewolf.const import STEP_INSTRUCTIONS
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ from typing import Any, Callable, Optional, TypeVar
|
|||
|
||||
from pydantic import BaseModel, ConfigDict, model_validator
|
||||
|
||||
from metagpt.config2 import Config
|
||||
from metagpt.config2 import config
|
||||
from metagpt.exp_pool.context_builders import BaseContextBuilder, SimpleContextBuilder
|
||||
from metagpt.exp_pool.manager import ExperienceManager, get_exp_manager
|
||||
from metagpt.exp_pool.perfect_judges import BasePerfectJudge, SimplePerfectJudge
|
||||
|
|
@ -60,8 +60,6 @@ def exp_cache(
|
|||
def decorator(func: Callable[..., ReturnType]) -> Callable[..., ReturnType]:
|
||||
@functools.wraps(func)
|
||||
async def get_or_create(args: Any, kwargs: Any) -> ReturnType:
|
||||
config = Config.default()
|
||||
|
||||
if not config.exp_pool.enabled:
|
||||
rsp = func(*args, **kwargs)
|
||||
return await rsp if asyncio.iscoroutine(rsp) else rsp
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@ class AndroidAssistant(Role):
|
|||
|
||||
def __init__(self, **data):
|
||||
super().__init__(**data)
|
||||
|
||||
self._watch([UserRequirement, AndroidActionOutput])
|
||||
extra_config = config.extra
|
||||
self.task_desc = extra_config.get("task_desc", "Just explore any app in this phone!")
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ from typing import Union
|
|||
|
||||
from openai import OpenAI
|
||||
|
||||
from metagpt.config2 import Config
|
||||
from metagpt.config2 import config
|
||||
from metagpt.logs import logger
|
||||
|
||||
|
||||
|
|
@ -48,7 +48,6 @@ def read_csv_to_list(curr_file: str, header=False, strip_trail=True):
|
|||
|
||||
|
||||
def get_embedding(text, model: str = "text-embedding-ada-002"):
|
||||
config = Config.default()
|
||||
text = text.replace("\n", " ")
|
||||
embedding = None
|
||||
if not text:
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ from llama_index.core.llms import (
|
|||
from llama_index.core.llms.callbacks import llm_completion_callback
|
||||
from pydantic import Field
|
||||
|
||||
from metagpt.config2 import Config
|
||||
from metagpt.config2 import config
|
||||
from metagpt.provider.base_llm import BaseLLM
|
||||
from metagpt.utils.async_helper import NestAsyncio
|
||||
from metagpt.utils.token_counter import TOKEN_MAX
|
||||
|
|
@ -41,7 +41,6 @@ class RAGLLM(CustomLLM):
|
|||
**kwargs
|
||||
):
|
||||
super().__init__(*args, **kwargs)
|
||||
config = Config.default()
|
||||
if context_window < 0:
|
||||
context_window = TOKEN_MAX.get(config.llm.model, DEFAULT_CONTEXT_WINDOW)
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ from llama_index.core.schema import TextNode
|
|||
from llama_index.core.vector_stores.types import VectorStoreQueryMode
|
||||
from pydantic import BaseModel, ConfigDict, Field, PrivateAttr, model_validator
|
||||
|
||||
from metagpt.config2 import Config
|
||||
from metagpt.config2 import config
|
||||
from metagpt.configs.embedding_config import EmbeddingType
|
||||
from metagpt.logs import logger
|
||||
from metagpt.rag.interface import RAGObject
|
||||
|
|
@ -47,7 +47,6 @@ class FAISSRetrieverConfig(IndexRetrieverConfig):
|
|||
@model_validator(mode="after")
|
||||
def check_dimensions(self):
|
||||
if self.dimensions == 0:
|
||||
config = Config.default()
|
||||
self.dimensions = config.embedding.dimensions or self._embedding_type_to_dimensions.get(
|
||||
config.embedding.api_type, 1536
|
||||
)
|
||||
|
|
@ -89,7 +88,6 @@ class MilvusRetrieverConfig(IndexRetrieverConfig):
|
|||
@model_validator(mode="after")
|
||||
def check_dimensions(self):
|
||||
if self.dimensions == 0:
|
||||
config = Config.default()
|
||||
self.dimensions = config.embedding.dimensions or self._embedding_type_to_dimensions.get(
|
||||
config.embedding.api_type, 1536
|
||||
)
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ def generate_repo(
|
|||
recover_path=None,
|
||||
):
|
||||
"""Run the startup logic. Can be called from CLI or other Python scripts."""
|
||||
from metagpt.config2 import Config
|
||||
from metagpt.config2 import config
|
||||
from metagpt.context import Context
|
||||
from metagpt.roles import (
|
||||
Architect,
|
||||
|
|
@ -38,8 +38,6 @@ def generate_repo(
|
|||
)
|
||||
from metagpt.team import Team
|
||||
|
||||
config = Config.default()
|
||||
|
||||
config.update_via_cli(project_path, project_name, inc, reqa_file, max_auto_summarize_code)
|
||||
ctx = Context(config=config)
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ from llama_index.core.base.embeddings.base import BaseEmbedding
|
|||
from llama_index.core.schema import NodeWithScore
|
||||
from pydantic import BaseModel, Field, model_validator
|
||||
|
||||
from metagpt.config2 import Config
|
||||
from metagpt.config2 import config
|
||||
from metagpt.context import Context
|
||||
from metagpt.logs import logger
|
||||
from metagpt.rag.engines import SimpleEngine
|
||||
|
|
@ -142,7 +142,6 @@ class IndexRepo(BaseModel):
|
|||
return flat_nodes
|
||||
|
||||
if not self.embedding:
|
||||
config = Config.default()
|
||||
if self.model:
|
||||
config.embedding.model = self.model
|
||||
factory = RAGEmbeddingFactory(config)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
import json
|
||||
from pathlib import Path
|
||||
|
||||
from metagpt.config2 import Config
|
||||
from metagpt.config2 import config
|
||||
from metagpt.provider.openai_api import OpenAILLM as GPTAPI
|
||||
from metagpt.utils.common import awrite
|
||||
|
||||
|
|
@ -282,7 +282,6 @@ class UTGenerator:
|
|||
"""Choose based on different calling methods"""
|
||||
result = ""
|
||||
if self.chatgpt_method == "API":
|
||||
config = Config.default()
|
||||
result = await GPTAPI(config.get_openai_llm()).aask_code(messages=messages)
|
||||
|
||||
return result
|
||||
|
|
|
|||
|
|
@ -7,11 +7,10 @@
|
|||
"""
|
||||
from llama_index.embeddings.openai import OpenAIEmbedding
|
||||
|
||||
from metagpt.config2 import Config
|
||||
from metagpt.config2 import config
|
||||
|
||||
|
||||
def get_embedding() -> OpenAIEmbedding:
|
||||
config = Config.default()
|
||||
llm = config.get_openai_llm()
|
||||
if llm is None:
|
||||
raise ValueError("To use OpenAIEmbedding, please ensure that config.llm.api_type is correctly set to 'openai'.")
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ from typing import Optional, Tuple, Union
|
|||
import aiofiles
|
||||
from fsspec.implementations.memory import MemoryFileSystem as _MemoryFileSystem
|
||||
|
||||
from metagpt.config2 import Config
|
||||
from metagpt.config2 import config
|
||||
from metagpt.logs import logger
|
||||
from metagpt.utils import read_docx
|
||||
from metagpt.utils.common import aread, aread_bin, awrite_bin, check_http_endpoint
|
||||
|
|
@ -190,7 +190,6 @@ class File:
|
|||
|
||||
@staticmethod
|
||||
async def _read_omniparse_config() -> Tuple[str, int]:
|
||||
config = Config.default()
|
||||
if config.omniparse and config.omniparse.base_url:
|
||||
return config.omniparse.base_url, config.omniparse.timeout
|
||||
return "", 0
|
||||
|
|
|
|||
|
|
@ -13,11 +13,10 @@ from semantic_kernel.connectors.ai.open_ai.services.open_ai_chat_completion impo
|
|||
OpenAIChatCompletion,
|
||||
)
|
||||
|
||||
from metagpt.config2 import Config
|
||||
from metagpt.config2 import config
|
||||
|
||||
|
||||
def make_sk_kernel():
|
||||
config = Config.default()
|
||||
kernel = sk.Kernel()
|
||||
if llm := config.get_azure_llm():
|
||||
kernel.add_chat_service(
|
||||
|
|
|
|||
2
setup.py
2
setup.py
|
|
@ -43,7 +43,7 @@ extras_require = {
|
|||
"llama-index-postprocessor-cohere-rerank==0.1.4",
|
||||
"llama-index-postprocessor-colbert-rerank==0.1.1",
|
||||
"llama-index-postprocessor-flag-embedding-reranker==0.1.2",
|
||||
# "llama-index-vector-stores-milvus==0.1.23",
|
||||
"llama-index-vector-stores-milvus==0.1.23",
|
||||
"docx2txt==0.8",
|
||||
],
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ from pathlib import Path
|
|||
|
||||
import pytest
|
||||
|
||||
from metagpt.config2 import Config
|
||||
from metagpt.config2 import config
|
||||
from metagpt.learn.text_to_embedding import text_to_embedding
|
||||
from metagpt.utils.common import aread
|
||||
|
||||
|
|
@ -19,7 +19,6 @@ from metagpt.utils.common import aread
|
|||
@pytest.mark.asyncio
|
||||
async def test_text_to_embedding(mocker):
|
||||
# mock
|
||||
config = Config.default()
|
||||
mock_post = mocker.patch("aiohttp.ClientSession.post")
|
||||
mock_response = mocker.AsyncMock()
|
||||
mock_response.status = 200
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import openai
|
|||
import pytest
|
||||
from pydantic import BaseModel
|
||||
|
||||
from metagpt.config2 import Config
|
||||
from metagpt.config2 import config
|
||||
from metagpt.learn.text_to_image import text_to_image
|
||||
from metagpt.tools.metagpt_text_to_image import MetaGPTText2Image
|
||||
from metagpt.tools.openai_text_to_image import OpenAIText2Image
|
||||
|
|
@ -26,7 +26,6 @@ async def test_text_to_image(mocker):
|
|||
mocker.patch.object(OpenAIText2Image, "text_2_image", return_value=b"mock OpenAIText2Image")
|
||||
mocker.patch.object(S3, "cache", return_value="http://mock/s3")
|
||||
|
||||
config = Config.default()
|
||||
assert config.metagpt_tti_url
|
||||
|
||||
data = await text_to_image("Panda emoji", size_type="512x512", config=config)
|
||||
|
|
@ -51,7 +50,6 @@ async def test_openai_text_to_image(mocker):
|
|||
mock_post.return_value.__aenter__.return_value = mock_response
|
||||
mocker.patch.object(S3, "cache", return_value="http://mock.s3.com/0.png")
|
||||
|
||||
config = Config.default()
|
||||
config.metagpt_tti_url = None
|
||||
assert config.get_openai_llm()
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
import pytest
|
||||
from azure.cognitiveservices.speech import ResultReason, SpeechSynthesizer
|
||||
|
||||
from metagpt.config2 import Config
|
||||
from metagpt.config2 import config
|
||||
from metagpt.learn.text_to_speech import text_to_speech
|
||||
from metagpt.tools.iflytek_tts import IFlyTekTTS
|
||||
from metagpt.utils.s3 import S3
|
||||
|
|
@ -19,7 +19,6 @@ from metagpt.utils.s3 import S3
|
|||
@pytest.mark.asyncio
|
||||
async def test_azure_text_to_speech(mocker):
|
||||
# mock
|
||||
config = Config.default()
|
||||
config.iflytek_api_key = None
|
||||
config.iflytek_api_secret = None
|
||||
config.iflytek_app_id = None
|
||||
|
|
@ -47,7 +46,6 @@ async def test_azure_text_to_speech(mocker):
|
|||
@pytest.mark.asyncio
|
||||
async def test_iflytek_text_to_speech(mocker):
|
||||
# mock
|
||||
config = Config.default()
|
||||
config.azure_tts_subscription_key = None
|
||||
config.azure_tts_region = None
|
||||
mocker.patch.object(IFlyTekTTS, "synthesize_speech", return_value=None)
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import sys
|
|||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
|
||||
from metagpt.config2 import Config
|
||||
from metagpt.config2 import config
|
||||
from metagpt.const import DEFAULT_WORKSPACE_ROOT, METAGPT_ROOT
|
||||
from metagpt.logs import logger
|
||||
from metagpt.roles.di.engineer2 import Engineer2
|
||||
|
|
@ -15,7 +15,6 @@ from metagpt.tools.libs.editor import Editor
|
|||
from metagpt.tools.libs.terminal import Terminal
|
||||
from metagpt.tools.swe_agent_commands.swe_agent_utils import load_hf_dataset
|
||||
|
||||
config = Config.default()
|
||||
# Specify by yourself
|
||||
TEST_REPO_DIR = METAGPT_ROOT / "data" / "test_repo"
|
||||
DATA_DIR = METAGPT_ROOT / "data/hugging_face"
|
||||
|
|
|
|||
|
|
@ -1,22 +1,17 @@
|
|||
import pytest
|
||||
|
||||
from metagpt.environment.mgx.mgx_env import MGXEnv
|
||||
from metagpt.roles.di.swe_agent import SWEAgent
|
||||
from metagpt.roles.di.team_leader import TeamLeader
|
||||
from metagpt.schema import Message
|
||||
from metagpt.tools.libs.terminal import Bash
|
||||
from metagpt.environment.mgx.mgx_env import MGXEnv
|
||||
from metagpt.roles.di.team_leader import TeamLeader
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def env():
|
||||
test_env = MGXEnv()
|
||||
tl = TeamLeader()
|
||||
test_env.add_roles(
|
||||
[
|
||||
tl,
|
||||
SWEAgent()
|
||||
]
|
||||
)
|
||||
test_env.add_roles([tl, SWEAgent()])
|
||||
return test_env
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -8,18 +8,19 @@
|
|||
distribution feature for message handling.
|
||||
"""
|
||||
import uuid
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from metagpt.actions import WritePRD
|
||||
from metagpt.actions.di.run_command import RunCommand
|
||||
from metagpt.const import PRDS_FILE_REPO
|
||||
from metagpt.logs import logger
|
||||
from metagpt.roles import Architect
|
||||
from metagpt.schema import Message
|
||||
from metagpt.utils.common import any_to_str, awrite
|
||||
from tests.metagpt.roles.mock import MockMessages
|
||||
from pathlib import Path
|
||||
from metagpt.actions.di.run_command import RunCommand
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_architect(context):
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
"""
|
||||
import json
|
||||
from pathlib import Path
|
||||
from types import SimpleNamespace
|
||||
|
||||
import pytest
|
||||
|
||||
|
|
@ -19,9 +20,8 @@ from metagpt.roles.engineer import Engineer
|
|||
from metagpt.schema import CodingContext, Message
|
||||
from metagpt.utils.common import CodeParser, any_to_name, any_to_str, aread, awrite
|
||||
from metagpt.utils.git_repository import ChangeType
|
||||
from tests.metagpt.roles.mock import STRS_FOR_PARSING, TASKS, MockMessages
|
||||
from metagpt.utils.project_repo import ProjectRepo
|
||||
from types import SimpleNamespace
|
||||
from tests.metagpt.roles.mock import STRS_FOR_PARSING, TASKS, MockMessages
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
|
|
|||
|
|
@ -5,12 +5,10 @@
|
|||
@Author : alexanderwu
|
||||
@File : test_document.py
|
||||
"""
|
||||
from metagpt.config2 import Config
|
||||
from metagpt.config2 import config
|
||||
from metagpt.document import Repo
|
||||
from metagpt.logs import logger
|
||||
|
||||
config = Config.default()
|
||||
|
||||
|
||||
def set_existing_repo(path):
|
||||
repo1 = Repo.from_path(path)
|
||||
|
|
|
|||
|
|
@ -12,11 +12,9 @@ from pathlib import Path
|
|||
import pytest
|
||||
from azure.cognitiveservices.speech import ResultReason, SpeechSynthesizer
|
||||
|
||||
from metagpt.config2 import Config
|
||||
from metagpt.config2 import config
|
||||
from metagpt.tools.azure_tts import AzureTTS
|
||||
|
||||
config = Config.default()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_azure_tts(mocker):
|
||||
|
|
|
|||
|
|
@ -7,14 +7,13 @@
|
|||
"""
|
||||
import pytest
|
||||
|
||||
from metagpt.config2 import Config
|
||||
from metagpt.config2 import config
|
||||
from metagpt.tools.iflytek_tts import IFlyTekTTS, oas3_iflytek_tts
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_iflytek_tts(mocker):
|
||||
# mock
|
||||
config = Config.default()
|
||||
config.azure_tts_subscription_key = None
|
||||
config.azure_tts_region = None
|
||||
mocker.patch.object(IFlyTekTTS, "synthesize_speech", return_value=None)
|
||||
|
|
|
|||
|
|
@ -10,11 +10,9 @@ from unittest.mock import AsyncMock
|
|||
|
||||
import pytest
|
||||
|
||||
from metagpt.config2 import Config
|
||||
from metagpt.config2 import config
|
||||
from metagpt.tools.metagpt_text_to_image import oas3_metagpt_text_to_image
|
||||
|
||||
config = Config.default()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_draw(mocker):
|
||||
|
|
|
|||
|
|
@ -8,12 +8,10 @@
|
|||
|
||||
import pytest
|
||||
|
||||
from metagpt.config2 import Config
|
||||
from metagpt.config2 import config
|
||||
from metagpt.llm import LLM
|
||||
from metagpt.tools.moderation import Moderation
|
||||
|
||||
config = Config.default()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.parametrize(
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ from pathlib import Path
|
|||
|
||||
import pytest
|
||||
|
||||
from metagpt.config2 import Config
|
||||
from metagpt.config2 import config
|
||||
from metagpt.tools.openai_text_to_embedding import oas3_openai_text_to_embedding
|
||||
from metagpt.utils.common import aread
|
||||
|
||||
|
|
@ -18,7 +18,6 @@ from metagpt.utils.common import aread
|
|||
@pytest.mark.asyncio
|
||||
async def test_embedding(mocker):
|
||||
# mock
|
||||
config = Config.default()
|
||||
mock_post = mocker.patch("aiohttp.ClientSession.post")
|
||||
mock_response = mocker.AsyncMock()
|
||||
mock_response.status = 200
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import openai
|
|||
import pytest
|
||||
from pydantic import BaseModel
|
||||
|
||||
from metagpt.config2 import Config
|
||||
from metagpt.config2 import config
|
||||
from metagpt.llm import LLM
|
||||
from metagpt.tools.openai_text_to_image import (
|
||||
OpenAIText2Image,
|
||||
|
|
@ -19,8 +19,6 @@ from metagpt.tools.openai_text_to_image import (
|
|||
)
|
||||
from metagpt.utils.s3 import S3
|
||||
|
||||
config = Config.default()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_draw(mocker):
|
||||
|
|
|
|||
|
|
@ -20,12 +20,10 @@ from openai.types.chat.chat_completion_message_tool_call import (
|
|||
Function,
|
||||
)
|
||||
|
||||
from metagpt.config2 import Config
|
||||
from metagpt.config2 import config
|
||||
from metagpt.const import API_QUESTIONS_PATH, UT_PY_PATH
|
||||
from metagpt.tools.ut_writer import YFT_PROMPT_PREFIX, UTGenerator
|
||||
|
||||
config = Config.default()
|
||||
|
||||
|
||||
class TestUTWriter:
|
||||
@pytest.mark.asyncio
|
||||
|
|
|
|||
|
|
@ -2,9 +2,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# @Desc : unittest of repair_llm_raw_output
|
||||
|
||||
from metagpt.config2 import Config
|
||||
|
||||
config = Config.default()
|
||||
from metagpt.config2 import config
|
||||
|
||||
"""
|
||||
CONFIG.repair_llm_output should be True before retry_parse_json_text imported.
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import json
|
||||
from typing import Optional, Union
|
||||
|
||||
from metagpt.config2 import Config
|
||||
from metagpt.config2 import config
|
||||
from metagpt.configs.llm_config import LLMType
|
||||
from metagpt.const import LLM_API_TIMEOUT
|
||||
from metagpt.logs import logger
|
||||
|
|
@ -10,8 +10,6 @@ from metagpt.provider.constant import GENERAL_FUNCTION_SCHEMA
|
|||
from metagpt.provider.openai_api import OpenAILLM
|
||||
from metagpt.schema import Message
|
||||
|
||||
config = Config.default()
|
||||
|
||||
OriginalLLM = OpenAILLM if config.llm.api_type == LLMType.OPENAI else AzureOpenAILLM
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue