diff --git a/README.md b/README.md index a474105..b0a07a4 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,10 @@ python -m mindsearch.app --lang en --model_format internlm_server --search_engin - `--search_engine`: Search engine. - `DuckDuckGoSearch` for search engine for DuckDuckGo. - `BingSearch` for Bing search engine. + - `BraveSearch` for Brave search web api engine. + - `GoogleSearch` for Google Serper web search api engine. + + Please set your Web Search engine API key as the `WEB_SEARCH_API_KEY` environment variable unless you are using `DuckDuckGo`. ### Step3: Setup MindSearch Frontend @@ -100,25 +104,6 @@ python frontend/mindsearch_gradio.py streamlit run frontend/mindsearch_streamlit.py ``` -## 🌐 Change Web Search API - -To use a different type of web search API, modify the `searcher_type` attribute in the `searcher_cfg` located in `mindsearch/agent/__init__.py`. Currently supported web search APIs include: - -- `GoogleSearch` -- `DuckDuckGoSearch` -- `BraveSearch` -- `BingSearch` - -For example, to change to the Brave Search API, you would configure it as follows: - -```python -BingBrowser( - searcher_type='BraveSearch', - topk=2, - api_key=os.environ.get('BRAVE_API_KEY', 'YOUR BRAVE API') -) -``` - ## 🐞 Debug Locally ```bash diff --git a/README_zh-CN.md b/README_zh-CN.md index beca209..5aeb6f5 100644 --- a/README_zh-CN.md +++ b/README_zh-CN.md @@ -61,7 +61,12 @@ python -m mindsearch.app --lang en --model_format internlm_server --search_engin 如果您想使用其他模型,请修改 [models](./mindsearch/agent/models.py) - `--search_engine`: 搜索引擎。 - `DuckDuckGoSearch` 为 DuckDuckGo 搜索引擎。 - - `BingSearch` 为 Bing搜索引擎。 + - `BingSearch` 为 Bing 搜索引擎。 + - `BraveSearch` 为 Brave 搜索引擎。 + - `GoogleSearch` 为 Google Serper 搜索引擎。 + + 请将网页搜索引擎 API 密钥设置为 `WEB_SEARCH_API_KEY` 环境变量,如果使用的是 `DuckDuckGo`,则无需设置。 + ### 步骤3: 启动 MindSearch 前端 提供以下几种前端界面: diff --git a/mindsearch/agent/__init__.py b/mindsearch/agent/__init__.py index 96044f0..22f070b 100644 --- a/mindsearch/agent/__init__.py +++ b/mindsearch/agent/__init__.py @@ -45,8 +45,8 @@ def init_agent(lang='cn', model_format='internlm_server',search_engine='DuckDuck plugin_executor=ActionExecutor( BingBrowser(searcher_type=search_engine, topk=6, - api_key=os.environ.get('BING_API_KEY', - 'YOUR BING API'))), + api_key=os.environ.get('WEB_SEARCH_API_KEY', + 'YOUR WEB SEARCH ENGINE API'))), protocol=MindSearchProtocol( meta_prompt=datetime.now().strftime( 'The current date is %Y-%m-%d.'),