POST /openapi/memorylake/api/v1/projects/{id}/search
所需权限:
project:search · instance路径参数
string
必填
项目 ID
请求体
string
必填
自然语言搜索查询。同时用于两个子搜索。
string
必填
记忆子搜索的用户 ID 过滤条件。文档搜索忽略此字段。
integer
默认值:"10"
返回的最大结果数,范围 1-1000。同时应用于文档和记忆匹配 — 例如
top_n=10 最多返回 10 条文档和 10 条记忆。number
默认值:"0.3"
记忆结果的最低相似度分数。低于此分数的结果将被过滤。不适用于文档。
boolean
默认值:"false"
在记忆结果中包含冲突信息。
curl -X POST 'https://app.memorylake.ai/openapi/memorylake/api/v1/projects/proj-a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6/search' \
-H 'Authorization: Bearer sk_xxxxxx' \
-H 'Content-Type: application/json' \
-d '{
"query": "What were the quarterly sales figures in 2024?",
"user_id": "user-abc123",
"top_n": 10,
"threshold": 0.3
}'
响应
object
显示 组合搜索结果
显示 组合搜索结果
array
文档搜索结果。每个条目是一个可区分联合体 —
type 决定哪些变体专有字段存在,以及 highlight 的哪个子字段被填充。点击展开查看完整的单条目结构。显示 文档结果条目
显示 文档结果条目
string
必填
类型区分符。可选值为
paragraph、table 或 figure。string
文档 ID
string
文档文件名,例如
report_2024.xlsxobject
匹配内容。该对象始终包含以下三个可选字段 — 根据父条目的
type 值,恰好填充其中一个。显示 highlight 属性
显示 highlight 属性
Chunk[]
InnerTable[]
当
type=table 时填充。源表区域内匹配的子表。其他情况下不存在。显示 InnerTable 属性
显示 InnerTable 属性
string
内部表 ID
string
覆盖的单元格范围,例如
A1:D50integer
数据行数
string
物化表的内部存储路径
string
仅当
type=paragraph 时存在。 文档内的段落块 ID。string
仅当
type=table 时存在。 表实体 ID。string
仅当
type=table 时存在。 表标题。string
仅当
type=table 时存在。 表脚注。string
仅当
type=table 时存在。 工作表名称(工作簿表格)。string
仅当
type=table 时存在。 模型推断的工作表语义名称。string
仅当
type=table 时存在。 模型推断的工作表语义注释。string
仅当
type=table 时存在。 表区域位置,例如 A1:D50。integer
仅当
type=figure 时存在。 图表数字 ID。{
"success": true,
"message": "Operation completed successfully",
"data": {
"documents": [
{
"type": "paragraph",
"document_id": "doc-123",
"document_name": "report_2024.pdf",
"paragraph_block_id": "blk-456",
"highlight": {
"chunks": [
{ "text": "Q1 2024 sales reached $2.5M...", "range": "p12" }
]
},
"source_document": { "file_name": "report_2024.pdf" }
},
{
"type": "table",
"document_id": "doc-789",
"document_name": "sales_data.xlsx",
"table_id": "tbl-001",
"title": "Quarterly Sales Summary",
"sheet_name": "Sheet1",
"semantic_sheet_name": "2024 Quarterly Sales",
"table_region_info": "A1:D50",
"highlight": {
"inner_tables": [
{
"id": "itbl-001",
"data_range": "A1:D50",
"num_rows": 49,
"persist_path": "tables/doc-789/itbl-001",
"columns": [
{
"id": "col-1",
"name": "Quarter",
"data_type": "string",
"range": "A2:A50",
"count": 49,
"null_count": 0,
"approx_ndv": 4,
"examples": [{ "v": "Q1" }, { "v": "Q2" }],
"display_examples": [{ "v": "Q1" }, { "v": "Q2" }]
},
{
"id": "col-2",
"name": "Revenue",
"data_type": "number",
"range": "B2:B50",
"min_value": "1200000",
"max_value": "3100000"
}
]
}
]
},
"source_document": { "file_name": "sales_data.xlsx" }
},
{
"type": "figure",
"document_id": "doc-456",
"document_name": "report_2024.pdf",
"figure_id": 7,
"highlight": {
"figure": {
"caption": "Figure 7. Quarterly revenue trend, 2024",
"text": "Q1 $2.5M Q2 $2.8M Q3 $3.0M Q4 $3.1M",
"summary_text": "Bar chart showing steady quarterly revenue growth across 2024.",
"prequestion_list": [
"Which quarter had the highest revenue in 2024?",
"What was the revenue trend across 2024?"
],
"persist_path": "figures/doc-456/fig-7.png"
}
},
"source_document": { "file_name": "report_2024.pdf" }
}
],
"memories": [
{
"id": "mem-123",
"content": "User prefers Hangzhou cuisine restaurants",
"user_id": "user-abc123",
"expired": false,
"has_unresolved_conflict": false,
"created_at": "2024-01-15T10:00:00Z",
"updated_at": "2024-01-15T10:00:00Z"
}
]
}
}
任一列表在没有匹配项超过阈值时可能为空。请独立处理
documents 和 memories — 它们只是为了方便而一起返回的两个查找结果。