Skip to main content

CreatePredefinedDocument

Creates document chunks based on your business scenarios.

Operation description

Before you use this API, make sure that you fully understand the billing methods and pricing of Tongyi Dianjin. Prerequisites
  • Alibaba Cloud Model Studio and Tongyi Dianjin are activated.
  • Obtain the workspaceId: Obtain the workspace identity.

Try it now

You can call this API directly in OpenAPI Explorer, which saves you the trouble of calculating signatures. After a successful call, OpenAPI Explorer can automatically generate SDK code examples. Try it now

RAM authorization

The following table describes the authorization information of the 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. Details:
  • 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 in the action. Details:
    • Required resource types are marked with an asterisk (*) prefix.
    • For actions that do not support resource-level authorization, All resources is used.
  • Condition key: the condition keys defined by the cloud service.
  • Dependent action: the other permissions required to successfully run the action. The operator must have the permissions of all dependent actions for the action to succeed.
ActionAccess levelResource typeCondition keyDependent action
dianjin:CreatePredefinedDocumentcreate
*All resources
*
    None
None

Request syntax

POST /{workspaceId}/api/library/document/createPredefinedDocument HTTP/1.1

Request parameters

ParameterTypeRequiredDescriptionExample
workspaceIdstringYes

Path parameter. The workspace ID.

llm-xxxxx
bodyobjectNo

The request body.

chunksarray<object>No

A list of document chunks.

ChunkobjectNo
chunkMetaobjectNo

The metadata of the document chunk.

{"a": "1"}
chunkOrderintegerNo

The order. This parameter is optional.

1
chunkTextstringNo

The text of the document chunk.

This is a test text
chunkTypestringNo

The type of the document chunk.

text
libraryIdstringNo

The ID of the document library.

a1b2c3
metadataobjectNo

The metadata.

{"a": "1"}
titlestringNo

The title of the document.

Test document

Response elements

ElementTypeDescriptionExample
object

ResultCode

costlong

The time consumed.

null
datastring

The returned data.

1782981430906818562
dataTypestring

The data type.

null
errCodestring

The error code.

0
messagestring

The error message.

ok
requestIdstring

The request ID.

0a06dfe617018288881568684e2937
successboolean

Indicates whether the request is successful.

true
timestring

The timestamp.

2024-04-24 11:54:34

Examples

Success response JSON format
{
  "cost": 0,
  "data": 1782981430906818600,
  "dataType": null,
  "errCode": 0,
  "message": "ok",
  "requestId": "0a06dfe617018288881568684e2937",
  "success": true,
  "time": "2024-04-24 11:54:34"
}

Error codes

For more error codes, visit Error Center.