Tutorial: Implementing DeepSeek Online Search with Open Source Higress

Cheng Tan

|

Mar 10, 2025

|

Share on X

Previously, we published an article on Higress supporting DeepSeek web search here, but it lacked a step-by-step guide. This article supplements that, aiming to assist those interested in using this feature.

We will not repeat the installation process for Higress; instead, let's start with an already installed instance of Higress.

Step 0: Configure the DeepSeek API Key

If you did not input the DeepSeek API Key during the installation of Higress, you can configure it here:

Step 1: Configure Search Engine API Domains

First, in the Higress console, configure the domain names of the various search engines by creating service origins:

● Google Search API domain: customsearch.googleapis.com

● Bing Search API domain: api.bing.microsoft.com

● Quark Search API domain: cloud-iqs.aliyuncs.com

● Arxiv API domain: export.arxiv.org

After configuring, you also need to apply for the corresponding API Keys. For Quark Search's API Key application (Google and Bing are not detailed as there is plenty of online information, and Arxiv is free without needing an API Key):

First, you need an Alibaba Cloud account. Then, search for IQS in the Alibaba Cloud console, enter the IQS console, and generate an API Key:

For more details, refer to the IQS documentation: https://help.aliyun.com/document_detail/2870227.html

Step 2: Configure the AI Search Plugin

For Higress versions before 2.1.0, you need to import the AI Search plugin via custom plugins:

Note the OCI image address for the plugin: higress-registry.cn-hangzhou.cr.aliyuncs.com/plugins/ai-search:latest

To ensure you use the latest version of the AI Search plugin, if you prefer a stable version, change the tag to 1.0.0.

Choose the default execution stage, and set the execution priority to any value greater than 100 (this ensures the AI Search plugin executes just before forwarding to the LLM provider, modifying the prompt).

After adding the plugin, configure it accordingly:

Configuration example:

needReference: true # Set to true to include web page reference information in results
promptTemplate: | # You can skip configuring the template if using the built-in one
  # The following content is based on search results from the user-submitted query:
  {search_results}
  In the search results I provide, each result is formatted as [webpage X begin]...[webpage X end], where X represents the index number of each article. Please cite the context at the end of the sentences where appropriate. Use a format of citation number] in the answer for corresponding parts. If a sentence is derived from multiple contexts, list all relevant citation numbers, such as [3][5], and ensure not to cluster the citations at the end; instead, list them in the corresponding parts of the answer.
  When responding, please pay attention to the following:
  - Today’s date in Beijing time is: {cur_date}.
  - Not all content from the search results is closely related to the user's question. Discern and filter the search results based on the question.
  - For listing-type questions (e.g., listing all flight information), try to keep the answer within 10 points and inform the user they can check the search source for complete information. Prioritize providing the most comprehensive and relevant information; do not volunteer information missing from the search results unless necessary.
  - For creative questions (e.g., writing a paper), cite relevant references within the body paragraphs, such as [3][5]

Step 3: Test Direct Requests

Below is the effect of integrating lobechat with Higress:



Contact

Follow and engage with us through the following channels to stay updated on the latest developments from higress.ai.

Contact

Follow and engage with us through the following channels to stay updated on the latest developments from higress.ai.

Contact

Follow and engage with us through the following channels to stay updated on the latest developments from higress.ai.

Contact

Follow and engage with us through the following channels to stay updated on the latest developments from higress.ai.