You can retrieve document chunks from a document library using text. You can specify the number of chunks to retrieve, filter them by metadata conditions, and choose whether to complete the document chunks.
Operation description
Prerequisites
- Activate the Alibaba Cloud Model Studio service and the Tongyi Dianjin service.
- Obtain the workspace ID. Obtain the workspace identity.
Try it now
You can run this API directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After a successful run, OpenAPI Explorer can automatically generate SDK code examples.
Debug
RAM authorization
The following table describes the authorization information for this API. You can use it in the Action element of a RAM policy statement to grant RAM users or RAM roles the permission to call this API. For more information:
- Action: the specific permission point.
- Access level: the access level of each action. Valid values: Write, Read, and List.
-
Resource type: the resource types that support authorization for the action. Details:
- Required resource types are marked with a preceding asterisk (*).
- For operations that do not support resource-level authorization,
All resourcesis used.
- Condition key: the condition keys defined by the cloud service itself.
- Dependent action: the other permissions required to successfully perform the operation. The caller must also have the permissions of the dependent actions for the operation to succeed.
| Action | Access level | Resource type | Condition key | Dependent action |
|---|---|---|---|---|
| dianjin:RecallDocument | none | *All resources * |
| None |
Request syntax
Request parameters
| Parameter | Type | Required | Description | Example value |
|---|---|---|---|---|
| workspaceId | string | Yes | Path parameter, workspace ID. | llm-xxxxx |
| body | object | No | Request body parameters. | |
| filters | array<object> | No | Metadata filter conditions. | |
| filter | object | No | Filter. | |
| and | array<object> | No | AND expression, used to filter documents/document chunks. | |
| and | object | No | AND expression. | |
| boost | float | No | Keyword weight. | 20 |
| key | string | No | The key of the metadata in the document library. | docType |
| operator | string | No | The relationship between the value stored in the document library metadata key and the value you enter.
| contains |
| value | string | No | The value of the metadata you enter. | Strategy report |
| chunkType | string | No | Document chunk type, used to filter document chunks, including: Text, Graph, Table, FAQ. | Text |
| docIdList | array | No | Document ID list, used to filter documents/document chunks. | |
| docIdList | string | No | Document ID. | 8372458573692819933 |
| libraryId | string | Yes | Document library ID, used to filter documents/document chunks. | sdbjhvs |
| or | array<object> | No | OR expression, used to filter documents/document chunks. | |
| or | object | No | OR expression. | |
| boost | float | No | Keyword weight. | 30 |
| key | string | No | The key of the metadata in the document library. | researcher |
| operator | string | No | The relationship between the value stored in the document library metadata key and the value you enter.
| eq |
| value | string | No | The value of the metadata you enter. | zhangsan |
| status | array | No | Document status list, used to filter documents. | |
| statu | string | No | Document status. | WaitRefresh |
| query | string | Yes | Text. | Which teams in European Championship history have benefited from players adapting to new cultures |
| rearrangement | boolean | No | Whether to enable parent-child document chunk recall.
| false |
| topK | integer | No | The number of document chunks to recall. | 10 |
Response elements
| Element | Type | Description | Example value |
|---|---|---|---|
| object | Returned data. | ||
| cost | long | Time elapsed. | 0 |
| data | object | Response data. | |
| chunkList | array<object> | Chunk list. | |
| chunkList | object | Chunk. | |
| chunkId | string | Document chunk ID. | 823746762354 |
| chunkMeta | object | Document chunk metadata. | {"a":"1"} |
| chunkOssUrl | string | Document chunk OSS address. | http://oss-xxx-hangzhou.com/xxx |
| chunkText | string | Document chunk text. | Test document chunk |
| chunkType | string | Document chunk type. | text |
| docId | string | Document ID. | 839468263472 |
| fileType | string | Document type. | |
| libraryId | string | Document library ID. | dscsbdsk |
| libraryName | string | Document library name. | Test document library |
| nextChunkId | string | Next document chunk ID. | 982374872364 |
| pos | array<object> | Document chunk position. | |
| po | object | Document chunk position coordinates. | |
| axisArray | array | Coordinates. | |
| axisArray | double | Coordinate value. | 20.8 |
| page | integer | Page number. | 1 |
| textHighlightArea | array | Text highlight area, used for text-type file highlighting. | |
| textHighlightArea | integer | Text highlight area data. | 1 |
| preChunkId | string | Previous document chunk ID. | 827364827364832 |
| score | float | Document chunk score. | 0.5 |
| title | string | Document title. | test |
| chunkPartList | array<object> | Chunk part (layout recognition result) list. | |
| chunkPartList | object | Chunk part (layout recognition result). | |
| chunkId | string | Document chunk ID. | 98327482364 |
| chunkMeta | object | Document chunk metadata. | {"a":"1"} |
| chunkOssUrl | string | Document chunk OSS address. | http://oss-xxx-hangzhou.com/xxx |
| chunkText | string | Document chunk text. | Test document chunk |
| chunkType | string | Document chunk type. | text |
| docId | string | Document ID. | 92837482364 |
| fileType | string | Document type. | |
| libraryId | string | Document library ID. | sjdhgjsd |
| libraryName | string | Document library name. | Test document library |
| nextChunkId | string | Next document chunk ID. | 2387648263542 |
| pos | array<object> | Document chunk position. | |
| po | object | Document chunk position data. | |
| axisArray | array | Coordinates. | |
| axisArray | double | Coordinate value. | 1 |
| page | integer | Page number. | 1 |
| textHighlightArea | array | Text highlight area, used for text-type file highlighting. | |
| textHighlightArea | integer | Text highlight area position data. | 1 |
| preChunkId | string | Previous document chunk ID. | 32874682764 |
| score | float | Document chunk score. | 0.5 |
| title | string | Document title. | Test document title |
| chunkTextList | array | Chunk text list. | |
| chunkTextList | string | Document chunk. | This is a test document chunk |
| documents | array<object> | Document list. | |
| document | object | Document information. | |
| docId | string | Document ID. | 92837482364 |
| documentMeta | object | Document metadata. | {"a":"1"} |
| fileType | string | Document type. | |
| gmtCreate | string | Creation time. | 2024-01-01 00:00:00 |
| libraryId | string | Document library ID. | sjdhgjsd |
| title | string | Document title. | test |
| url | string | Document link. | http://oss-xxx-hangzhou.com/test.pdf |
| embeddingElapsedMs | long | Vector computation time elapsed. | 100 |
| textChunkList | array<object> | List of chunks retrieved from the text index. | |
| textChunkList | object | Chunk retrieved from the text index. | |
| chunkId | string | Document chunk ID. | 32874682364 |
| chunkMeta | object | Document chunk metadata. | {"a":"1"} |
| chunkOssUrl | string | Document chunk OSS address. | http://oss-xxx-hangzhou.com/xxx |
| chunkText | string | Document chunk text. | This is a test document chunk |
| chunkType | string | Document chunk type. | text |
| docId | string | Document ID. | 8372467263542 |
| fileType | string | Document type. | |
| libraryId | string | Document library ID. | djsgfsjd |
| libraryName | string | Document library name. | Test document library |
| nextChunkId | string | Next document chunk ID. | 23874682432 |
| pos | array<object> | Document chunk position. | |
| po | object | Document chunk position. | |
| axisArray | array | Coordinates. | |
| axisArray | double | Coordinate value. | 10 |
| page | integer | Page number. | 1 |
| textHighlightArea | array | Text highlight area, used for text-type file highlighting. | |
| textHighlightArea | integer | Text highlight area data. | 1 |
| preChunkId | string | Previous document chunk ID. | 89473868346 |
| score | float | Document chunk score. | 0.5 |
| title | string | Document title. | Test document title |
| textSearchElapsedMs | long | Text search time elapsed. | 100 |
| totalElapsedMs | long | Total time elapsed, including vector computation time, vector search time, and text search time (depending on retrieval parameters). | 400 |
| vectorChunkList | array<object> | List of chunks retrieved from the vector index. | |
| vectorChunkList | object | Chunk retrieved from the vector index. | |
| chunkId | string | Document chunk ID. | 8723642345276 |
| chunkMeta | object | Document chunk metadata. | {"a":"1"} |
| chunkOssUrl | string | Document chunk OSS address. | https://oss-xxxx-hangzhou.com/test.pdf |
| chunkText | string | Document chunk text. | This is a test text |
| chunkType | string | Document chunk type. | text |
| docId | string | Document ID. | 78326476235675372 |
| fileType | string | Document type. | |
| libraryId | string | Document library ID. | djsgfsjd |
| libraryName | string | Document library name. | Test document library |
| nextChunkId | string | Next document chunk ID. | 293846872343 |
| pos | array<object> | Document chunk position. | |
| po | object | Document chunk position coordinates. | |
| axisArray | array | Coordinates. | |
| axisArray | double | Coordinate value. | 48.8 |
| page | integer | Page number. | 1 |
| textHighlightArea | array | Text highlight area, used for text-type file highlighting. | |
| textHighlightArea | integer | Text highlight area. | 10 |
| preChunkId | string | Previous document chunk ID. | 873647326542 |
| score | float | Document chunk score. | 0.5 |
| title | string | Document title. | test |
| vectorSearchElapsedMs | long | Vector search time elapsed. | 100 |
| dataType | string | Data type. | null |
| errCode | string | Error code. | 0 |
| message | string | Error message. | ok |
| requestId | string | Request ID. | 0bc13a9517168617617186457e401f |
| success | boolean | Whether the request is successful. | true |
| time | string | Timestamp. | 2024-04-24 11:54:34 |
Examples
Success response
JSON format