1. Obtain API Key

  1. Open the SiliconCloud website and register an account (if you have registered, log in directly).
  2. After completing the registration, go to the API Key page, create a new API Key, and copy the key for future use.

2. Deploy MindSearch

  1. Clone MindSearch to your local machine and install the required dependencies (refer to https://github.com/InternLM/MindSearch/blob/main/README.md).

  2. Modify: /path/to/MindSearch/mindsearch/models.py

  3. Add the configuration for calling the SiliconCloud API. The configuration is as follows:

internlm_silicon = dict(type=GPTAPI,
                        model_type='internlm/internlm2_5-7b-chat',
                        key=os.environ.get('SILICON_API_KEY', 'YOUR SILICON API KEY'),
                        openai_api_base='https://api.siliconflow.cn/v1/chat/completions',
                        meta_template=[
                            dict(role='system', api_role='system'),
                            dict(role='user', api_role='user'),
                            dict(role='assistant', api_role='assistant'),
                            dict(role='environment', api_role='system')
                        ],
                        top_p=0.8,
                        top_k=1,
                        temperature=0,
                        max_new_tokens=8192,
                        repetition_penalty=1.02,
                        stop_words=['<|im_end|>'])

After adding this configuration, you can execute the relevant commands to start MindSearch.

  1. Start the backend:
# 指定硅基流动的 API Key
export SILICON_API_KEY=上面流程中复制的密钥
# 启动
python -m mindsearch.app --lang en --model_format internlm_silicon --search_engine DuckDuckGoSearch
  1. Start the frontend. Here, we use Gradio as an example. For other frontends, refer to MindSearch’s README:

python frontend/mindsearch_gradio.py

3. Upload to HuggingFace Space

We can also choose to deploy it to a HuggingFace Space.

  1. Create a new Space on https://huggingface.co/new-space, configure it as:

Gradio Template: Blank Hardware: CPU basic · 2 vCPU · 16GB · FREE

  1. After creating the Space, go to “Settings” and set the API Key.

  2. Upload the MindSearch directory, requirements.txt, and an app.py file.

The detailed content of app.py can be found at: https://huggingface.co/spaces/SmartFlowAI/MindSearch_X_SiliconFlow/blob/main/app.py