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 workspace ID: Retrieve the workspace identifier.
Try it now
Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.
RAM authorization
The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:
-
Action: The actions can be used in the
Actionelement of RAM permission policy statements to grant permissions to perform the operation. - API: The API that you can call to perform the action.
- Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.
-
Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.
- For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the
Resourceelement of the policy. - For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the
Resourceelement of the policy.
- For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the
- Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.
- Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.
Action | Access level | Resource type | Condition key | Dependent action |
|---|---|---|---|---|
dianjin:CreateLibrary | create | *All Resource
| None | None |
Request syntax
Path Parameters
Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| workspaceId | string | Yes | Workspace ID | llm-ik******RVYCKzt |
Request parameters
Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| body | object | No | Request body | |
| description | string | Yes | Document library description | Describe the specific purpose of the document library |
| indexSetting | object | No | Index settings for the document library | |
| chunkStrategy | object | No | Chunking strategy | |
| docTreeSplit | boolean | No | Layout-based chunking | true |
| docTreeSplitSize | integer | No | Layout-based chunk size | 300 |
| enhanceGraph | boolean | No | Parse images in documents | true |
| enhanceTable | boolean | No | Parse tables in documents | true |
| overlap | integer | No | Chunk overlap length | 20 |
| sentenceSplit | boolean | No | Split by sentence | true |
| sentenceSplitSize | integer | No | Sentence-based chunk size | 300 |
| size | integer | No | Chunk size | 300 |
| split | boolean | No | Enable chunking | true |
| modelConfig | object | No | Model configuration | |
| temperature | number | No | Control the randomness and diversity of model responses. Higher values flatten the probability distribution over candidate tokens, increasing diversity. Lower values sharpen the distribution, increasing determinism. Valid range: [0, 2). Avoid 0. | 0.8 |
| topP | number | No | Probability threshold for nucleus sampling. For example, with a value of 0.8, only the smallest set of most likely tokens whose cumulative probability is at least 0.8 is used. Higher values increase randomness. Lower values increase determinism. | 0.8 |
| promptRoleStyle | string | No | Prompt role style. Specify a role and tone to guide response quality. Examples: Document analysis expert, friendly customer service agent, professional financial analyst. | You are an information processing expert: patient, friendly, and logically clear. |
| queryEnhancer | object | No | Query enhancement configuration | |
| enableFollowUp | boolean | No | Rewrite queries using history | true |
| enableMultiQuery | boolean | No | Use Large Language Models (LLMs) to decompose queries | true |
| enableOpenQa | boolean | No | Use LLMs to answer queries | true |
| enableQueryRewrite | boolean | No | Enable query rewriting | true |
| enableSession | boolean | No | Enable multi-turn conversations | true |
| localKnowledgeId | string | No | Document library ID for knowledge rewriting | xxxx |
| withDocumentReference | boolean | No | Include document references in responses | true |
| recallStrategy | object | No | Retrieval strategy | |
| documentRankType | string | No | Merge and sort policy 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. Only ElasticSearch is supported. Valid values:
| ElasticSearch |
| enable | boolean | No | Enable text indexing Valid values:
| true |
| indexAnalyzer | string | No | Text index analyzer: Standard, IkMaxWord, or IkSmart Valid values:
| Standard |
| rankThreshold | number | No | Text index ranking threshold | 0.5 |
| searchAnalyzer | string | No | Text index search analyzer: Standard, IkMaxWord, or IkSmart Valid values:
| Standard |
| topK | integer | No | Number of final text index results | 50 |
| vectorIndexSetting | object | No | Vector index settings | |
| category | string | No | Vector index source. Only ADB is supported. Valid values:
| ADB |
| embeddingType | string | No | Text embedding type for vector indexing Valid values:
| DashScope |
| enable | boolean | No | Enable vector indexing Valid values:
| true |
| rankThreshold | number | No | Vector index ranking threshold | 0.5 |
| topK | integer | No | Number of final vector index results | 50 |
| libraryName | string | Yes | Document library name | Financial knowledge document library |
Response elements
Element | Type | Description | Example |
|---|---|---|---|
object | ResultCode<string> | ||
| cost | integer | Processing time in milliseconds | 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 | Operation success status | true |
| time | string | Timestamp | null |
Examples
Success response
JSON format