Skip to content

Commit

Permalink
Fix conflict content in readme.md and change environment variable nam…
Browse files Browse the repository at this point in the history
…e from `'BING_API_KEY'` to `WEB_SEARCH_API_KEY` as mutiple search engine is supported (InternLM#178)

* Update README.md

* Update README_zh-CN.md

* Update README.md

* Update __init__.py
  • Loading branch information
tackhwa authored Sep 6, 2024
1 parent c32acc9 commit 4bd0e24
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 22 deletions.
23 changes: 4 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion README_zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 前端

提供以下几种前端界面:
Expand Down
4 changes: 2 additions & 2 deletions mindsearch/agent/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.'),
Expand Down

0 comments on commit 4bd0e24

Please sign in to comment.