- 2024/11/05: ๐ฅณ MindSearch is now deployed on Puyu! ๐ Try it ๐
- Refactored the agent module based on Lagent v0.5 for better performance in concurrency.
- Improved the UI to embody the simultaneous multi-query search.
git clone https://github.com/InternLM/MindSearch
cd MindSearch
pip install -r requirements.txtBefore setting up the API, you need to configure environment variables. Rename the .env.example file to .env and fill in the required values.
mv .env.example .env
# Open .env and add your keys and model configurationsSetup FastAPI Server.
python -m mindsearch.app --lang en --model_format internlm_server --search_engine DuckDuckGoSearch --asy -
--lang: language of the model,enfor English andcnfor Chinese. -
--model_format: format of the model.internlm_serverfor InternLM2.5-7b-chat with local server. (InternLM2.5-7b-chat has been better optimized for Chinese.)gpt4for GPT4. if you want to use other models, please modify models
-
--search_engine: Search engine.DuckDuckGoSearchfor search engine for DuckDuckGo.BingSearchfor Bing search engine.BraveSearchfor Brave search web api engine.GoogleSearchfor Google Serper web search api engine.TencentSearchfor Tencent search api engine.
Please set your Web Search engine API key as the
WEB_SEARCH_API_KEYenvironment variable unless you are usingDuckDuckGo, orTencentSearchthat requires secret id asTENCENT_SEARCH_SECRET_IDand secret key asTENCENT_SEARCH_SECRET_KEY. -
--asy: deploy asynchronous agents.
Providing following frontend interfaces,
- React
First configurate the backend URL for Vite proxy.
HOST="127.0.0.1" # modify as you need
PORT=8002
sed -i -r "s/target:\s*\"\"/target: \"${HOST}:${PORT}\"/" frontend/React/vite.config.ts# Install Node.js and npm
# for Ubuntu
sudo apt install nodejs npm
# for windows
# download from https://nodejs.org/zh-cn/download/prebuilt-installer
# Install dependencies
cd frontend/React
npm install
npm startDetails can be found in React
- Gradio
python frontend/mindsearch_gradio.py- Streamlit
streamlit run frontend/mindsearch_streamlit.pyTo 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:
GoogleSearchDuckDuckGoSearchBraveSearchBingSearchTencentSearch
For example, to change to the Brave Search API, you would configure it as follows:
BingBrowser(
searcher_type='BraveSearch',
topk=2,
api_key=os.environ.get('BRAVE_API_KEY', 'YOUR BRAVE API')
)For users who prefer to interact with the backend directly, use the backend_example.py script. This script demonstrates how to send a query to the backend and process the response.
python backend_example.pyMake sure you have set up the environment variables and the backend is running before executing the script.
python -m mindsearch.terminalThis project is released under the Apache 2.0 license.
If you find this project useful in your research, please consider cite:
@article{chen2024mindsearch,
title={MindSearch: Mimicking Human Minds Elicits Deep AI Searcher},
author={Chen, Zehui and Liu, Kuikun and Wang, Qiuchen and Liu, Jiangning and Zhang, Wenwei and Chen, Kai and Zhao, Feng},
journal={arXiv preprint arXiv:2407.20183},
year={2024}
}
Explore our additional research on large language models, focusing on LLM agents.