Skip to content

Commit

Permalink
Merge pull request geekan#1397 from voidking/main
Browse files Browse the repository at this point in the history
chore: 修复单测依赖问题(忽略安卓单测)
  • Loading branch information
geekan authored Jul 16, 2024
2 parents 0c2b7da + 20b3623 commit 39eb534
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/unittest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 6 additions & 5 deletions metagpt/configs/llm_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

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"
Expand Down Expand Up @@ -97,12 +97,13 @@ def check_llm_key(cls, v):
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")
Expand Down
4 changes: 3 additions & 1 deletion metagpt/roles/researcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ async def _act(self) -> Message:
)
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:
Expand Down
2 changes: 1 addition & 1 deletion metagpt/utils/stream_pipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


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
Expand Down
5 changes: 2 additions & 3 deletions metagpt/utils/token_counter.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,8 @@
"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,
Expand Down Expand Up @@ -263,7 +263,6 @@
"qwen-7b-chat": 32000,
"qwen-1.8b-longcontext-chat": 32000,
"qwen-1.8b-chat": 8000,

}

# For Amazon Bedrock US region
Expand Down
52 changes: 27 additions & 25 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,30 +45,6 @@ def run(self):
"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"] = [
Expand All @@ -85,6 +61,9 @@ def run(self):
"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",
]
Expand All @@ -93,7 +72,30 @@ def run(self):
"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",
Expand Down

0 comments on commit 39eb534

Please sign in to comment.