POST /openapi/memorylake/api/v1/projects/{id}/documents/search
table、paragraph 和 figure —— 每种通过 type 字段标识。
所需权限:
project:doc_search · instance路径参数
请求体
curl -X POST 'https://app.memorylake.ai/openapi/memorylake/api/v1/projects/proj-e7b262987be4589fabc60257ec2a2230/documents/search' \
-H 'Authorization: Bearer sk_xxxxxx' \
-H 'Content-Type: application/json' \
-d '{
"query": "What were the quarterly sales figures in 2024?",
"top_n": 10
}'
响应
显示 搜索结果
显示 搜索结果
按相关性排序的搜索结果。每个条目是一个可区分的联合类型 ——
type 决定了哪些变体字段存在,以及 highlight 的哪个子字段会被填充。点击展开完整的条目结构。显示 结果条目
显示 结果条目
匹配的内容。该对象始终包含以下三个可选字段 —— 恰好有一个被填充,由父条目的
type 决定。显示 highlight 属性
显示 highlight 属性
当
type=table 时填充。源表区域内匹配的子表。其他情况下不存在。显示 InnerTable 属性
显示 InnerTable 属性
{
"success": true,
"data": {
"count": 3,
"results": [
{
"type": "paragraph",
"document_id": "doc-80e1657a999bce34ef2f7056f117134d",
"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-7f432d326c7acd40563b4503da81cdd8",
"document_name": "sales_data.xlsx",
"table_id": "tbl-001",
"title": "Quarterly Sales Summary",
"sheet_name": "Sheet1",
"table_region_info": "A1:D50",
"highlight": {
"inner_tables": [...]
},
"source_document": {
"file_name": "sales_data.xlsx"
}
}
]
}
}