Skip to content

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

chore: 修复单测依赖问题(忽略安卓单测)

voidking20b362353636
diff --git a/.github/workflows/unittest.yaml b/.github/workflows/unittest.yaml
index afa9faba7..dc5ae605b 100644
--- a/.github/workflows/unittest.yaml
+++ b/.github/workflows/unittest.yaml
@@ -32,7 +32,7 @@ jobs:
run: |
export ALLOW_OPENAI_API_CALL=0
mkdir -p ~/.metagpt && cp tests/config2.yaml ~/.metagpt/config2.yaml
- pytest tests/ --doctest-modules --cov=./metagpt/ --cov-report=xml:cov.xml --cov-report=html:htmlcov --durations=20 | tee unittest.txt
+ pytest tests/ --ignore=tests/metagpt/environment/android_env --ignore=tests/metagpt/ext/android_assistant --doctest-modules --cov=./metagpt/ --cov-report=xml:cov.xml --cov-report=html:htmlcov --durations=20 | tee unittest.txt
- name: Show coverage report
run: |
coverage report -m
diff --git a/metagpt/configs/llm_config.py b/metagpt/configs/llm_config.py
index 0284c8993..67fb6afdb 100644
--- a/metagpt/configs/llm_config.py
+++ b/metagpt/configs/llm_config.py
@@ -10,9 +10,9 @@ from typing import Optional
from pydantic import field_validator
-from metagpt.const import LLM_API_TIMEOUT
+from metagpt.const import CONFIG_ROOT, LLM_API_TIMEOUT, METAGPT_ROOT
from metagpt.utils.yaml_model import YamlModel
-from metagpt.const import METAGPT_ROOT, CONFIG_ROOT
+
class LLMType(Enum):
OPENAI = "openai"
@@ -97,12 +97,13 @@ class LLMConfig(YamlModel):
repo_config_path = METAGPT_ROOT / "config/config2.yaml"
root_config_path = CONFIG_ROOT / "config2.yaml"
if root_config_path.exists():
- raise ValueError(
- f"Please set your API key in {root_config_path}. If you also set your config in {repo_config_path}, \nthe former will overwrite the latter. This may cause unexpected result.\n")
+ raise ValueError(
+ f"Please set your API key in {root_config_path}. If you also set your config in {repo_config_path}, \nthe former will overwrite the latter. This may cause unexpected result.\n"
+ )
elif repo_config_path.exists():
raise ValueError(f"Please set your API key in {repo_config_path}")
else:
- raise ValueError(f"Please set your API key in config2.yaml")
+ raise ValueError("Please set your API key in config2.yaml")
return v
@field_validator("timeout")
diff --git a/metagpt/roles/researcher.py b/metagpt/roles/researcher.py
index 5c6c1d9f4..8be2ba6f4 100644
--- a/metagpt/roles/researcher.py
+++ b/metagpt/roles/researcher.py
@@ -58,7 +58,9 @@ class Researcher(Role):
)
elif isinstance(todo, WebBrowseAndSummarize):
links = instruct_content.links
- todos = (todo.run(*url, query=query, system_text=research_system_text) for (query, url) in links.items() if url)
+ todos = (
+ todo.run(*url, query=query, system_text=research_system_text) for (query, url) in links.items() if url
+ )
if self.enable_concurrency:
summaries = await asyncio.gather(*todos)
else:
diff --git a/metagpt/utils/stream_pipe.py b/metagpt/utils/stream_pipe.py
index 1cccda7ee..15a1eef1f 100644
--- a/metagpt/utils/stream_pipe.py
+++ b/metagpt/utils/stream_pipe.py
@@ -11,7 +11,7 @@ from multiprocessing import Pipe
class StreamPipe:
- def __init__(self,name=None):
+ def __init__(self, name=None):
self.name = name
self.parent_conn, self.child_conn = Pipe()
self.finish: bool = False
diff --git a/metagpt/utils/token_counter.py b/metagpt/utils/token_counter.py
index 0d69fca10..fda19cdba 100644
--- a/metagpt/utils/token_counter.py
+++ b/metagpt/utils/token_counter.py
@@ -226,8 +226,8 @@ TOKEN_MAX = {
"claude-2.1": 200000,
"claude-3-sonnet-20240229": 200000,
"claude-3-opus-20240229": 200000,
- "claude-3-5-sonnet-20240620":200000,
- "claude-3-haiku-20240307":200000,
+ "claude-3-5-sonnet-20240620": 200000,
+ "claude-3-haiku-20240307": 200000,
"yi-34b-chat-0205": 4000,
"yi-34b-chat-200k": 200000,
"yi-large": 16385,
@@ -263,7 +263,6 @@ TOKEN_MAX = {
"qwen-7b-chat": 32000,
"qwen-1.8b-longcontext-chat": 32000,
"qwen-1.8b-chat": 8000,
-
}
# For Amazon Bedrock US region
diff --git a/setup.py b/setup.py
index 6a15d5eda..8ba4c8a72 100644
--- a/setup.py
+++ b/setup.py
@@ -45,30 +45,6 @@ extras_require = {
"llama-index-postprocessor-flag-embedding-reranker==0.1.2",
"docx2txt==0.8",
],
- "android_assistant": [
- "pyshine==0.0.9",
- "opencv-python==4.6.0.66",
- "protobuf<3.20,>=3.9.2",
- "modelscope",
- "tensorflow==2.9.1; os_name == 'linux'",
- "tensorflow==2.9.1; os_name == 'win32'",
- "tensorflow-macos==2.9; os_name == 'darwin'",
- "keras==2.9.0",
- "torch",
- "torchvision",
- "transformers",
- "opencv-python",
- "matplotlib",
- "pycocotools",
- "SentencePiece",
- "tf_slim",
- "tf_keras",
- "pyclipper",
- "shapely",
- "groundingdino-py",
- "datasets==2.18.0",
- "clip-openai",
- ],
}
extras_require["test"] = [
@@ -85,6 +61,9 @@ extras_require["test"] = [
"aioboto3~=12.4.0",
"gradio==3.0.0",
"grpcio-status==1.48.2",
+ "grpcio-tools==1.48.2",
+ "google-api-core==2.17.1",
+ "protobuf==3.19.6",
"pylint==3.0.3",
"pybrowsers",
]
@@ -93,7 +72,30 @@ extras_require["pyppeteer"] = [
"pyppeteer>=1.0.2"
] # pyppeteer is unmaintained and there are conflicts with dependencies
extras_require["dev"] = (["pylint~=3.0.3", "black~=23.3.0", "isort~=5.12.0", "pre-commit~=3.6.0"],)
-
+extras_require["android_assistant"] = [
+ "pyshine==0.0.9",
+ "opencv-python==4.6.0.66",
+ "protobuf<3.20,>=3.9.2",
+ "modelscope",
+ "tensorflow==2.9.1; os_name == 'linux'",
+ "tensorflow==2.9.1; os_name == 'win32'",
+ "tensorflow-macos==2.9; os_name == 'darwin'",
+ "keras==2.9.0",
+ "torch",
+ "torchvision",
+ "transformers",
+ "opencv-python",
+ "matplotlib",
+ "pycocotools",
+ "SentencePiece",
+ "tf_slim",
+ "tf_keras",
+ "pyclipper",
+ "shapely",
+ "groundingdino-py",
+ "datasets==2.18.0",
+ "clip-openai",
+]
setup(
name="metagpt",