Creates a document library. A document library isolates document and index data. If your use case requires frequent natural language search by category, create multiple libraries to isolate different data types. You can customize vector and text indexes by format.
Operation description
Prerequisites
- You have activated Alibaba Cloud Model Studio and Tongyi Dianjin.
- Obtain the workspaceId: Obtain the workspace identifier.
Debug
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
Authorization information
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. Details are as follows:
- Action: the specific permission point.
- Access level: the access level of each action. Valid values: Write, Read, or List.
-
Resource type: the resource types that support authorization for the action. Details are as follows:
- For required resource types, an asterisk (*) is added as a prefix.
- For actions that do not support resource-level authorization,
All resourcesis used.
- Condition key: the condition keys defined by the cloud service itself.
- Related action: other permissions required to successfully perform the action. The caller must also have the permissions of the related actions for the operation to succeed.
| Action | Access level | Resource type | Condition key | Related action |
|---|---|---|---|---|
| dianjin:CreateLibrary | create | *All resources * |
| None |
Request syntax
Request parameters
| Name | Type | Required | Description | Example value |
|---|---|---|---|---|
| workspaceId | string | Yes | Business space ID | llm-ik******RVYCKzt |
| body | object | No | Request body. | |
| description | string | Yes | Description of the document library | Describe the specific purpose of the document library |
| indexSetting | object | No | Index settings of the document library | |
| chunkStrategy | object | No | Chunking strategy | |
| docTreeSplit | boolean | No | Layout-based splitting | true |
| docTreeSplitSize | integer | No | Layout-based split size | 300 |
| enhanceGraph | boolean | No | Whether to parse image content in documents | true |
| enhanceTable | boolean | No | Whether to parse table content in documents | true |
| overlap | integer | No | Chunk overlap length | 20 |
| sentenceSplit | boolean | No | Split by sentence | true |
| sentenceSplitSize | integer | No | Sentence-based split size | 300 |
| size | integer | No | Chunk size | 300 |
| split | boolean | No | Whether to split into chunks | true |
| modelConfig | object | No | Model configuration | |
| temperature | double | No | Controls the randomness and diversity of model responses. Specifically, the temperature value controls the degree of smoothing applied to the probability distribution over candidate tokens during text generation. A higher temperature value lowers the peak of the probability distribution, allowing more low-probability tokens to be selected and producing more diverse results. A lower temperature value sharpens the peak, making high-probability tokens more likely to be selected and producing more deterministic results. Valid range: [0, 2). A value of 0 is not recommended because it is meaningless. | 0.8 |
| topP | double | No | Probability threshold for nucleus sampling during generation. For example, with a value of 0.8, only the smallest set of the most likely tokens whose cumulative probability is greater than or equal to 0.8 is retained as the candidate set. Valid range: (0, 1.0). A higher value produces more random results, and a lower value produces more deterministic results. | 0.8 |
| promptRoleStyle | string | No | Prompt role style. By specifying a role and describing the tone and style, you can control the quality of the final responses. Examples: document analysis expert, gentle customer service agent, professional financial industry analyst. | You are an information processing expert: patient, friendly, and logically clear. |
| queryEnhancer | object | No | Query enhancement configuration | |
| enableFollowUp | boolean | No | Whether to rewrite questions based on the history | true |
| enableMultiQuery | boolean | No | Whether to use LLM knowledge to decompose questions | true |
| enableOpenQa | boolean | No | Whether to use LLM knowledge to answer questions | true |
| enableQueryRewrite | boolean | No | Whether to use question rewriting | true |
| enableSession | boolean | No | Whether to enable multi-turn conversations | true |
| localKnowledgeId | string | No | Document library ID used for knowledge rewriting | xxxx |
| withDocumentReference | boolean | No | Whether to include document references | true |
| recallStrategy | object | No | Recall strategy | |
| documentRankType | string | No | Merge & sort strategy Valid values:
| model |
| limit | integer | No | Number of results from two-way merge and summarization | 20 |
| textIndexSetting | object | No | Text index configuration | |
| category | string | No | Text index type. Currently, only ElasticSearch is supported. | ElasticSearch |
| enable | boolean | No | Whether to enable the text index. Valid values:
| true |
| indexAnalyzer | string | No | Index analyzer of the text index: (Standard, IkMaxWord, IkSmart) | Standard |
| rankThreshold | double | No | Text index ranking threshold | 0.5 |
| searchAnalyzer | string | No | Search analyzer of the text index: (Standard, IkMaxWord, IkSmart) | Standard |
| topK | integer | No | Number of final text index summary results | 50 |
| vectorIndexSetting | object | No | Vector index settings | |
| category | string | No | Vector index source: only ADB is currently supported | ADB |
| embeddingType | string | No | Text Embedding type of the vector index Valid values:
| DashScope |
| enable | boolean | No | Whether to enable Valid values:
| true |
| rankThreshold | double | No | Vector index ranking threshold | 0.5 |
| topK | integer | No | Number of final vector index summary results | 50 |
| libraryName | string | Yes | Name of the document library | Financial knowledge document library |
Response parameters
| Name | Type | Description | Example value |
|---|---|---|---|
| object | ResultCode | ||
| cost | long | Processing time | 300 |
| data | string | Response data | a1b2c3 |
| dataType | string | Data type | null |
| errCode | string | Error code | 0 |
| message | string | Error message | Success |
| requestId | string | Request ID | xxxx-xxxx-xxxx-xxxx |
| success | boolean | Whether the operation is successful | true |
| time | string | Timestamp | null |
Examples
Success response
JSON format