搜索消息
2.12 版本引入
检索对话式搜索的消息信息。您可以向 _search
端点发送查询,以在内存中搜索匹配的消息。
当安全插件启用时,所有内存都以私有
安全模式存在。只有创建内存的用户才能与该内存及其消息进行交互。
端点
POST /_plugins/_ml/memory/<memory_id>/_search
GET /_plugins/_ml/memory/<memory_id>/_search
路径参数
下表列出了可用的路径参数。
参数 | 数据类型 | 描述 |
---|---|---|
memory_id | 字符串 | 用于搜索与查询匹配的消息的内存 ID。 |
请求示例
GET /_plugins/_ml/memory/gW8Aa40BfUsSoeNTvOKI/_search
{
"query": {
"match": {
"input": "interaction"
}
}
}
示例响应
{
"took": 5,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 1,
"relation": "eq"
},
"max_score": 0.47000366,
"hits": [
{
"_index": ".plugins-ml-memory-message",
"_id": "BW8ha40BfUsSoeNT8-i3",
"_version": 1,
"_seq_no": 0,
"_primary_term": 1,
"_score": 0.47000366,
"_source": {
"input": "How do I make an interaction?",
"memory_id": "gW8Aa40BfUsSoeNTvOKI",
"trace_number": null,
"create_time": "2024-02-02T18:43:23.566994302Z",
"additional_info": {
"suggestion": "api.openai.com"
},
"response": "Hello, this is OpenAI. Here is the answer to your question.",
"origin": "MyFirstOpenAIWrapper",
"parent_message_id": null,
"prompt_template": "Hello OpenAI, can you answer this question?"
}
}
]
}
}
响应正文字段
有关响应字段的信息,请参阅创建消息请求字段。