Multi-turn conversation search API

Updated at:

API authentication

Obtain the authentication TOKEN by calling the `PostMSConvSearchTokenGenerated` operation in the POP SDK. Prepend `Bearer ` to the token value and include it in the `Authorization` header.

Java SDK

Maven dependencies for the Java SDK

<dependency>
    <groupId>com.aliyun</groupId>
    <artifactId>alinlp20200629</artifactId>
    <version>2.2.1</version>
</dependency>

<dependency>
	<groupId>com.aliyun</groupId>
    <artifactId>aliyun-java-sdk-core</artifactId>
    <version>4.6.0</version>
</dependency>

Java SDK call example

    public static void main(String[] args) throws Exception {
        // An Alibaba Cloud account AccessKey has full access permissions to all APIs. This poses a high security threat. 
        // Create and use a Resource Access Management (RAM) user for API access or daily O&M. To create a RAM user, log on to the RAM console.
        // This example shows how to define the AccessKey ID and AccessKey secret directly in the code. As needed, you can save them to a configuration file.
        // To prevent key leakage, do not hardcode the AccessKey ID and AccessKey secret in your code.
        String accessKeyId = "xxx";
        String accessKeySecret = "xxx";
        Client client = createClient(accessKeyId, accessKeySecret);
        PostMSConvSearchTokenGeneratedResponse response = client.postMSConvSearchTokenGenerated();
        System.out.println(JacksonUtils.toJson(response.getBody()));

    }

    public static Client createClient(String accessKeyId, String accessKeySecret) throws Exception {
        Config config = new Config()
                // Required. Your AccessKey ID.
                .setAccessKeyId(accessKeyId)
                // Required. Your AccessKey secret.
                .setAccessKeySecret(accessKeySecret);
        // For the endpoint, see https://api.aliyun.com/product/alinlp.
        config.endpoint = "alinlp.cn-beijing.aliyuncs.com";
        return new Client(config);
    }

Sample response

{
  "code" : 200,
  "data" : "zglgqoHdDn1QWxuPjkRyob7pmqTmTOVQkKZST/cUOk213ccJ6vw62ifkzbKWLZo4Lp6xkuXK6Xm2Qt5YVAhPTiSSM+VmiHQT7WjSSpcQJWE=",
  "httpStatusCode" : 200,
  "requestId" : "50212163-F250-591D-A124-3D6D69777706",
  "success" : true
}

If the token expires, check the `code` or `msg` returned by the API to determine whether to obtain a new token. To obtain a new token, call the `PostMSConvSearchTokenGenerated` operation again.

{
 "httpStatusCode": 200,
 "code": 5001,
 "data": null,
 "success": false,
 "msg": "InvalidBearerToken.Inactive",
 "requestId": "3667A90B-3BE2-45A4-B51A-7F427967E80B"
}

Python

pip install aliyun-python-sdk-alinlp==1.0.24
pip install aliyun-python-sdk-core
from aliyunsdkalinlp.request.v20200629 import PostMSConvSearchTokenGeneratedRequest
from aliyunsdkcore.client import AcsClient
from aliyunsdkcore.auth.credentials import AccessKeyCredential
import os

os.environ['ALIBABA_CLOUD_ACCESS_KEY_ID'] = 'xxx'
os.environ['ALIBABA_CLOUD_ACCESS_KEY_SECRET'] = 'xxx'


def get_token():
    credentials = AccessKeyCredential(os.environ['ALIBABA_CLOUD_ACCESS_KEY_ID'],
                                      os.environ['ALIBABA_CLOUD_ACCESS_KEY_SECRET'])
    client = AcsClient(region_id='cn-beijing', credential=credentials)
    request = PostMSConvSearchTokenGeneratedRequest.PostMSConvSearchTokenGeneratedRequest()
    request.set_accept_format('json')
    response = client.do_action_with_exception(request)
    # For Python 2:  print(response)
    print(str(response, encoding='utf-8'))


if __name__ == '__main__':
    get_token()

Endpoint

https://fastai-x-gateway.aliyuncs.com

Common parameters

Request parameters

Field

Type

Description

Default value

headers

map/dict/json

Request header information.

{}

Authorization

string

Authentication information.

Bearer toY1FWrNAjvWkOmp24+UQFIi2PsYzbhNBq+yJmzumNmXw3sro3oOt9Kde5kzLcc4

Multi-turn conversation

Request method

POST

API

/msearch/api/chat

Authentication

Add the token to the header:

-H 'Authorization: Bearer your-token'

Request parameters

Level-1 parameter

Description

Type

Required

input

Information for the Large Language Model (LLM).

{}

Yes

parameters

LLM parameters.

{}

Yes

debug

Debug mode.

boolean

Yes. The default value is false.

Level-1 parameter

Level-2 parameter

Description

Type

Required

Default value

input

session_id

The context ID of the conversation. If this is empty, a new conversation is created.

string

Required for continuous conversations.

""

prompts

The question to ask.

string

Yes

plugin_schemas

Plugin parameters.

{}

No

max_tokens

The maximum number of tokens to output.

int

No

512

stream

Specifies whether to enable streaming conversation.

boolean

No

true

tenant_id

Identifies the search service.

string

Yes

The value is fixed to "msearch".

app_id

Service ID.

long

Yes

system_prompt

Preset instruction.

string

No

""

parameters

top_p

The nucleus sampling value of the model.

float

No

0.7

top_k

The sampling range size of the model.

int

No

50

temperature

Sampling temperature.

int

No

1

allow_direct_answer

Specifies whether to enable the LLM.

boolean

No

true

num_doc

The number of documents to include in the summary.

int

No

3

content_fields

Used to concatenate reference information. Use a comma (,) to separate multiple fields.

string

No

""

reject_templete

Rejection template.

string

No

""

max_cotent_length

The maximum length of a single knowledge entry. Value range: 50 to 2,000. The following condition must be met: num_docs × max_content_length <= 6000.

int

No

1000

Level-2 parameter

Level-3 parameter

