一、开发环境配置
1、打开codespace主页,选择Blank模板进行创建

2、创建conda环境隔离并安装依赖
conda create -n mindsearch python=3.10 -y
conda init
因为是新建的codespace,在第一次创建conda环境时,需要conda init
然后再另启一个终端并activate 环境
conda activate mindsearch
cd /workspaces/codespaces-blank
git clone https://github.com/InternLM/MindSearch.git && cd MindSearch && git checkout ae5b0c5
pip install -r requirements.txt
二、获取硅基流动API KEY

三、启动MindSearch
1、启动后端
export SILICON_API_KEY=<上面复制的API KEY>
conda activate mindsearch
进入你clone的项目目录
cd /workspaces/codespaces-blank/MindSearch
python -m mindsearch.app --lang cn --model_format internlm_silicon --search_engine DuckDuckGoSearch --asy

2、启动前端
conda activate mindsearch
进入你clone的项目目录
cd /workspaces/codespaces-blank/MindSearch
python frontend/mindsearch_gradio.py

当前后端都启动后,可以看到github自动为这两个进程做端口转发

3、打开网页
**询问问题:**MindSearch


问题回答很有逻辑。首先创建一个搜索图,然后添加根节点来表示问题。
接下来,继续通过添加子问题节点来逐步解答疑问。
四、部署到自己的 HuggingFace Spaces上
1、选择配置
1)进入MindSearch Spaces应用

2)在页面右上角,选择Duplicate this Space

3)选择配置
Space Hardware=Free的2vCPU
填写SILICON_API_KEY=硅基流动的API KEY

2、测试结果


五、附笔记
MindSearch 简介
MindSearch是一个开源的 AI 搜索引擎框架,具有与 Perplexity.ai Pro 相同的性能。
可以轻松部署它来构建自己的专属搜索引擎,可以基于闭源的LLM(如GPT、Claude系列),也可以使用开源的LLM(如经过专门优化的InternLM2.5 系列模型,能够在MindSearch框架中提供卓越的性能)
最新版的MindSearch拥有以下特性:
- 任何你想知道的问题:MindSearch 通过搜索解决你在生活中遇到的各种问题
- 深度知识探索:MindSearch 通过数百个网页的浏览,提供更广泛、深层次的答案
- 透明的解决方案路径:MindSearch 提供了思考路径、搜索关键词等完整的内容,提高回复的可信度和可用性。
- 多种用户界面:为用户提供各种接口,包括 React、Gradio、Streamlit 和本地调试。根据需要选择任意类型。
- 动态图构建过程:MindSearch 将用户查询分解为图中的子问题节点,并根据 WebSearcher 的搜索结果逐步扩展图。