All Products
Search
Document Center

:Search on the Internet

Last Updated:Jun 05, 2025

The search on the Internet policy expands the knowledge bases of large language models (LLMs) by allowing the LLMs to search real-time data on the Internet. This helps improve the accuracy and timeliness of answers. Currently, Quark is supported as the search engine. This topic describes the benefits of the search on the Internet policy or plug-in and how to enable it.

Usage notes

  • Supported search engines: Quark (Alibaba Cloud IQS), which is used to expand the knowledge base of the LLM.

    1. Search and rewrite: This policy optimizes and reconstructs the results generated by the LLM based on the search results of the search engine. Then, it helps produce high-quality and highly relevant context.

    2. Identify intent: This policy quickly analyzes inputs to LLMs to determine whether to search for more information on the Internet.

  • Flexible configurations: You can configure many parameters for this policy to enhance content accuracy and timeliness, such as the number of returned results, timeout period, query time range, and related industry.

  • Result rendering: This policy also allows you to configure the output language (Chinese or English), display of reference sources, and the reference format to meet different requirements.

An AI API is created.

Procedure

  1. Log on to the Cloud-native API Gateway console.

  2. In the left-side navigation pane, click API. In the top navigation bar, select a region.

  3. Click the AI API tab. In the API list, click the API that you want to manage.

  4. Click the Policies and Plug-ins tab. Turn on Search on the Internet. Select Quark (Alibaba Cloud IQS) from the Search Engine drop-down list.

  5. The first time you use Quark, Not Activated is displayed for Service Status. Click Activate Now to activate Alibaba Cloud IQS.

    After you activate Alibaba Cloud IQS, click Activation Verification. In Trial is displayed for Service Status in the Cloud-native API Gateway console.

    Note

    Alibaba Cloud IQS provides a 15-day free trial. During the free trial, you can perform a maximum of 1,000 searches per day and the queries per second (QPS) limit is 5.

  6. After you configure the parameters, click Save to enable the search on the Internet policy.

    Parameter

    Description

    Search on the Internet

    Turn on the switch to enable or disable search on the Internet. By default, this switch is turned off.

    Search Configurations

    API Key

    The access credential. You can obtain the credential from the Credential Management console.

    Number of Returned Results

    The number of results to return. Valid values: 1 to 10.

    Timeout Period

    The search timeout period. Default value: 3000 ms.

    Query Time Range

    • Within one day

    • Within one week

    • Within one month

    • Within one year

    • Unlimited

    Industry (Optional)

    • Finance

    • Law

    • Healthcare

    • Internet

    • Taxation

    • News - Provincial

    • News - Central

    Result Rendering

    Note

    Result rendering is used to configure the display format and richness of search results.

    Default Language

    The language in which the search results are displayed. Valid values: Chinese and English.

    Output Reference Source

    Specifies whether to display the reference source. Valid values: Yes and No. Default value: No, which specifies that the reference source is not displayed.

    Reference Source Location

    Valid values: Head and Tail. Default value: Head.

    Content Type

    • Summary (default): Only the summary information of the search entry is returned to meet the basic inference requirements of LLMs and the information retrieval requirements of common Q&A tasks.

    • Body: The body of the search entry is returned. The body is large in size and provides detailed data. This content type is suitable for scenarios where detailed information is required.

    Reference Format

    The format in which reference sources are displayed. Specify the format below %s. You can click Example on the right to view a sample reference format.

    Auto Enable

    Enable or Not

    Specifies whether to automatically enable search on the Internet.

    • Enable: performs searches on the Internet during LLM calls. If intent recognition is enabled, the search is performed based on the result of intent recognition.

    • Disable: does not perform searches on the Internet during LLM calls. You can manually configure the call parameters to specify whether to perform searches on the Internet. For more information, see Manually configure the call parameters.

    Intent Recognition

    Enable or Not

    Specifies whether to enable intent recognition. This feature:

    • Determines whether a search on the Internet is required.

    • Rewrites and expands online search queries to enhance search capabilities.

    Important

    Intent recognition consumes tokens and is not counted in LLM call monitoring.

    AI Services

    The LLM service for use in intent recognition.

    Model Name

    The LLM name.

    Timeout Period

    The timeout period for intent recognition. Default value: 5000 ms.

    Search for Maximum Number of Regenerated Queries

    The maximum number of search query regeneration. Default value: 1. If you set a value larger than 1, the specified number of search query statements are generated for concurrent searching. The search results from the concurrent searches are combined.

Manually configure the call parameters

If an LLM call includes the web_search_options parameter, searches on the Internet are enabled.

Example:

("web_search_options": {})

If intent recognition is enabled, the web_search_options parameter allows you to configure the number of search queries by using the search_context_size field.

Valid values of the search_context_size field:

  • low: generates one search query. This value is suitable for simple questions.

  • medium: generates 3 search queries. This is the default value.

  • high: generates 5 search queries. This value is suitable for complex questions.

Example:

{
  "web_search_options": {
    "search_context_size": "medium"
  }
}

Sample cURL request:

curl --location 'http://your-domain/v1/chat/completions' \
   --header 'Content-Type: application/json' \
  --data '{
    "model": "qwen-max",
    "stream": true,
    "web_search_options": {
        "search_context_size": "medium"
    },
    "messages": [
        {
            "role": "user",
            "content": "Introduce Tongyi Qianwen"
        }
    ]
}'