Level-4 parameter

Description

Type

Required

Default value

plugin_schemas

search_enhance

vector_recall_ratio

The vector retrieval ratio. Value range: 0.1 to 0.9.

float

No

0.7

acc_sorting

The number of documents for fine-grained sorting. Value range: 50 to 500.

int

No

200

custom_sorting

Custom sorting parameters.

{}

No

""

search_size

The number of results to retrieve for a single query.

int

No

3

custom_config_info

Custom search configuration.

{}

No

filters

Filter parameter settings.

[]

No

fields

The fields to retrieve (forward index). Use a comma (,) to separate multiple fields.

string

No

""

Request example

POST: /msearch/api/chat

Add the token to the header
-H 'Authorization: Bearer xxx'

request body:

{
    "input":{
        "session_id":"",
        "prompts":"What is a Large Language Model?", 
        "plugin_schemas":{
            "search_plugin":{
                "search_enhance":{	
                    "vector_recall_ratio":0.5, 
                    "acc_sorting": 200,        
                    "custom_sorting":"",
                    "filters": ""
                }
            }
        },
        "max_tokens":512,
        "stream":true,
        "green_net":false,
        "tenant_id":"msearch",
        "app_id":"",
        "round_id":""
    },
    "parameters":{
      	"temperature": 1,
        "top_p": 0.8,      
        "allow_direct_answer": true, 
        "num_doc":3
    },
    "debug":false
}

Response parameters

Non-streaming conversation: Returns a standard HTTP response where the data field contains the chat return data.

Level-1 parameter

Level-2 parameter

Description

data

content

The answer content from the chat.

attachment

References, search recommendations, and other information for the current search conversation.

session_id

The context information of the current conversation.

item_id

A system-generated ID used to control the context for retries.

Level-2 parameter

Level-3 parameter

Description

attachment

refer

The reference information for the current answer.

search_recommend

Search recommendations for the next turn of the conversation.

content_fields

Used to concatenate reference information.

fields

The primary key used to identify reference information. The first key is used by default.

debug

In debug mode, a `debug` field is added. For more information about the content, see the "Streaming conversation" section.

response:
{
  "code" : 200,
  "data" : {
    "attachment" : {
      "content_fields" : [
        "name",
        "title",
        "content",
        "docId"
      ],
      "fields" : [
        "name",
        "title",
        "content",
        "docId"
      ],
      "refer" : [
        {
          "content" : "4. Strengthen patrols of internet cafes, game arcades, hotels, guesthouses, and other venues. Strictly enforce prohibitions and restrictions on minors to prevent them from being exposed to harmful influences or exploitation. 5. Enhance patrols of rivers, lakes, and open channels in densely populated areas. Install protective facilities and post warning signs to prevent minors from drowning while swimming in unauthorized areas. 6. Place high importance on preventing risks from natural disasters during the flood season. Conduct detailed inspections of buildings, walls, and hillsides near all institutions and venues involving minors. For any risks and hazards identified during inspections, immediate rectification is required. This includes clarifying the responsible units, owners, corrective measures, and deadlines, and inspecting and accepting the results of the rectification.",
          "docId" : "12860455011047291267",
          "name" : "Public-Safety-Notice-[2021]-No-2.docx",
          "score" : 0.75426797591876671,
          "title" : ""
        },
        {
          "content" : "4. Strengthen patrols of internet cafes, game arcades, hotels, guesthouses, and other venues. Strictly enforce prohibitions and restrictions on minors to prevent them from being exposed to harmful influences or exploitation. 5. Enhance patrols of rivers, lakes, and open channels in densely populated areas. Install protective facilities and post warning signs to prevent minors from drowning while swimming in unauthorized areas. 6. Place high importance on preventing risks from natural disasters during the flood season. Conduct detailed inspections of buildings, walls, and hillsides near all institutions and venues involving minors. For any risks and hazards identified during inspections, immediate rectification is required. This includes clarifying the responsible units, owners, corrective measures, and deadlines, and inspecting and accepting the results of the rectification.",
          "docId" : "12860455011047291267",
          "name" : "Public-Safety-Notice-[2021]-No-2.docx",
          "score" : 0.75313563883732726,
          "title" : ""
        },
        {
          "content" : "4. Strengthen patrols of internet cafes, game arcades, hotels, guesthouses, and other venues. Strictly enforce prohibitions and restrictions on minors to prevent them from being exposed to harmful influences or exploitation. 5. Enhance patrols of rivers, lakes, and open channels in densely populated areas. Install protective facilities and post warning signs to prevent minors from drowning while swimming in unauthorized areas. 6. Place high importance on preventing risks from natural disasters during the flood season. Conduct detailed inspections of buildings, walls, and hillsides near all institutions and venues involving minors. For any risks and hazards identified during inspections, immediate rectification is required. This includes clarifying the responsible units, owners, corrective measures, and deadlines, and inspecting and accepting the results of the rectification.",
          "docId" : "12860455011047291267",
          "name" : "Public-Safety-Notice-[2021]-No-2.docx",
          "score" : 0.75461437213648086,
          "title" : ""
        }
      ],
      "search_recommend" : [
        "What is drowning?",
        "How can drowning be prevented?",
        "What is the first aid for drowning?"
      ]
    },
    "content" : "To prevent minors from drowning, relevant departments must increase patrols of rivers, lakes, and open channels in densely populated areas, install protective facilities, and post warning signs[1][2].",
    "item_id" : "f-r-WaQoAbZ7TJBGbsmiBeniFx",
    "session_id" : "f-s-YaqbiT9jt4pFbJKXdXhkqJ"
  },
  "httpStatusCode" : 200,
  "msg" : null,
  "requestId" : "ABF05DE7-A518-4F00-BCAE-5F74601CE55A",
  "success" : true
}

Streaming conversation

Different `event` fields indicate different status information.
open: Starts the conversation.
message: The model output.
error: An error occurred.
control: Other information.
close: The message output is complete and the conversation is closed.

********** Sample open event **********
id:system
event:open
data:"success"
retry:3000


********** Sample control event **********
id:F00D6F02-7F4D-4DE9-88AA-AEDAD507ED86
event:control
data:{
  "attachment" : {
    "ext" : null,
    "name" : "search_toggle",
    "payload" : {
      "do_search" : true
    }
  },
  "content" : "search_toggle",
  "item_id" : "f-r-3doN39VTezGiKCSDjx6btg",
  "session_id" : "f-s-2HCKzvPZJ9uVfMrZRBoogq"
}
retry:3000
// {"do_search": true} indicates that the model has decided to perform a search.


id:F00D6F02-7F4D-4DE9-88AA-AEDAD507ED86
event:control
data:{
  "attachment" : {
    "ext" : null,
    "name" : "search_rewrite",
    "payload" : {
      "queries_r" : [
        "Definition and causes of drowning",
        "First aid methods for drowning",
        "Preventive measures for drowning"
      ]
    }
  },
  "content" : "search_rewrite",
  "item_id" : "f-r-3doN39VTezGiKCSDjx6btg",
  "session_id" : "f-s-2HCKzvPZJ9uVfMrZRBoogq"
}
retry:3000
//  {"queries_r": ["Definition and causes of drowning","First aid methods for drowning","Preventive measures for drowning"]} indicates that the model has rewritten the query.


id:F00D6F02-7F4D-4DE9-88AA-AEDAD507ED86
event:control
data:{
  "attachment" : {
    "ext" : null,
    "name" : "search",
    "payload" : {
      "refer" : [
        {
          "content" : "4. Strengthen patrols of internet cafes, game arcades, hotels, guesthouses, and other venues. Strictly enforce prohibitions and restrictions on minors to prevent them from being exposed to harmful influences or exploitation. 5. Enhance patrols of rivers, lakes, and open channels in densely populated areas. Install protective facilities and post warning signs to prevent minors from drowning while swimming in unauthorized areas. 6. Place high importance on preventing risks from natural disasters during the flood season. Conduct detailed inspections of buildings, walls, and hillsides near all institutions and venues involving minors. For any risks and hazards identified during inspections, immediate rectification is required. This includes clarifying the responsible units, owners, corrective measures, and deadlines, and inspecting and accepting the results of the rectification.",
          "docId" : "12860455011047291267",
          "name" : "Public-Safety-Notice-[2021]-No-2.docx",
          "score" : 0.25426797591876671,
          "title" : ""
        }
      ],
      "uq" : "Definition and causes of drowning"
    }
  },
  "content" : "search",
  "item_id" : "f-r-3doN39VTezGiKCSDjx6btg",
  "session_id" : "f-s-2HCKzvPZJ9uVfMrZRBoogq"
}
retry:3000
// The results for the "uq" query are found in "refer".


********** Sample message event **********
id:F00D6F02-7F4D-4DE9-88AA-AEDAD507ED86
event:message
data:{"attachment":null,"item_id":"f-r-3doN39VTezGiKCSDjx6btg","session_id":"f-s-2HCKzvPZJ9uVfMrZRBoogq","content":"To prevent min"}
retry:3000

id:F00D6F02-7F4D-4DE9-88AA-AEDAD507ED86
event:message
data:{"attachment":null,"item_id":"f-r-3doN39VTezGiKCSDjx6btg","session_id":"f-s-2HCKzvPZJ9uVfMrZRBoogq","content":"ors"}
retry:3000

id:F00D6F02-7F4D-4DE9-88AA-AEDAD507ED86
event:message
data:{"attachment":null,"item_id":"f-r-3doN39VTezGiKCSDjx6btg","session_id":"f-s-2HCKzvPZJ9uVfMrZRBoogq","content":" from"}

id:F00D6F02-7F4D-4DE9-88AA-AEDAD507ED86
event:message
data:{"attachment":null,"item_id":"f-r-3doN39VTezGiKCSDjx6btg","session_id":"f-s-2HCKzvPZJ9uVfMrZRBoogq","content":" drown"}
retry:3000

id:F00D6F02-7F4D-4DE9-88AA-AEDAD507ED86
event:message
data:{"attachment":null,"item_id":"f-r-3doN39VTezGiKCSDjx6btg","session_id":"f-s-2HCKzvPZJ9uVfMrZRBoogq","content":"ing"}
retry:3000


********** Sample close event **********
id:system
event:close
data:"success"
retry:3000

********** Sample error event **********
event: error
data: {"content": "daily-top_qad-392 response error, status=500, content=Internal Server Error", "attachment": {"refer": {}}, "session_id": "f-s-FAq52yVq8exWwRrFFoh7XD", "item_id": "f-msg-VKoUNQcuaBeKTxxip5B8q5"}


