Skip to content

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

fix bugs

geekan139c7c363f59
diff --git a/README.md b/README.md
index 19971acca..a03c1eabf 100644
--- a/README.md
+++ b/README.md
@@ -53,7 +53,7 @@ cd MetaGPT
pip3 install -e . # or pip3 install metagpt # for stable version
# Step 3: setup your OPENAI_API_KEY, or make sure it existed in the env
-mkdir ~/.metagpt/key.yaml
+mkdir ~/.metagpt
cp config/config.yaml ~/.metagpt/key.yaml
vim ~/.metagpt/key.yaml
diff --git a/examples/search_with_specific_engine.py b/examples/search_with_specific_engine.py
index 334a7821f..923f538ed 100644
--- a/examples/search_with_specific_engine.py
+++ b/examples/search_with_specific_engine.py
@@ -5,12 +5,13 @@ from metagpt.tools import SearchEngineType
async def main():
+ question = "What are the most interesting human facts?"
# Serper API
- # await Searcher(engine = SearchEngineType.SERPER_GOOGLE).run(["What are some good sun protection products?","What are some of the best beaches?"])
+ # await Searcher(engine=SearchEngineType.SERPER_GOOGLE).run(question)
# SerpAPI
- # await Searcher(engine=SearchEngineType.SERPAPI_GOOGLE).run("What are the best ski brands for skiers?")
+ # await Searcher(engine=SearchEngineType.SERPAPI_GOOGLE).run(question)
# Google API
- await Searcher(engine=SearchEngineType.DIRECT_GOOGLE).run("What are the most interesting human facts?")
+ await Searcher(engine=SearchEngineType.DIRECT_GOOGLE).run(question)
if __name__ == "__main__":
diff --git a/metagpt/actions/search_and_summarize.py b/metagpt/actions/search_and_summarize.py
index 6ab7becb6..bc1319291 100644
--- a/metagpt/actions/search_and_summarize.py
+++ b/metagpt/actions/search_and_summarize.py
@@ -16,6 +16,7 @@ from metagpt.llm import LLM
from metagpt.logs import logger
from metagpt.provider.base_gpt_api import BaseGPTAPI
from metagpt.schema import Message
+from metagpt.tools import SearchEngineType
from metagpt.tools.search_engine import SearchEngine
SEARCH_AND_SUMMARIZE_SYSTEM = """### Requirements
@@ -109,7 +110,7 @@ class SearchAndSummarize(Action):
content: Optional[str] = None
llm: BaseGPTAPI = Field(default_factory=LLM)
config: None = Field(default_factory=Config)
- engine: Optional[str] = CONFIG.search_engine
+ engine: Optional[SearchEngineType] = CONFIG.search_engine
search_func: Optional[str] = None
search_engine: SearchEngine = None
diff --git a/metagpt/roles/role.py b/metagpt/roles/role.py
index 8c5743467..b9fde7d05 100644
--- a/metagpt/roles/role.py
+++ b/metagpt/roles/role.py
@@ -267,7 +267,7 @@ class Role(BaseModel):
## 默认初始化
i = action(name="", llm=self._llm)
else:
- if self._setting.is_human and not isinstance(action.llm, HumanProvider):
+ if self.is_human and not isinstance(action.llm, HumanProvider):
logger.warning(
f"is_human attribute does not take effect, "
f"as Role's {str(action)} was initialized using LLM, "
diff --git a/metagpt/roles/sales.py b/metagpt/roles/sales.py
index ba0a6fc6b..76abf10f3 100644
--- a/metagpt/roles/sales.py
+++ b/metagpt/roles/sales.py
@@ -31,7 +31,7 @@ class Sales(Role):
def _set_store(self, store):
if store:
- action = SearchAndSummarize("", engine=SearchEngineType.CUSTOM_ENGINE, search_func=store.asearch)
+ action = SearchAndSummarize(name="", engine=SearchEngineType.CUSTOM_ENGINE, search_func=store.asearch)
else:
action = SearchAndSummarize()
self._init_actions([action])
diff --git a/metagpt/roles/searcher.py b/metagpt/roles/searcher.py
index a2136064f..e4a672176 100644
--- a/metagpt/roles/searcher.py
+++ b/metagpt/roles/searcher.py
@@ -52,7 +52,7 @@ class Searcher(Role):
def set_search_func(self, search_func):
"""Sets a custom search function for the searcher."""
- action = SearchAndSummarize("", engine=SearchEngineType.CUSTOM_ENGINE, search_func=search_func)
+ action = SearchAndSummarize(name="", engine=SearchEngineType.CUSTOM_ENGINE, search_func=search_func)
self._init_actions([action])
async def _act_sp(self) -> Message: