mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-06-08 15:05:17 +02:00
commit
5446c7e490
13 changed files with 69 additions and 8 deletions
7
.coveragerc
Normal file
7
.coveragerc
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
[run]
|
||||
source =
|
||||
./metagpt/
|
||||
omit =
|
||||
*/metagpt/environment/android/*
|
||||
*/metagpt/ext/android_assistant/*
|
||||
*/metagpt/ext/werewolf/*
|
||||
5
.github/workflows/fulltest.yaml
vendored
5
.github/workflows/fulltest.yaml
vendored
|
|
@ -30,7 +30,10 @@ jobs:
|
|||
cache: 'pip'
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sh tests/scripts/run_install_deps.sh
|
||||
python -m pip install --upgrade pip
|
||||
pip install -e .[test]
|
||||
npm install -g @mermaid-js/mermaid-cli
|
||||
playwright install --with-deps
|
||||
- name: Run reverse proxy script for ssh service
|
||||
if: contains(github.ref, '-debugger')
|
||||
continue-on-error: true
|
||||
|
|
|
|||
45
.github/workflows/unittest.yaml
vendored
45
.github/workflows/unittest.yaml
vendored
|
|
@ -27,20 +27,57 @@ jobs:
|
|||
cache: 'pip'
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sh tests/scripts/run_install_deps.sh
|
||||
python -m pip install --upgrade pip
|
||||
pip install -e .[test]
|
||||
npm install -g @mermaid-js/mermaid-cli
|
||||
playwright install --with-deps
|
||||
- name: Test with pytest
|
||||
run: |
|
||||
export ALLOW_OPENAI_API_CALL=0
|
||||
mkdir -p ~/.metagpt && cp tests/config2.yaml ~/.metagpt/config2.yaml
|
||||
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
|
||||
pytest --continue-on-collection-errors tests/ \
|
||||
--ignore=tests/metagpt/environment/android_env \
|
||||
--ignore=tests/metagpt/ext/android_assistant \
|
||||
--ignore=tests/metagpt/ext/stanford_town \
|
||||
--ignore=tests/metagpt/provider/test_bedrock_api.py \
|
||||
--ignore=tests/metagpt/rag/factories/test_embedding.py \
|
||||
--ignore=tests/metagpt/ext/werewolf/actions/test_experience_operation.py \
|
||||
--ignore=tests/metagpt/provider/test_openai.py \
|
||||
--ignore=tests/metagpt/planner/test_action_planner.py \
|
||||
--ignore=tests/metagpt/planner/test_basic_planner.py \
|
||||
--ignore=tests/metagpt/actions/test_project_management.py \
|
||||
--ignore=tests/metagpt/actions/test_write_code.py \
|
||||
--ignore=tests/metagpt/actions/test_write_code_review.py \
|
||||
--ignore=tests/metagpt/actions/test_write_prd.py \
|
||||
--ignore=tests/metagpt/environment/werewolf_env/test_werewolf_ext_env.py \
|
||||
--ignore=tests/metagpt/memory/test_brain_memory.py \
|
||||
--ignore=tests/metagpt/roles/test_assistant.py \
|
||||
--ignore=tests/metagpt/roles/test_engineer.py \
|
||||
--ignore=tests/metagpt/serialize_deserialize/test_write_code_review.py \
|
||||
--ignore=tests/metagpt/test_environment.py \
|
||||
--ignore=tests/metagpt/test_llm.py \
|
||||
--ignore=tests/metagpt/tools/test_metagpt_oas3_api_svc.py \
|
||||
--ignore=tests/metagpt/tools/test_moderation.py \
|
||||
--ignore=tests/metagpt/tools/test_search_engine.py \
|
||||
--ignore=tests/metagpt/tools/test_tool_convert.py \
|
||||
--ignore=tests/metagpt/tools/test_web_browser_engine_playwright.py \
|
||||
--ignore=tests/metagpt/utils/test_mermaid.py \
|
||||
--ignore=tests/metagpt/utils/test_redis.py \
|
||||
--ignore=tests/metagpt/utils/test_tree.py \
|
||||
--ignore=tests/metagpt/serialize_deserialize/test_sk_agent.py \
|
||||
--ignore=tests/metagpt/utils/test_text.py \
|
||||
--ignore=tests/metagpt/actions/di/test_write_analysis_code.py \
|
||||
--ignore=tests/metagpt/provider/test_ark.py \
|
||||
--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
|
||||
- name: Show failed tests and overall summary
|
||||
run: |
|
||||
grep -E "FAILED tests|ERROR tests|[0-9]+ passed," unittest.txt
|
||||
failed_count=$(grep -E "FAILED|ERROR" unittest.txt | wc -l)
|
||||
if [[ "$failed_count" -gt 0 ]]; then
|
||||
failed_count=$(grep -E "FAILED tests|ERROR tests" unittest.txt | wc -l | tr -d '[:space:]')
|
||||
if [[ $failed_count -gt 0 ]]; then
|
||||
echo "$failed_count failed lines found! Task failed."
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -76,4 +76,6 @@ models:
|
|||
# proxy: "YOUR_PROXY" # for LLM API requests
|
||||
# # timeout: 600 # Optional. If set to 0, default value is 300.
|
||||
# # Details: https://azure.microsoft.com/en-us/pricing/details/cognitive-services/openai-service/
|
||||
# pricing_plan: "" # Optional. Use for Azure LLM when its model name is not the same as OpenAI's
|
||||
# pricing_plan: "" # Optional. Use for Azure LLM when its model name is not the same as OpenAI's
|
||||
|
||||
agentops_api_key: "YOUR_AGENTOPS_API_KEY" # get key from https://app.agentops.ai/settings/projects
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ class Config(CLIParams, YamlModel):
|
|||
workspace: WorkspaceConfig = WorkspaceConfig()
|
||||
enable_longterm_memory: bool = False
|
||||
code_review_k_times: int = 2
|
||||
agentops_api_key: str = ""
|
||||
|
||||
# Will be removed in the future
|
||||
metagpt_tti_url: str = ""
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
@File : architect.py
|
||||
"""
|
||||
|
||||
|
||||
from metagpt.actions import WritePRD
|
||||
from metagpt.actions.design_api import WriteDesign
|
||||
from metagpt.roles.role import Role
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
@Modified By: mashenquan, 2023/11/27. Add `PrepareDocuments` action according to Section 2.2.3.5.1 of RFC 135.
|
||||
"""
|
||||
|
||||
|
||||
from metagpt.actions import UserRequirement, WritePRD
|
||||
from metagpt.actions.prepare_documents import PrepareDocuments
|
||||
from metagpt.roles.role import Role, RoleReactMode
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
@File : project_manager.py
|
||||
"""
|
||||
|
||||
|
||||
from metagpt.actions import WriteTasks
|
||||
from metagpt.actions.design_api import WriteDesign
|
||||
from metagpt.roles.role import Role
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
of SummarizeCode.
|
||||
"""
|
||||
|
||||
|
||||
from metagpt.actions import DebugError, RunCode, WriteTest
|
||||
from metagpt.actions.summarize_code import SummarizeCode
|
||||
from metagpt.const import MESSAGE_ROUTE_TO_NONE
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
import asyncio
|
||||
from pathlib import Path
|
||||
|
||||
import agentops
|
||||
import typer
|
||||
|
||||
from metagpt.const import CONFIG_ROOT
|
||||
|
|
@ -38,6 +39,9 @@ def generate_repo(
|
|||
)
|
||||
from metagpt.team import Team
|
||||
|
||||
if config.agentops_api_key != "":
|
||||
agentops.init(config.agentops_api_key, tags=["software_company"])
|
||||
|
||||
config.update_via_cli(project_path, project_name, inc, reqa_file, max_auto_summarize_code)
|
||||
ctx = Context(config=config)
|
||||
|
||||
|
|
@ -68,6 +72,9 @@ def generate_repo(
|
|||
company.run_project(idea)
|
||||
asyncio.run(company.run(n_round=n_round))
|
||||
|
||||
if config.agentops_api_key != "":
|
||||
agentops.end_session("Success")
|
||||
|
||||
return ctx.repo
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -74,3 +74,4 @@ rank-bm25==0.2.2 # for tool recommendation
|
|||
gymnasium==0.29.1
|
||||
boto3~=1.34.69
|
||||
spark_ai_python~=0.3.30
|
||||
agentops
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ def is_subset(subset, superset) -> bool:
|
|||
superset = {"prompt": "hello", "kwargs": {"temperature": 0.0, "top-p": 0.0}}
|
||||
is_subset(subset, superset)
|
||||
```
|
||||
>>>False
|
||||
|
||||
"""
|
||||
for key, value in subset.items():
|
||||
if key not in superset:
|
||||
|
|
|
|||
|
|
@ -114,7 +114,6 @@ class MockLLM(OriginalLLM):
|
|||
raise ValueError(
|
||||
"In current test setting, api call is not allowed, you should properly mock your tests, "
|
||||
"or add expected api response in tests/data/rsp_cache.json. "
|
||||
f"The prompt you want for api call: {msg_key}"
|
||||
)
|
||||
# Call the original unmocked method
|
||||
rsp = await ask_func(*args, **kwargs)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue