API鉴权
鉴权的TOKEN可通过POP SDK中的 PostMSConvSearchTokenGenerated接口获取 在获取的token值前加上"Bearer "头封装到Authorization的header中。
Java SDK
相关Java SDK引入的Maven依赖
<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调用示例
public static void main(String[] args) throws Exception {
// 阿里云账号AccessKey拥有所有API的访问权限,风险很高。强烈建议您创建并使用RAM用户进行API访问或日常运维,请登录RAM控制台创建RAM用户。
// 此处以把AccessKey和AccessKeySecret直接定义再代码中为示例说明。您也可以根据业务需要,保存到配置文件里。
// 强烈建议不要把AccessKey和AccessKeySecret保存到代码里,会存在密钥泄漏风险
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()
// 必填,您的 AccessKey ID
.setAccessKeyId(accessKeyId)
// 必填,您的 AccessKey Secret
.setAccessKeySecret(accessKeySecret);
// Endpoint 请参考 https://api.aliyun.com/product/alinlp
config.endpoint = "alinlp.cn-beijing.aliyuncs.com";
return new Client(config);
}
响应结果示例
{
"code" : 200,
"data" : "zglgqoHdDn1QWxuPjkRyob7pmqTmTOVQkKZST/cUOk213ccJ6vw62ifkzbKWLZo4Lp6xkuXK6Xm2Qt5YVAhPTiSSM+VmiHQT7WjSSpcQJWE=",
"httpStatusCode" : 200,
"requestId" : "50212163-F250-591D-A124-3D6D69777706",
"success" : true
}
Token过期可根据接口返回的code或者msg来判断是否需要重新获取token,重新获取token直接再次调用PostMSConvSearchTokenGenerated接口
{
"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)
# python2: print(response)
print(str(response, encoding='utf-8'))
if __name__ == '__main__':
get_token()
访问域名
https://fastai-x-gateway.aliyuncs.com
通用参数
请求入参
字段 | 类型 | 说明 | 默认值 |
headers | map/dict/json | 请求头信息 | {} |
Authorization | string | 鉴权信息 | Bearer toY1FWrNAjvWkOmp24+UQFIi2PsYzbhNBq+yJmzumNmXw3sro3oOt9Kde5kzLcc4 |
多轮对话
请求方式 | POST |
api接口 | /msearch/api/chat |
鉴权认证 | 在 header 中加上token: -H 'Authorization: Bearer your-token' |
请求入参
一级参数 | 说明 | 类型 | 是否必传 |
input | 给大模型的相关信息 | {} | 是 |
parameters | 大模型参数 | {} | 是 |
debug | debug模式 | boolean | 是,默认为false |
一级参数 | 二级参数 | 说明 | 类型 | 是否必传 | 默认值 |
input | session_id | 对话的上下文id,空则新建对话 | string | 连续对话必传 | "" |
prompts | 提问问题 | string | 是 | ||
plugin_schemas | 插件参数 | {} | 否 | ||
max_tokens | 输出最大token数 | int | 否 | 512 | |
stream | 是否流式对话 | boolean | 否 | true | |
tenant_id | 标识search服务 | string | 是 | 固定值"msearch" | |
app_id | 服务id | long | 是 | ||
system_prompt | 预设指令 | string | 否 | "" | |
parameters | top_p | 模型的核采样值 | float | 否 | 0.7 |
top_k | 模型采样范围大小 | int | 否 | 50 | |
temperature | 采样温度 | int | 否 | 1 | |
allow_direct_answer | 是否开启大模型 | boolean | 否 | true | |
num_doc | 参与summary的doc数量 | int | 否 | 3 | |
content_fields | 用于引用信息拼接,多个字段使用分隔符"," | string | 否 | "" | |
reject_templete | 拒识模板 | string | 否 | "" | |
max_cotent_length | 单条知识长度上限(50~2000)且num_docs * max_content_length<=6000 | int | 否 | 1000 |
二级参数 | 三级参数 | 四级参数 | 说明 | 类型 | 是否必传 | 默认值 |
plugin_schemas | search_enhance | vector_recall_ratio | 向量召回比例(0.1~0.9) | float | 否 | 0.7 |
acc_sorting | 精排 doc 数量(50~500) | int | 否 | 200 | ||
custom_sorting | 自定义排序参数 | {} | 否 | "" | ||
search_size | 单query召回数量 | int | 否 | 3 | ||
custom_config_info | 自定义搜索配置 | {} | 否 | |||
filters | 筛选参数配置 | [] | 否 | |||
fields | 召回字段(正排)多个字段使用分隔符"," | string | 否 | "" |
请求示例
POST: /msearch/api/chat
在 header 中加上token
-H 'Authorization: Bearer xxx'
request body:
{
"input":{
"session_id":"",
"prompts":"大模型是什么",
"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
}
请求出参
非流式对话:返回是一个标准的http响应,其中data字段包含了chat的返回数据
一级参数 | 二级参数 | 说明 |
data | content | chat的回答内容 |
attachment | 当前搜索对话的参考文献,搜索推荐等 | |
session_id | 当前对话的上下文信息 | |
item_id | 系统内部自动生成的id,用于控制重试的上下文内容 |
二级参数 | 三级参数 | 说明 |
attachment | refer | 当前回答的引用信息 |
search_recommend | 下一步对话搜索推荐 | |
content_fields | 用于引用信息拼接 | |
fields | 用于判断引用信息的主键(默认第一个) | |
debug | debug 模式会增加 debug 字段,具体内容参考流式对话 |
response:
{
"code" : 200,
"data" : {
"attachment" : {
"content_fields" : [
"name",
"title",
"content",
"docId"
],
"fields" : [
"name",
"title",
"content",
"docId"
],
"refer" : [
{
"content" : "交通工具等进行周密安排,制定应急预案,严防交通事故、拥挤踩踏、食物中毒、意外伤害、野炊引发火灾等。四是加强对网吧、游戏厅和酒店、宾馆等场所的巡查,严格落实未成年人禁止性和限制性规定,防止未成年人受到不良影响或侵害。五是加强对人口集中居住地区河湖明渠的巡查,设立防护设施,悬挂警示标识,防止未成年人野浴溺水。六是高度重视汛期自然灾害风险防范,对各类涉未成年人机构场所周边的建筑物、围墙、山体等进行细致排查。对于排查发现的风险隐患要立即整改,做到明确责任单位、责任人、整改措施和时限要求,并对整改效果进行检查验收。",
"docId" : "12860455011047291267",
"name" : "国未保电〔2021〕2号.docx",
"score" : 0.75426797591876671,
"title" : ""
},
{
"content" : "交通工具等进行周密安排,制定应急预案,严防交通事故、拥挤踩踏、食物中毒、意外伤害、野炊引发火灾等。四是加强对网吧、游戏厅和酒店、宾馆等场所的巡查,严格落实未成年人禁止性和限制性规定,防止未成年人受到不良影响或侵害。五是加强对人口集中居住地区河湖明渠的巡查,设立防护设施,悬挂警示标识,防止未成年人野浴溺水。六是高度重视汛期自然灾害风险防范,对各类涉未成年人机构场所周边的建筑物、围墙、山体等进行细致排查。对于排查发现的风险隐患要立即整改,做到明确责任单位、责任人、整改措施和时限要求,并对整改效果进行检查验收。",
"docId" : "12860455011047291267",
"name" : "国未保电〔2021〕2号.docx",
"score" : 0.75313563883732726,
"title" : ""
},
{
"content" : "交通工具等进行周密安排,制定应急预案,严防交通事故、拥挤踩踏、食物中毒、意外伤害、野炊引发火灾等。四是加强对网吧、游戏厅和酒店、宾馆等场所的巡查,严格落实未成年人禁止性和限制性规定,防止未成年人受到不良影响或侵害。五是加强对人口集中居住地区河湖明渠的巡查,设立防护设施,悬挂警示标识,防止未成年人野浴溺水。六是高度重视汛期自然灾害风险防范,对各类涉未成年人机构场所周边的建筑物、围墙、山体等进行细致排查。对于排查发现的风险隐患要立即整改,做到明确责任单位、责任人、整改措施和时限要求,并对整改效果进行检查验收。",
"docId" : "12860455011047291267",
"name" : "国未保电〔2021〕2号.docx",
"score" : 0.75461437213648086,
"title" : ""
}
],
"search_recommend" : [
"溺水是什么?",
"如何预防溺水?",
"溺水后如何急救?"
]
},
"content" : "为了防止未成年人溺水,有关部门需要加强对人口集中居住地区河湖明渠的巡查,设立防护设施,悬挂警示标识[1][2]。",
"item_id" : "f-r-WaQoAbZ7TJBGbsmiBeniFx",
"session_id" : "f-s-YaqbiT9jt4pFbJKXdXhkqJ"
},
"httpStatusCode" : 200,
"msg" : null,
"requestId" : "ABF05DE7-A518-4F00-BCAE-5F74601CE55A",
"success" : true
}
流式对话
不同的 event 字段表示不同的状态信息
open:开启对话
message:模型输出
error:错误
control:其它信息
close:消息输出完毕,关闭对话
********** open 示例 **********
id:system
event:open
data:"success"
retry:3000
********** control 示例 **********
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} 指模型判断要进行搜索
id:F00D6F02-7F4D-4DE9-88AA-AEDAD507ED86
event:control
data:{
"attachment" : {
"ext" : null,
"name" : "search_rewrite",
"payload" : {
"queries_r" : [
"溺水的定义和原因",
"溺水的急救方法",
"溺水的预防措施"
]
}
},
"content" : "search_rewrite",
"item_id" : "f-r-3doN39VTezGiKCSDjx6btg",
"session_id" : "f-s-2HCKzvPZJ9uVfMrZRBoogq"
}
retry:3000
// {"queries_r": ["溺水的定义和原因","溺水的急救方法","溺水的预防措施"]} 是模型对问题进行了重写(rewrite)
id:F00D6F02-7F4D-4DE9-88AA-AEDAD507ED86
event:control
data:{
"attachment" : {
"ext" : null,
"name" : "search",
"payload" : {
"refer" : [
{
"content" : "交通工具等进行周密安排,制定应急预案,严防交通事故、拥挤踩踏、食物中毒、意外伤害、野炊引发火灾等。四是加强对网吧、游戏厅和酒店、宾馆等场所的巡查,严格落实未成年人禁止性和限制性规定,防止未成年人受到不良影响或侵害。五是加强对人口集中居住地区河湖明渠的巡查,设立防护设施,悬挂警示标识,防止未成年人野浴溺水。六是高度重视汛期自然灾害风险防范,对各类涉未成年人机构场所周边的建筑物、围墙、山体等进行细致排查。对于排查发现的风险隐患要立即整改,做到明确责任单位、责任人、整改措施和时限要求,并对整改效果进行检查验收。",
"docId" : "12860455011047291267",
"name" : "国未保电〔2021〕2号.docx",
"score" : 0.25426797591876671,
"title" : ""
}
],
"uq" : "溺水的定义和原因"
}
},
"content" : "search",
"item_id" : "f-r-3doN39VTezGiKCSDjx6btg",
"session_id" : "f-s-2HCKzvPZJ9uVfMrZRBoogq"
}
retry:3000
// 在 "refer" 中查找 "uq" 的结果
********** message 示例 **********
id:F00D6F02-7F4D-4DE9-88AA-AEDAD507ED86
event:message
data:{"attachment":null,"item_id":"f-r-3doN39VTezGiKCSDjx6btg","session_id":"f-s-2HCKzvPZJ9uVfMrZRBoogq","content":"为了防止未成"}
retry:3000
id:F00D6F02-7F4D-4DE9-88AA-AEDAD507ED86
event:message
data:{"attachment":null,"item_id":"f-r-3doN39VTezGiKCSDjx6btg","session_id":"f-s-2HCKzvPZJ9uVfMrZRBoogq","content":"年"}
retry:3000
id:F00D6F02-7F4D-4DE9-88AA-AEDAD507ED86
event:message
data:{"attachment":null,"item_id":"f-r-3doN39VTezGiKCSDjx6btg","session_id":"f-s-2HCKzvPZJ9uVfMrZRBoogq","content":"人"}
id:F00D6F02-7F4D-4DE9-88AA-AEDAD507ED86
event:message
data:{"attachment":null,"item_id":"f-r-3doN39VTezGiKCSDjx6btg","session_id":"f-s-2HCKzvPZJ9uVfMrZRBoogq","content":"溺"}
retry:3000
id:F00D6F02-7F4D-4DE9-88AA-AEDAD507ED86
event:message
data:{"attachment":null,"item_id":"f-r-3doN39VTezGiKCSDjx6btg","session_id":"f-s-2HCKzvPZJ9uVfMrZRBoogq","content":"水"}
retry:3000
********** close 示例 **********
id:system
event:close
data:"success"
retry:3000
********** error 示例 **********
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 模式 **********
在流式输出的最后一个 event:message 中,attachment 字段会包含 debug 字段:
{
"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" : "溺水",
"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" : "溺水",
"stream" : false,
"top_p" : 0.69999999999999996,
"tp_query_rewrite" : ""
},
"exec_result" : {
"queries_r" : [
"溺水的定义和原因",
"溺水的急救方法",
"溺水的预防措施"
]
},
"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" : "溺水的定义和原因"
},
"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" : "交通工具等进行周密安排,制定应急预案,严防交通事故、拥挤踩踏、食物中毒、意外伤害、野炊引发火灾等。四是加强对网吧、游戏厅和酒店、宾馆等场所的巡查,严格落实未成年人禁止性和限制性规定,防止未成年人受到不良影响或侵害。五是加强对人口集中居住地区河湖明渠的巡查,设立防护设施,悬挂警示标识,防止未成年人野浴溺水。六是高度重视汛期自然灾害风险防范,对各类涉未成年人机构场所周边的建筑物、围墙、山体等进行细致排查。对于排查发现的风险隐患要立即整改,做到明确责任单位、责任人、整改措施和时限要求,并对整改效果进行检查验收。",
"docId" : "12860455011047291267",
"name" : "国未保电〔2021〕2号.docx",
"title" : ""
}
],
"extras" : null,
"keywords" : [
{
"fuzzy" : true,
"name" : "全文",
"schema" : "content,title,name,docId",
"value" : "溺水定义和原因"
}
],
"qpInfos" : [
{
"cleanQuery" : "溺水的定义和原因",
"operator" : "AND",
"query" : "溺水的定义和原因",
"recognitions" : [
{
"name" : "O",
"text" : "溺水"
},
{
"name" : "O",
"text" : "的"
},
{
"name" : "O",
"text" : "定义"
},
{
"name" : "O",
"text" : "和"
},
{
"name" : "O",
"text" : "原因"
}
],
"rewrite" : "溺水定义和原因",
"sensitive" : false,
"spellcheck" : false,
"spellchecked" : "溺水的定义和原因",
"stopWords" : [
"的"
],
"synonymWords" : [
{
"synonyms" : [
"与"
],
"word" : "和"
}
],
"tokenized" : [
"溺水",
"的",
"定义",
"和",
"原因"
]
}
],
"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" : "溺水的急救方法"
},
"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" : "交通工具等进行周密安排,制定应急预案,严防交通事故、拥挤踩踏、食物中毒、意外伤害、野炊引发火灾等。四是加强对网吧、游戏厅和酒店、宾馆等场所的巡查,严格落实未成年人禁止性和限制性规定,防止未成年人受到不良影响或侵害。五是加强对人口集中居住地区河湖明渠的巡查,设立防护设施,悬挂警示标识,防止未成年人野浴溺水。六是高度重视汛期自然灾害风险防范,对各类涉未成年人机构场所周边的建筑物、围墙、山体等进行细致排查。对于排查发现的风险隐患要立即整改,做到明确责任单位、责任人、整改措施和时限要求,并对整改效果进行检查验收。",
"docId" : "12860455011047291267",
"name" : "国未保电〔2021〕2号.docx",
"title" : ""
}
],
"extras" : null,
"keywords" : [
{
"fuzzy" : true,
"name" : "全文",
"schema" : "content,title,name,docId",
"value" : "溺水急救方法"
}
],
"qpInfos" : [
{
"cleanQuery" : "溺水的急救方法",
"operator" : "AND",
"query" : "溺水的急救方法",
"recognitions" : [
{
"name" : "O",
"text" : "溺水"
},
{
"name" : "O",
"text" : "的"
},
{
"name" : "O",
"text" : "急救"
},
{
"name" : "O",
"text" : "方法"
}
],
"rewrite" : "溺水急救方法",
"sensitive" : false,
"spellcheck" : false,
"spellchecked" : "溺水的急救方法",
"stopWords" : [
"的"
],
"synonymWords" : [
],
"tokenized" : [
"溺水",
"的",
"急救",
"方法"
]
}
],
"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" : "溺水的预防措施"
},
"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" : "交通工具等进行周密安排,制定应急预案,严防交通事故、拥挤踩踏、食物中毒、意外伤害、野炊引发火灾等。四是加强对网吧、游戏厅和酒店、宾馆等场所的巡查,严格落实未成年人禁止性和限制性规定,防止未成年人受到不良影响或侵害。五是加强对人口集中居住地区河湖明渠的巡查,设立防护设施,悬挂警示标识,防止未成年人野浴溺水。六是高度重视汛期自然灾害风险防范,对各类涉未成年人机构场所周边的建筑物、围墙、山体等进行细致排查。对于排查发现的风险隐患要立即整改,做到明确责任单位、责任人、整改措施和时限要求,并对整改效果进行检查验收。",
"docId" : "12860455011047291267",
"name" : "国未保电〔2021〕2号.docx",
"title" : ""
}
],
"extras" : null,
"keywords" : [
{
"fuzzy" : true,
"name" : "全文",
"schema" : "content,title,name,docId",
"value" : "溺水预防措施"
}
],
"qpInfos" : [
{
"cleanQuery" : "溺水的预防措施",
"operator" : "AND",
"query" : "溺水的预防措施",
"recognitions" : [
{
"name" : "O",
"text" : "溺水"
},
{
"name" : "O",
"text" : "的"
},
{
"name" : "O",
"text" : "预防"
},
{
"name" : "O",
"text" : "措施"
}
],
"rewrite" : "溺水预防措施",
"sensitive" : false,
"spellcheck" : false,
"spellchecked" : "溺水的预防措施",
"stopWords" : [
"的"
],
"synonymWords" : [
],
"tokenized" : [
"溺水",
"的",
"预防",
"措施"
]
}
],
"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" : "溺水",
"role" : "user"
},
{
"content" : "为了防止未成年人溺水,有关部门需要加强对人口集中居住地区河湖明渠的巡查,设立防护设施,悬挂警示标识[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" : [
"溺水是什么?",
"如何预防溺水?",
"溺水后如何急救?"
]
},
"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" : "{"rerankSize": 200, "uqVectorRecallRatio": 0.5}",
"fields" : "name,title,content,docId",
"human_input" : "溺水",
"max_new_tokens" : 512,
"num_doc" : 3,
"rank_model_info" : "{"default": {"features": [{"name": "vector_index", "weights": 0.5, "threshold": 0, "norm": true, "norm_factor": 40}, {"name": "static_value", "field": "_rc_t_score", "weights": 0.5, "threshold": 0, "norm_factor": 80, "norm": true}], "aggregate_algo": "weight_avg"}}",
"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" : "{"query": "溺水", "model_id": "daily-top_qad-392", "api_key": "ztPO******4A26", "stream": true, "search_results": [{"id": 1, "content": "国未保电〔2021〕2号.docx\\n\\n交通工具等进行周密安排,制定应急预案,严防交通事故、拥挤踩踏、食物中毒、意外伤害、野炊引发火灾等。四是加强对网吧、游戏厅和酒店、宾馆等场所的巡查,严格落实未成年人禁止性和限制性规定,防止未成年人受到不良影响或侵害。五是加强对人口集中居住地区河湖明渠的巡查,设立防护设施,悬挂警示标识,防止未成年人野浴溺水。六是高度重视汛期自然灾害风险防范,对各类涉未成年人机构场所周边的建筑物、围墙、山体等进行细致排查。对于排查发现的风险隐患要立即整改,做到明确责任单位、责任人、整改措施和时限要求,并对整改效果进行检查验收。\\n12860455011047291267", "raw_search_result": {"_rc_score": 1.0, "_rc_v_score": 7.1110015e-05, "_rc_t_score": 2.73177, "_scores": {"vector_index": 0.5, "static_value(_rc_t_score)": 0.2542679759187667}, "docId": "12860455011047291267", "name": "国未保电〔2021〕2号.docx", "_q_score": 1.0, "_id": "12860455011047291267_5", "title": "", "_score": 0.7542679759187667, "content": "交通工具等进行周密安排,制定应急预案,严防交通事故、拥挤踩踏、食物中毒、意外伤害、野炊引发火灾等。四是加强对网吧、游戏厅和酒店、宾馆等场所的巡查,严格落实未成年人禁止性和限制性规定,防止未成年人受到不良影响或侵害。五是加强对人口集中居住地区河湖明渠的巡查,设立防护设施,悬挂警示标识,防止未成年人野浴溺水。六是高度重视汛期自然灾害风险防范,对各类涉未成年人机构场所周边的建筑物、围墙、山体等进行细致排查。对于排查发现的风险隐患要立即整改,做到明确责任单位、责任人、整改措施和时限要求,并对整改效果进行检查验收。"}}, {"id": 2, "content": "国未保电〔2021〕2号.docx\\n\\n交通工具等进行周密安排,制定应急预案,严防交通事故、拥挤踩踏、食物中毒、意外伤害、野炊引发火灾等。四是加强对网吧、游戏厅和酒店、宾馆等场所的巡查,严格落实未成年人禁止性和限制性规定,防止未成年人受到不良影响或侵害。五是加强对人口集中居住地区河湖明渠的巡查,设立防护设施,悬挂警示标识,防止未成年人野浴溺水。六是高度重视汛期自然灾害风险防范,对各类涉未成年人机构场所周边的建筑物、围墙、山体等进行细致排查。对于排查发现的风险隐患要立即整改,做到明确责任单位、责任人、整改措施和时限要求,并对整改效果进行检查验收。\\n12860455011047291267", "raw_search_result": {"_rc_score": 1.0, "_rc_v_score": 6.521896e-05, "_rc_t_score": 2.0069141, "_scores": {"vector_index": 0.5, "static_value(_rc_t_score)": 0.25313563883732726}, "docId": "12860455011047291267", "name": "国未保电〔2021〕2号.docx", "_q_score": 1.0, "_id": "12860455011047291267_5", "title": "", "_score": 0.7531356388373273, "content": "交通工具等进行周密安排,制定应急预案,严防交通事故、拥挤踩踏、食物中毒、意外伤害、野炊引发火灾等。四是加强对网吧、游戏厅和酒店、宾馆等场所的巡查,严格落实未成年人禁止性和限制性规定,防止未成年人受到不良影响或侵害。五是加强对人口集中居住地区河湖明渠的巡查,设立防护设施,悬挂警示标识,防止未成年人野浴溺水。六是高度重视汛期自然灾害风险防范,对各类涉未成年人机构场所周边的建筑物、围墙、山体等进行细致排查。对于排查发现的风险隐患要立即整改,做到明确责任单位、责任人、整改措施和时限要求,并对整改效果进行检查验收。"}}, {"id": 3, "content": "国未保电〔2021〕2号.docx\\n\\n交通工具等进行周密安排,制定应急预案,严防交通事故、拥挤踩踏、食物中毒、意外伤害、野炊引发火灾等。四是加强对网吧、游戏厅和酒店、宾馆等场所的巡查,严格落实未成年人禁止性和限制性规定,防止未成年人受到不良影响或侵害。五是加强对人口集中居住地区河湖明渠的巡查,设立防护设施,悬挂警示标识,防止未成年人野浴溺水。六是高度重视汛期自然灾害风险防范,对各类涉未成年人机构场所周边的建筑物、围墙、山体等进行细致排查。对于排查发现的风险隐患要立即整改,做到明确责任单位、责任人、整改措施和时限要求,并对整改效果进行检查验收。\\n12860455011047291267", "raw_search_result": {"_rc_score": 1.0, "_rc_v_score": 0.0001092516, "_rc_t_score": 2.9535336, "_scores": {"vector_index": 0.5, "static_value(_rc_t_score)": 0.2546143721364808}, "docId": "12860455011047291267", "name": "国未保电〔2021〕2号.docx", "_q_score": 1.0, "_id": "12860455011047291267_5", "title": "", "_score": 0.7546143721364809, "content": "交通工具等进行周密安排,制定应急预案,严防交通事故、拥挤踩踏、食物中毒、意外伤害、野炊引发火灾等。四是加强对网吧、游戏厅和酒店、宾馆等场所的巡查,严格落实未成年人禁止性和限制性规定,防止未成年人受到不良影响或侵害。五是加强对人口集中居住地区河湖明渠的巡查,设立防护设施,悬挂警示标识,防止未成年人野浴溺水。六是高度重视汛期自然灾害风险防范,对各类涉未成年人机构场所周边的建筑物、围墙、山体等进行细致排查。对于排查发现的风险隐患要立即整改,做到明确责任单位、责任人、整改措施和时限要求,并对整改效果进行检查验收。"}}], "history_messages": [], "temperature": 1.0, "top_p": 0.7, "top_k": 50, "length_penalty": 1.0, "num_doc": 3, "answer_doc": false, "max_new_tokens": 512, "tp_answer": "", "allow_direct_answer": false}",
"request_id" : null,
"result" : [
"为了防止未成",
"年",
"人",
"溺",
"水",
",",
"有",
"关",
"部",
"门",
"需",
"要",
"加",
"强",
"对",
"人",
"口",
"集",
"中",
"居",
"住",
"地",
"区",
"河",
"湖",
"明",
"渠",
"的",
"巡",
"查",
",",
"设",
"立",
"防",
"护",
"设",
"施",
",",
"悬",
"挂",
"警",
"示",
"标",
"识",
"[",
"1",
"]",
"[",
"2",
"]",
"。"
]
},
"exec_status" : true,
"start_time" : 1693890270152,
"trace_id" : "F00D6F02-7F4D-4DE9-88AA-AEDAD507ED86"
},
"fields" : [
"name",
"title",
"content",
"docId"
],
"refer" : [
{
"content" : "交通工具等进行周密安排,制定应急预案,严防交通事故、拥挤踩踏、食物中毒、意外伤害、野炊引发火灾等。四是加强对网吧、游戏厅和酒店、宾馆等场所的巡查,严格落实未成年人禁止性和限制性规定,防止未成年人受到不良影响或侵害。五是加强对人口集中居住地区河湖明渠的巡查,设立防护设施,悬挂警示标识,防止未成年人野浴溺水。六是高度重视汛期自然灾害风险防范,对各类涉未成年人机构场所周边的建筑物、围墙、山体等进行细致排查。对于排查发现的风险隐患要立即整改,做到明确责任单位、责任人、整改措施和时限要求,并对整改效果进行检查验收。",
"docId" : "12860455011047291267",
"name" : "国未保电〔2021〕2号.docx",
"score" : 0.75426797591876671,
"title" : ""
},
{
"content" : "交通工具等进行周密安排,制定应急预案,严防交通事故、拥挤踩踏、食物中毒、意外伤害、野炊引发火灾等。四是加强对网吧、游戏厅和酒店、宾馆等场所的巡查,严格落实未成年人禁止性和限制性规定,防止未成年人受到不良影响或侵害。五是加强对人口集中居住地区河湖明渠的巡查,设立防护设施,悬挂警示标识,防止未成年人野浴溺水。六是高度重视汛期自然灾害风险防范,对各类涉未成年人机构场所周边的建筑物、围墙、山体等进行细致排查。对于排查发现的风险隐患要立即整改,做到明确责任单位、责任人、整改措施和时限要求,并对整改效果进行检查验收。",
"docId" : "12860455011047291267",
"name" : "国未保电〔2021〕2号.docx",
"score" : 0.75313563883732726,
"title" : ""
},
{
"content" : "交通工具等进行周密安排,制定应急预案,严防交通事故、拥挤踩踏、食物中毒、意外伤害、野炊引发火灾等。四是加强对网吧、游戏厅和酒店、宾馆等场所的巡查,严格落实未成年人禁止性和限制性规定,防止未成年人受到不良影响或侵害。五是加强对人口集中居住地区河湖明渠的巡查,设立防护设施,悬挂警示标识,防止未成年人野浴溺水。六是高度重视汛期自然灾害风险防范,对各类涉未成年人机构场所周边的建筑物、围墙、山体等进行细致排查。对于排查发现的风险隐患要立即整改,做到明确责任单位、责任人、整改措施和时限要求,并对整改效果进行检查验收。",
"docId" : "12860455011047291267",
"name" : "国未保电〔2021〕2号.docx",
"score" : 0.75461437213648086,
"title" : ""
}
],
"search_recommend" : [
"溺水是什么?",
"如何预防溺水?",
"溺水后如何急救?"
]
},
"content" : "",
"item_id" : "f-r-NqpKan3zEsWqN2ob9oa6u2",
"session_id" : "f-s-T8ibtNAXkJUavu6iRuwobT"
}