> ## Documentation Index
> Fetch the complete documentation index at: https://docs.siliconflow.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Using in MindSearch

## 1. Obtain API Key

1. Open the SiliconFlow [official website](https://cloud.siliconflow.com/) and register an account (if you already have one, simply log in).
2. After completing the registration, go to [API Key](https://cloud.siliconflow.com/account/ak), create a new API Key, and copy the key for later use.

## 2. Deploy MindSearch

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

2. Modify the following file:
   `/path/to/MindSearch/mindsearch/models.py`

3. Add the configuration for calling the SiliconFlow 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.com/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.

4. Start the backend:

```
# Specify the SiliconFlow API Key
export SILICON_API_KEY=The key copied in the previous steps
# Start
python -m mindsearch.app --lang en --model_format internlm_silicon --search_engine DuckDuckGoSearch
```

5. Start the frontend. Here, the Gradio frontend is used as an example. For other frontend setups, refer to the MindSearch README:
   `python frontend/mindsearch_gradio.py`

## 3. Upload to HuggingFace Space

We can also choose to deploy it to HuggingFace Space.

1. Go to [https://huggingface.co/new-space](https://huggingface.co/new-space) and create a new Space. Configure it as follows:

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

2. After successfully creating the Space, go to "Settings" and set the API Key.

3. Upload the MindSearch directory from step 2, `requirements.txt`, and an `app.py` file.

For the detailed content of `app.py`, refer to: [https://huggingface.co/spaces/SmartFlowAI/MindSearch\_X\_SiliconFlow/blob/main/app.py](https://huggingface.co/spaces/SmartFlowAI/MindSearch_X_SiliconFlow/blob/main/app.py)