********** Debug mode **********
In the last event:message of the streaming output, the attachment field contains the debug field:
{
  "attachment" : {
    "content_fields" : [
      "name",
      "title",
      "content",
      "docId"
    ],
    "debug" : {
      "child_execs" : [
        {
          "child_execs" : null,
          "end_time" : 1693890270582,
          "exec_kind" : "AI_FLOW_STEP",
          "exec_message" : null,
          "exec_name" : "search_toggle",
          "exec_params" : {
            "api_key" : "ztPO******4A26",
            "history_messages" : [

            ],
            "max_new_tokens" : 512,
            "model_id" : "daily-top_qad-392",
            "query" : "Drowning",
            "stream" : false,
            "top_p" : 0.69999999999999996,
            "tp_search" : ""
          },
          "exec_result" : {
            "do_search" : true
          },
          "exec_status" : true,
          "start_time" : 1693890270207,
          "trace_id" : "F00D6F02-7F4D-4DE9-88AA-AEDAD507ED86"
        },
        {
          "child_execs" : null,
          "end_time" : 1693890271550,
          "exec_kind" : "AI_FLOW_STEP",
          "exec_message" : null,
          "exec_name" : "search_rewrite",
          "exec_params" : {
            "api_key" : "ztPO******4A26",
            "history_messages" : [

            ],
            "max_new_tokens" : 512,
            "model_id" : "daily-top_qad-392",
            "query" : "Drowning",
            "stream" : false,
            "top_p" : 0.69999999999999996,
            "tp_query_rewrite" : ""
          },
          "exec_result" : {
            "queries_r" : [
              "Definition and causes of drowning",
              "First aid methods for drowning",
              "Preventive measures for drowning"
            ]
          },
          "exec_status" : true,
          "start_time" : 1693890270584,
          "trace_id" : "F00D6F02-7F4D-4DE9-88AA-AEDAD507ED86"
        },
        {
          "child_execs" : null,
          "end_time" : 1693890271909,
          "exec_kind" : "AI_FLOW_STEP",
          "exec_message" : null,
          "exec_name" : "search",
          "exec_params" : {
            "customConfigInfo" : {
              "rerankSize" : 200,
              "uqVectorRecallRatio" : 0.5
            },
            "fields" : [
              "name",
              "title",
              "content",
              "docId"
            ],
            "page" : 1,
            "rankModelInfo" : {
              "default" : {
                "aggregate_algo" : "weight_avg",
                "features" : [
                  {
                    "name" : "vector_index",
                    "norm" : true,
                    "norm_factor" : 40,
                    "threshold" : 0,
                    "weights" : 0.5
                  },
                  {
                    "field" : "_rc_t_score",
                    "name" : "static_value",
                    "norm" : true,
                    "norm_factor" : 80,
                    "threshold" : 0,
                    "weights" : 0.5
                  }
                ]
              }
            },
            "rid" : "F00D6F02-7F4D-4DE9-88AA-AEDAD507ED86",
            "rows" : 1,
            "scene" : "dolphin_search_ms_index_es_151_prod",
            "type" : "content,title,name,docId,vector",
            "uq" : "Definition and causes of drowning"
          },
          "exec_result" : {
            "code" : 200,
            "data" : {
              "data" : {
                "aggs" : null,
                "docs" : [
                  {
                    "_id" : "12860455011047291267_5",
                    "_q_score" : 1,
                    "_rc_score" : 1,
                    "_rc_t_score" : 2.73177,
                    "_rc_v_score" : 7.1110014999999996e-05,
                    "_score" : 0.75426797591876671,
                    "_scores" : {
                      "static_value(_rc_t_score)" : 0.25426797591876671,
                      "vector_index" : 0.5
                    },
                    "content" : "4. Strengthen patrols of internet cafes, game arcades, hotels, guesthouses, and other venues. Strictly enforce prohibitions and restrictions on minors to prevent them from being exposed to harmful influences or exploitation. 5. Enhance patrols of rivers, lakes, and open channels in densely populated areas. Install protective facilities and post warning signs to prevent minors from drowning while swimming in unauthorized areas. 6. Place high importance on preventing risks from natural disasters during the flood season. Conduct detailed inspections of buildings, walls, and hillsides near all institutions and venues involving minors. For any risks and hazards identified during inspections, immediate rectification is required. This includes clarifying the responsible units, owners, corrective measures, and deadlines, and inspecting and accepting the results of the rectification.",
                    "docId" : "12860455011047291267",
                    "name" : "Public-Safety-Notice-[2021]-No-2.docx",
                    "title" : ""
                  }
                ],
                "extras" : null,
                "keywords" : [
                  {
                    "fuzzy" : true,
                    "name" : "Full text",
                    "schema" : "content,title,name,docId",
                    "value" : "Drowning definition and causes"
                  }
                ],
                "qpInfos" : [
                  {
                    "cleanQuery" : "Definition and causes of drowning",
                    "operator" : "AND",
                    "query" : "Definition and causes of drowning",
                    "recognitions" : [
                      {
                        "name" : "O",
                        "text" : "drowning"
                      },
                      {
                        "name" : "O",
                        "text" : "of"
                      },
                      {
                        "name" : "O",
                        "text" : "definition"
                      },
                      {
                        "name" : "O",
                        "text" : "and"
                      },
                      {
                        "name" : "O",
                        "text" : "causes"
                      }
                    ],
                    "rewrite" : "Drowning definition and causes",
                    "sensitive" : false,
                    "spellcheck" : false,
                    "spellchecked" : "Definition and causes of drowning",
                    "stopWords" : [
                      "of"
                    ],
                    "synonymWords" : [
                      {
                        "synonyms" : [
                          "and"
                        ],
                        "word" : "and"
                      }
                    ],
                    "tokenized" : [
                      "drowning",
                      "of",
                      "definition",
                      "and",
                      "causes"
                    ]
                  }
                ],
                "total" : 11,
                "totalDistinct" : 11
              },
              "debug" : null,
              "headers" : {
                "__d_head_engine_rt" : "q:81-s:[t109,v116]-r:6-i:65",
                "__d_head_es_rt" : "t:8",
                "__d_head_rtm" : "1693890271874",
                "__d_head_sip" : "192.168.43.130",
                "__d_head_ver" : "0.0.1-SNAPSHOT"
              },
              "message" : null,
              "rid" : "F00D6F02-7F4D-4DE9-88AA-AEDAD507ED86",
              "status" : 0,
              "success" : true
            },
            "httpStatusCode" : 200,
            "msg" : null,
            "requestId" : "F00D6F02-7F4D-4DE9-88AA-AEDAD507ED86",
            "success" : true
          },
          "exec_status" : true,
          "start_time" : 1693890271552,
          "trace_id" : "F00D6F02-7F4D-4DE9-88AA-AEDAD507ED86"
        },
        {
          "child_execs" : null,
          "end_time" : 1693890271930,
          "exec_kind" : "AI_FLOW_STEP",
          "exec_message" : null,
          "exec_name" : "search",
          "exec_params" : {
            "customConfigInfo" : {
              "rerankSize" : 200,
              "uqVectorRecallRatio" : 0.5
            },
            "fields" : [
              "name",
              "title",
              "content",
              "docId"
            ],
            "page" : 1,
            "rankModelInfo" : {
              "default" : {
                "aggregate_algo" : "weight_avg",
                "features" : [
                  {
                    "name" : "vector_index",
                    "norm" : true,
                    "norm_factor" : 40,
                    "threshold" : 0,
                    "weights" : 0.5
                  },
                  {
                    "field" : "_rc_t_score",
                    "name" : "static_value",
                    "norm" : true,
                    "norm_factor" : 80,
                    "threshold" : 0,
                    "weights" : 0.5
                  }
                ]
              }
            },
            "rid" : "F00D6F02-7F4D-4DE9-88AA-AEDAD507ED86",
            "rows" : 1,
            "scene" : "dolphin_search_ms_index_es_151_prod",
            "type" : "content,title,name,docId,vector",
            "uq" : "First aid methods for drowning"
          },
          "exec_result" : {
            "code" : 200,
            "data" : {
              "data" : {
                "aggs" : null,
                "docs" : [
                  {
                    "_id" : "12860455011047291267_5",
                    "_q_score" : 1,
                    "_rc_score" : 1,
                    "_rc_t_score" : 2.0069140999999999,
                    "_rc_v_score" : 6.5218959999999997e-05,
                    "_score" : 0.75313563883732726,
                    "_scores" : {
                      "static_value(_rc_t_score)" : 0.25313563883732726,
                      "vector_index" : 0.5
                    },
                    "content" : "4. Strengthen patrols of internet cafes, game arcades, hotels, guesthouses, and other venues. Strictly enforce prohibitions and restrictions on minors to prevent them from being exposed to harmful influences or exploitation. 5. Enhance patrols of rivers, lakes, and open channels in densely populated areas. Install protective facilities and post warning signs to prevent minors from drowning while swimming in unauthorized areas. 6. Place high importance on preventing risks from natural disasters during the flood season. Conduct detailed inspections of buildings, walls, and hillsides near all institutions and venues involving minors. For any risks and hazards identified during inspections, immediate rectification is required. This includes clarifying the responsible units, owners, corrective measures, and deadlines, and inspecting and accepting the results of the rectification.",
                    "docId" : "12860455011047291267",
                    "name" : "Public-Safety-Notice-[2021]-No-2.docx",
                    "title" : ""
                  }
                ],
                "extras" : null,
                "keywords" : [
                  {
                    "fuzzy" : true,
                    "name" : "Full text",
                    "schema" : "content,title,name,docId",
                    "value" : "Drowning first aid methods"
                  }
                ],
                "qpInfos" : [
                  {
                    "cleanQuery" : "First aid methods for drowning",
                    "operator" : "AND",
                    "query" : "First aid methods for drowning",
                    "recognitions" : [
                      {
                        "name" : "O",
                        "text" : "drowning"
                      },
                      {
                        "name" : "O",
                        "text" : "of"
                      },
                      {
                        "name" : "O",
                        "text" : "first aid"
                      },
                      {
                        "name" : "O",
                        "text" : "methods"
                      }
                    ],
                    "rewrite" : "Drowning first aid methods",
                    "sensitive" : false,
                    "spellcheck" : false,
                    "spellchecked" : "First aid methods for drowning",
                    "stopWords" : [
                      "of"
                    ],
                    "synonymWords" : [

                    ],
                    "tokenized" : [
                      "drowning",
                      "of",
                      "first aid",
                      "methods"
                    ]
                  }
                ],
                "total" : 11,
                "totalDistinct" : 11
              },
              "debug" : null,
              "headers" : {
                "__d_head_engine_rt" : "q:84-s:[t99,v144]-r:4-i:63",
                "__d_head_es_rt" : "t:3",
                "__d_head_rtm" : "1693890271898",
                "__d_head_sip" : "192.168.43.130",
                "__d_head_ver" : "0.0.1-SNAPSHOT"
              },
              "message" : null,
              "rid" : "F00D6F02-7F4D-4DE9-88AA-AEDAD507ED86",
              "status" : 0,
              "success" : true
            },
            "httpStatusCode" : 200,
            "msg" : null,
            "requestId" : "F00D6F02-7F4D-4DE9-88AA-AEDAD507ED86",
            "success" : true
          },
          "exec_status" : true,
          "start_time" : 1693890271552,
          "trace_id" : "F00D6F02-7F4D-4DE9-88AA-AEDAD507ED86"
        },
        {
          "child_execs" : null,
          "end_time" : 1693890271974,
          "exec_kind" : "AI_FLOW_STEP",
          "exec_message" : null,
          "exec_name" : "search",
          "exec_params" : {
            "customConfigInfo" : {
              "rerankSize" : 200,
              "uqVectorRecallRatio" : 0.5
            },
            "fields" : [
              "name",
              "title",
              "content",
              "docId"
            ],
            "page" : 1,
            "rankModelInfo" : {
              "default" : {
                "aggregate_algo" : "weight_avg",
                "features" : [
                  {
                    "name" : "vector_index",
                    "norm" : true,
                    "norm_factor" : 40,
                    "threshold" : 0,
                    "weights" : 0.5
                  },
                  {
                    "field" : "_rc_t_score",
                    "name" : "static_value",
                    "norm" : true,
                    "norm_factor" : 80,
                    "threshold" : 0,
                    "weights" : 0.5
                  }
                ]
              }
            },
            "rid" : "F00D6F02-7F4D-4DE9-88AA-AEDAD507ED86",
            "rows" : 1,
            "scene" : "dolphin_search_ms_index_es_151_prod",
            "type" : "content,title,name,docId,vector",
            "uq" : "Preventive measures for drowning"
          },
          "exec_result" : {
            "code" : 200,
            "data" : {
              "data" : {
                "aggs" : null,
                "docs" : [
                  {
                    "_id" : "12860455011047291267_5",
                    "_q_score" : 1,
                    "_rc_score" : 1,
                    "_rc_t_score" : 2.9535336000000001,
                    "_rc_v_score" : 0.0001092516,
                    "_score" : 0.75461437213648086,
                    "_scores" : {
                      "static_value(_rc_t_score)" : 0.2546143721364808,
                      "vector_index" : 0.5
                    },
                    "content" : "4. Strengthen patrols of internet cafes, game arcades, hotels, guesthouses, and other venues. Strictly enforce prohibitions and restrictions on minors to prevent them from being exposed to harmful influences or exploitation. 5. Enhance patrols of rivers, lakes, and open channels in densely populated areas. Install protective facilities and post warning signs to prevent minors from drowning while swimming in unauthorized areas. 6. Place high importance on preventing risks from natural disasters during the flood season. Conduct detailed inspections of buildings, walls, and hillsides near all institutions and venues involving minors. For any risks and hazards identified during inspections, immediate rectification is required. This includes clarifying the responsible units, owners, corrective measures, and deadlines, and inspecting and accepting the results of the rectification.",
                    "docId" : "12860455011047291267",
                    "name" : "Public-Safety-Notice-[2021]-No-2.docx",
                    "title" : ""
                  }
                ],
                "extras" : null,
                "keywords" : [
                  {
                    "fuzzy" : true,
                    "name" : "Full text",
                    "schema" : "content,title,name,docId",
                    "value" : "Drowning prevention measures"
                  }
                ],
                "qpInfos" : [
                  {
                    "cleanQuery" : "Preventive measures for drowning",
                    "operator" : "AND",
                    "query" : "Preventive measures for drowning",
                    "recognitions" : [
                      {
                        "name" : "O",
                        "text" : "drowning"
                      },
                      {
                        "name" : "O",
                        "text" : "of"
                      },
                      {
                        "name" : "O",
                        "text" : "prevention"
                      },
                      {
                        "name" : "O",
                        "text" : "measures"
                      }
                    ],
                    "rewrite" : "Drowning prevention measures",
                    "sensitive" : false,
                    "spellcheck" : false,
                    "spellchecked" : "Preventive measures for drowning",
                    "stopWords" : [
                      "of"
                    ],
                    "synonymWords" : [

                    ],
                    "tokenized" : [
                      "drowning",
                      "of",
                      "prevention",
                      "measures"
                    ]
                  }
                ],
                "total" : 11,
                "totalDistinct" : 11
              },
              "debug" : null,
              "headers" : {
                "__d_head_engine_rt" : "q:99-s:[t115,v140]-r:6-i:66",
                "__d_head_es_rt" : "t:5",
                "__d_head_rtm" : "1693890271944",
                "__d_head_sip" : "192.168.44.115",
                "__d_head_ver" : "0.0.1-SNAPSHOT"
              },
              "message" : null,
              "rid" : "F00D6F02-7F4D-4DE9-88AA-AEDAD507ED86",
              "status" : 0,
              "success" : true
            },
            "httpStatusCode" : 200,
            "msg" : null,
            "requestId" : "F00D6F02-7F4D-4DE9-88AA-AEDAD507ED86",
            "success" : true
          },
          "exec_status" : true,
          "start_time" : 1693890271552,
          "trace_id" : "F00D6F02-7F4D-4DE9-88AA-AEDAD507ED86"
        },
        {
          "child_execs" : null,
          "end_time" : 1693890274811,
          "exec_kind" : "AI_FLOW_STEP",
          "exec_message" : null,
          "exec_name" : "search_recommend",
          "exec_params" : {
            "api_key" : "ztPO******4A26",
            "history_messages" : [
              {
                "content" : "Drowning",
                "role" : "user"
              },
              {
                "content" : "To prevent minors from drowning, relevant departments must increase patrols of rivers, lakes, and open channels in densely populated areas, install protective facilities, and post warning signs[1][2].",
                "role" : "assistant"
              }
            ],
            "max_new_tokens" : 512,
            "model_id" : "daily-top_qad-392",
            "query" : null,
            "stream" : false,
            "top_p" : 0.69999999999999996
          },
          "exec_result" : {
            "queries_s" : [
              "What is drowning?",
              "How can drowning be prevented?",
              "What is the first aid for drowning?"
            ]
          },
          "exec_status" : true,
          "start_time" : 1693890273899,
          "trace_id" : "F00D6F02-7F4D-4DE9-88AA-AEDAD507ED86"
        }
      ],
      "end_time" : null,
      "exec_kind" : "AI_FLOW",
      "exec_message" : null,
      "exec_name" : "corp_search.json",
      "exec_params" : {
        "async_run" : false,
        "debug" : true,
        "flow_json" : null,
        "flow_json_url" : "https://******/corp_search.json",
        "flow_params" : {
          "allow_direct_answer" : false,
          "api_key" : "ztPO******4A26",
          "content_fields" : "name,title,content,docId",
          "custom_config_info" : "{&quot;rerankSize&quot;: 200, &quot;uqVectorRecallRatio&quot;: 0.5}",
          "fields" : "name,title,content,docId",
          "human_input" : "Drowning",
          "max_new_tokens" : 512,
          "num_doc" : 3,
          "rank_model_info" : "{&quot;default&quot;: {&quot;features&quot;: [{&quot;name&quot;: &quot;vector_index&quot;, &quot;weights&quot;: 0.5, &quot;threshold&quot;: 0, &quot;norm&quot;: true, &quot;norm_factor&quot;: 40}, {&quot;name&quot;: &quot;static_value&quot;, &quot;field&quot;: &quot;_rc_t_score&quot;, &quot;weights&quot;: 0.5, &quot;threshold&quot;: 0, &quot;norm_factor&quot;: 80, &quot;norm&quot;: true}], &quot;aggregate_algo&quot;: &quot;weight_avg&quot;}}",
          "scene" : "dolphin_search_ms_index_es_151_prod",
          "search_size" : 3,
          "temperature" : 1,
          "top_p" : 0.69999999999999996,
          "type" : "content,title,name,docId,vector"
        },
        "session_id" : "f-s-T8ibtNAXkJUavu6iRuwobT",
        "streaming" : true
      },
      "exec_result" : {
        "ext" : {

        },
        "input_tokens" : null,
        "output_tokens" : null,
        "prompt" : "{&quot;query&quot;: &quot;Drowning&quot;, &quot;model_id&quot;: &quot;daily-top_qad-392&quot;, &quot;api_key&quot;: &quot;ztPO******4A26&quot;, &quot;stream&quot;: true, &quot;search_results&quot;: [{&quot;id&quot;: 1, &quot;content&quot;: &quot;Public-Safety-Notice-[2021]-No-2.docx\\n\\n4. Strengthen patrols of internet cafes, game arcades, hotels, guesthouses, and other venues. Strictly enforce prohibitions and restrictions on minors to prevent them from being exposed to harmful influences or exploitation. 5. Enhance patrols of rivers, lakes, and open channels in densely populated areas. Install protective facilities and post warning signs to prevent minors from drowning while swimming in unauthorized areas. 6. Place high importance on preventing risks from natural disasters during the flood season. Conduct detailed inspections of buildings, walls, and hillsides near all institutions and venues involving minors. For any risks and hazards identified during inspections, immediate rectification is required. This includes clarifying the responsible units, owners, corrective measures, and deadlines, and inspecting and accepting the results of the rectification.\\n12860455011047291267&quot;, &quot;raw_search_result&quot;: {&quot;_rc_score&quot;: 1.0, &quot;_rc_v_score&quot;: 7.1110015e-05, &quot;_rc_t_score&quot;: 2.73177, &quot;_scores&quot;: {&quot;vector_index&quot;: 0.5, &quot;static_value(_rc_t_score)&quot;: 0.2542679759187667}, &quot;docId&quot;: &quot;12860455011047291267&quot;, &quot;name&quot;: &quot;Public-Safety-Notice-[2021]-No-2.docx&quot;, &quot;_q_score&quot;: 1.0, &quot;_id&quot;: &quot;12860455011047291267_5&quot;, &quot;title&quot;: &quot;&quot;, &quot;_score&quot;: 0.7542679759187667, &quot;content&quot;: &quot;4. Strengthen patrols of internet cafes, game arcades, hotels, guesthouses, and other venues. Strictly enforce prohibitions and restrictions on minors to prevent them from being exposed to harmful influences or exploitation. 5. Enhance patrols of rivers, lakes, and open channels in densely populated areas. Install protective facilities and post warning signs to prevent minors from drowning while swimming in unauthorized areas. 6. Place high importance on preventing risks from natural disasters during the flood season. Conduct detailed inspections of buildings, walls, and hillsides near all institutions and venues involving minors. For any risks and hazards identified during inspections, immediate rectification is required. This includes clarifying the responsible units, owners, corrective measures, and deadlines, and inspecting and accepting the results of the rectification.&quot;}}, {&quot;id&quot;: 2, &quot;content&quot;: &quot;Public-Safety-Notice-[2021]-No-2.docx\\n\\n4. Strengthen patrols of internet cafes, game arcades, hotels, guesthouses, and other venues. Strictly enforce prohibitions and restrictions on minors to prevent them from being exposed to harmful influences or exploitation. 5. Enhance patrols of rivers, lakes, and open channels in densely populated areas. Install protective facilities and post warning signs to prevent minors from drowning while swimming in unauthorized areas. 6. Place high importance on preventing risks from natural disasters during the flood season. Conduct detailed inspections of buildings, walls, and hillsides near all institutions and venues involving minors. For any risks and hazards identified during inspections, immediate rectification is required. This includes clarifying the responsible units, owners, corrective measures, and deadlines, and inspecting and accepting the results of the rectification.\\n12860455011047291267&quot;, &quot;raw_search_result&quot;: {&quot;_rc_score&quot;: 1.0, &quot;_rc_v_score&quot;: 6.521896e-05, &quot;_rc_t_score&quot;: 2.0069141, &quot;_scores&quot;: {&quot;vector_index&quot;: 0.5, &quot;static_value(_rc_t_score)&quot;: 0.25313563883732726}, &quot;docId&quot;: &quot;12860455011047291267&quot;, &quot;name&quot;: &quot;Public-Safety-Notice-[2021]-No-2.docx&quot;, &quot;_q_score&quot;: 1.0, &quot;_id&quot;: &quot;12860455011047291267_5&quot;, &quot;title&quot;: &quot;&quot;, &quot;_score&quot;: 0.7531356388373273, &quot;content&quot;: &quot;4. Strengthen patrols of internet cafes, game arcades, hotels, guesthouses, and other venues. Strictly enforce prohibitions and restrictions on minors to prevent them from being exposed to harmful influences or exploitation. 5. Enhance patrols of rivers, lakes, and open channels in densely populated areas. Install protective facilities and post warning signs to prevent minors from drowning while swimming in unauthorized areas. 6. Place high importance on preventing risks from natural disasters during the flood season. Conduct detailed inspections of buildings, walls, and hillsides near all institutions and venues involving minors. For any risks and hazards identified during inspections, immediate rectification is required. This includes clarifying the responsible units, owners, corrective measures, and deadlines, and inspecting and accepting the results of the rectification.&quot;}}, {&quot;id&quot;: 3, &quot;content&quot;: &quot;Public-Safety-Notice-[2021]-No-2.docx\\n\\n4. Strengthen patrols of internet cafes, game arcades, hotels, guesthouses, and other venues. Strictly enforce prohibitions and restrictions on minors to prevent them from being exposed to harmful influences or exploitation. 5. Enhance patrols of rivers, lakes, and open channels in densely populated areas. Install protective facilities and post warning signs to prevent minors from drowning while swimming in unauthorized areas. 6. Place high importance on preventing risks from natural disasters during the flood season. Conduct detailed inspections of buildings, walls, and hillsides near all institutions and venues involving minors. For any risks and hazards identified during inspections, immediate rectification is required. This includes clarifying the responsible units, owners, corrective measures, and deadlines, and inspecting and accepting the results of the rectification.\\n12860455011047291267&quot;, &quot;raw_search_result&quot;: {&quot;_rc_score&quot;: 1.0, &quot;_rc_v_score&quot;: 0.0001092516, &quot;_rc_t_score&quot;: 2.9535336, &quot;_scores&quot;: {&quot;vector_index&quot;: 0.5, &quot;static_value(_rc_t_score)&quot;: 0.2546143721364808}, &quot;docId&quot;: &quot;12860455011047291267&quot;, &quot;name&quot;: &quot;Public-Safety-Notice-[2021]-No-2.docx&quot;, &quot;_q_score&quot;: 1.0, &quot;_id&quot;: &quot;12860455011047291267_5&quot;, &quot;title&quot;: &quot;&quot;, &quot;_score&quot;: 0.7546143721364809, &quot;content&quot;: &quot;4. Strengthen patrols of internet cafes, game arcades, hotels, guesthouses, and other venues. Strictly enforce prohibitions and restrictions on minors to prevent them from being exposed to harmful influences or exploitation. 5. Enhance patrols of rivers, lakes, and open channels in densely populated areas. Install protective facilities and post warning signs to prevent minors from drowning while swimming in unauthorized areas. 6. Place high importance on preventing risks from natural disasters during the flood season. Conduct detailed inspections of buildings, walls, and hillsides near all institutions and venues involving minors. For any risks and hazards identified during inspections, immediate rectification is required. This includes clarifying the responsible units, owners, corrective measures, and deadlines, and inspecting and accepting the results of the rectification.&quot;}}], &quot;history_messages&quot;: [], &quot;temperature&quot;: 1.0, &quot;top_p&quot;: 0.7, &quot;top_k&quot;: 50, &quot;length_penalty&quot;: 1.0, &quot;num_doc&quot;: 3, &quot;answer_doc&quot;: false, &quot;max_new_tokens&quot;: 512, &quot;tp_answer&quot;: &quot;&quot;, &quot;allow_direct_answer&quot;: false}",
        "request_id" : null,
        "result" : [
          "To",
          " prevent",
          " minors",
          " from",
          " drowning",
          ",",
          " relevant",
          " departments",
          " must",
          " increase",
          " patrols",
          " of",
          " rivers",
          ",",
          " lakes",
          ",",
          " and",
          " open",
          " channels",
          " in",
          " densely",
          " populated",
          " areas",
          ",",
          " install",
          " protective",
          " facilities",
          ",",
          " and",
          " post",
          " warning",
          " signs",
          "[",
          "1",
          "]",
          "[",
          "2",
          "]",
          "."
        ]
      },
      "exec_status" : true,
      "start_time" : 1693890270152,
      "trace_id" : "F00D6F02-7F4D-4DE9-88AA-AEDAD507ED86"
    },
    "fields" : [
      "name",
      "title",
      "content",
      "docId"
    ],
    "refer" : [
      {
        "content" : "4. Strengthen patrols of internet cafes, game arcades, hotels, guesthouses, and other venues. Strictly enforce prohibitions and restrictions on minors to prevent them from being exposed to harmful influences or exploitation. 5. Enhance patrols of rivers, lakes, and open channels in densely populated areas. Install protective facilities and post warning signs to prevent minors from drowning while swimming in unauthorized areas. 6. Place high importance on preventing risks from natural disasters during the flood season. Conduct detailed inspections of buildings, walls, and hillsides near all institutions and venues involving minors. For any risks and hazards identified during inspections, immediate rectification is required. This includes clarifying the responsible units, owners, corrective measures, and deadlines, and inspecting and accepting the results of the rectification.",
        "docId" : "12860455011047291267",
        "name" : "Public-Safety-Notice-[2021]-No-2.docx",
        "score" : 0.75426797591876671,
        "title" : ""
      },
      {
        "content" : "4. Strengthen patrols of internet cafes, game arcades, hotels, guesthouses, and other venues. Strictly enforce prohibitions and restrictions on minors to prevent them from being exposed to harmful influences or exploitation. 5. Enhance patrols of rivers, lakes, and open channels in densely populated areas. Install protective facilities and post warning signs to prevent minors from drowning while swimming in unauthorized areas. 6. Place high importance on preventing risks from natural disasters during the flood season. Conduct detailed inspections of buildings, walls, and hillsides near all institutions and venues involving minors. For any risks and hazards identified during inspections, immediate rectification is required. This includes clarifying the responsible units, owners, corrective measures, and deadlines, and inspecting and accepting the results of the rectification.",
        "docId" : "12860455011047291267",
        "name" : "Public-Safety-Notice-[2021]-No-2.docx",
        "score" : 0.75313563883732726,
        "title" : ""
      },
      {
        "content" : "4. Strengthen patrols of internet cafes, game arcades, hotels, guesthouses, and other venues. Strictly enforce prohibitions and restrictions on minors to prevent them from being exposed to harmful influences or exploitation. 5. Enhance patrols of rivers, lakes, and open channels in densely populated areas. Install protective facilities and post warning signs to prevent minors from drowning while swimming in unauthorized areas. 6. Place high importance on preventing risks from natural disasters during the flood season. Conduct detailed inspections of buildings, walls, and hillsides near all institutions and venues involving minors. For any risks and hazards identified during inspections, immediate rectification is required. This includes clarifying the responsible units, owners, corrective measures, and deadlines, and inspecting and accepting the results of the rectification.",
        "docId" : "12860455011047291267",
        "name" : "Public-Safety-Notice-[2021]-No-2.docx",
        "score" : 0.75461437213648086,
        "title" : ""
      }
    ],
    "search_recommend" : [
      "What is drowning?",
      "How can drowning be prevented?",
      "What is the first aid for drowning?"
    ]
  },
  "content" : "",
  "item_id" : "f-r-NqpKan3zEsWqN2ob9oa6u2",
  "session_id" : "f-s-T8ibtNAXkJUavu6iRuwobT"
}