Upload a document to a document library. The system parses the document, splits it into chunks, and builds an index.
Operation description
Make sure that you fully understand the billing methods and pricing of Tongyi Dianjin before you use this operation.
Prerequisites
- Alibaba Cloud Model Studio and Tongyi Dianjin are activated.
- You have obtained the workspace ID. For more information about how to obtain it, see workspace identifier.
Debug
You can run this API directly in OpenAPI Explorer, which saves you the trouble of calculating signatures. After the operation succeeds, OpenAPI Explorer can automatically generate SDK code examples.
Debug
Authorization information
The following table describes the authorization information of this API. You can use the Action element in RAM permission policy statements to grant RAM users or RAM roles the permissions to call this API. For more details:
- Action: the specific permission point.
- Access level: the access level of each operation. Valid values: Write, Read, or List.
-
Resource type: the resource types that support authorization for the operation. For more details:
- For required resource types, a leading asterisk (*) is added.
- 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: other permissions required to successfully perform the operation. The caller must have the permissions of all dependent actions for the operation to succeed.
| Action | Access level | Resource type | Condition key | Dependent action |
|---|---|---|---|---|
| dianjin:UploadDocument | none | *All Resources * |
| None |
Request syntax
Request parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| workspaceId | string | Yes | Path parameter. The workspace ID. | llm-xxxxx |
| body | object | No | The request body. | |
| data | string | No | File metadata, which can be used as a filter during retrieval. | {\"cateogry\": \"Report\"} |
| fileName | string | Yes | The full file name (including the extension). Currently, pdf, doc, docx, markdown, ppt, and pptx are supported. The file size is limited to 100 MB, and pdf, doc, docx, ppt, and pptx files are limited to 500 pages. | test.pdf |
| fileUrl | string | Yes | The OSS URL of the file. If the file is not publicly readable, fileUrl must carry signature parameters. If you use an SDK to upload files, you can upload the file directly without providing an OSS URL. For more information, see the SDK documentation. | https://oss-xxx.hangzhou.com/test.pdf |
| libraryId | string | Yes | The document library ID. | sjdhbcsj |
Response parameters
| Name | Type | Description | Example |
|---|---|---|---|
| object | The response result. | ||
| cost | long | The elapsed time. | null |
| data | string | The returned data. | 1782981430906818562 |
| dataType | string | The data type. | null |
| errCode | string | The error code. | 0 |
| message | string | The error message. | ok |
| requestId | string | The request ID. | ff3fef67-48d9-4379-a237-9ba8143fe739 |
| success | boolean | Indicates whether the operation is successful. | true |
| time | string | The timestamp. | 2024-04-24 11:54:34 |
Examples
Success response example
JSON format