ALIYUN::Bailian::Index

Updated at:

ALIYUN::Bailian::Index is used to create an Alibaba Cloud Model Studio knowledge base.

Syntax

{
  "Type": "ALIYUN::Bailian::Index",
  "Properties": {
    "Name": String,
    "SourceType": String,
    "StructureType": String,
    "WorkspaceId": String,
    "ChunkMode": String,
    "CategoryIds": List,
    "ConnectId": String,
    "ChunkSize": Integer,
    "Description": String,
    "Database": String,
    "DocumentIds": List,
    "DenseSimilarityTopK": Integer,
    "EnableRewrite": Boolean,
    "EnableHeaders": Boolean,
    "EmbeddingModelName": String,
    "KnowledgeScene": String,
    "KnowledgeType": String,
    "MetaExtractColumns": List,
    "OverlapSize": Integer,
    "PipelineRetrieveRateLimitStrategy": String,
    "PipelineCommercialCu": Integer,
    "PipelineCommercialType": String,
    "RerankMode": String,
    "RerankModelName": String,
    "RerankInstruct": String,
    "RerankMinScore": Number,
    "SinkInstanceId": String,
    "SparseSimilarityTopK": Integer,
    "SinkRegion": String,
    "SinkType": String,
    "Separator": String,
    "TableIds": List,
    "Table": String
  }
}

Properties

Property

Type

Required

Editable

Description

Constraints

Name

String

Yes

Yes

The name of the knowledge base.

The name must be 1 to 20 characters in length. It can contain Chinese characters, English letters, digits, underscores (_), hyphens (-), periods (.), and colons (:).

SourceType

String

Yes

No

The type of the data source.

Valid values:

  • DATA_CENTER_CATEGORY: Imports files in the specified categories.

  • DATA_CENTER_FILE: Imports the specified files.

StructureType

String

Yes

No

The type of the knowledge base.

Valid values:

  • unstructured: A document retrieval or audio/video knowledge base.

  • structured: A data query or image question-answering knowledge base.

WorkspaceId

String

Yes

No

The workspace ID.

The knowledge base is created in the specified workspace.

CategoryIds

List

No

No

The IDs of the categories to import into the knowledge base.

Required when SourceType is DATA_CENTER_CATEGORY.

ChunkMode

String

No

No

The chunking strategy.

For more information, seeKnowledge base.

If this parameter is not specified, intelligent chunking is used. Valid values (multiple values cannot be specified at the same time):

  • length: Chunks content by length. Content is chunked strictly according to the specified ChunkSize and OverlapSize. If you do not specify these parameters, the default values are used (ChunkSize is 500 and OverlapSize is 100). Length-based chunking does not support Separator (it does not take effect even if specified).

  • page: Chunks content by page. If ChunkSize is specified, it is considered during chunking (the default value of 500 is used if it is not specified). Page-based chunking does not support OverlapSize or Separator (they do not take effect even if specified).

  • h1: Chunks content by first-level headings. If ChunkSize is specified, it is considered during chunking (the default value of 500 is used if it is not specified). First-level-heading chunking does not support OverlapSize or Separator (they do not take effect even if specified).

  • h2: Chunks content by second-level headings. If ChunkSize is specified, it is considered during chunking (the default value of 500 is used if it is not specified). Second-level-heading chunking does not support OverlapSize or Separator (they do not take effect even if specified).

  • regex: Chunks content by regular expression. Separator parameter must be specified in this case. If ChunkSize is specified, it is considered during chunking (the default value of 500 is used if it is not specified). Regular-expression chunking does not support OverlapSize (it does not take effect even if specified).

ChunkSize

Integer

No

No

The chunk size, which is the maximum number of characters in each text chunk.

Valid values: [1-6000]. Default value: 500. If ChunkSize is less than 100, OverlapSize must be set.

ConnectId

String

No

No

The connection ID.

You can obtain this value from the data connector card on the Data Connections page. ConnectId replaces the datasourceCode parameter, which is no longer used. You must also specify Table when you create a data-query knowledge base.

Database

String

No

No

The database name of the structured knowledge base.

None.

DenseSimilarityTopK

Integer

No

Yes

The number of most similar text chunks to retrieve by vector similarity (top K).

Valid values: [0-100].

Default value: 100.

The sum of DenseSimilarityTopK and SparseSimilarityTopK must be less than or equal to 200. This parameter is supported only in UpdateIndex, not in CreateIndex.

Description

String

No

Yes

The description of the knowledge base.

The description must be 0 to 1,000 characters in length.

DocumentIds

List

No

No

The IDs of the documents to import into the knowledge base.

Required when SourceType is DATA_CENTER_FILE.

EmbeddingModelName

String

No

No

The embedding model used by the knowledge base.

The embedding model converts the original input prompt and knowledge text into numerical vectors so that their similarity can be compared.

Compared with text-embedding-v3, text-embedding-v4 provides comprehensive improvements in language support, code snippet vectorization, and vector dimension selection, and is suitable for most scenarios. Specify text-embedding-v4 explicitly to use these improvements. For more information, seeText and multimodal embedding.

Valid values:

  • text-embedding-v4

  • text-embedding-v3 (default)

EnableHeaders

Boolean

No

No

Specifies whether to enable headings for document parsing.

Default value: false.

EnableRewrite

Boolean

No

No

Specifies whether to enable multi-turn conversation rewriting.

Default value: true.

KnowledgeScene

String

No

No

The knowledge base scenario.

The value of this parameter depends entirely on the value of KnowledgeType.

Valid values and dependencies:

  • When KnowledgeType is document, KnowledgeScene can be set to basic_document_qa (basic document question answering), visual_document_qa (illustrated responses), lite_document_qa (fast question answering), or visual_perception_qa (visual understanding).

  • When KnowledgeType is table, KnowledgeScene is set to basic_table_qa (basic table question answering).

  • When KnowledgeType is image, KnowledgeScene is set to image_qa (image question answering).

  • When KnowledgeType is multimedia, KnowledgeScene is set to basic_multimedia_qa (audio/video search question answering).

KnowledgeType

String

No

No

The knowledge base type category.

The value of this parameter must match the selected StructureType and determines the available values of KnowledgeScene.

Valid values:

  • document: Document search. Use with structureType: unstructured.

  • table: Data query. Use with structureType: structured.

  • image: Image question answering. Use with structureType: structured.

  • multimedia: Multimedia search. Use with structureType: unstructured.

MetaExtractColumns

List

No

No

The metadata extraction configuration.

For more information, see MetaExtractColumns properties.

OverlapSize

Integer

No

No

The overlap size, which is the number of characters that overlap between adjacent text chunks.

Valid values: [0-1024]. Default value: 100.

The value must be less than ChunkSize.

PipelineCommercialCu

Integer

No

Yes

The number of RCUs in the Enterprise edition.

This parameter is required only when PipelineCommercialType is enterprise.

Valid values: [1-200].

PipelineCommercialType

String

No

Yes

The knowledge base edition type.

Valid values:

  • standard (default): Standard edition.

  • enterprise: Enterprise edition.

PipelineRetrieveRateLimitStrategy

String

No

No

The retrieval rate-limiting strategy for the Enterprise edition.

Default value: downgrade.

RerankInstruct

String

No

No

The custom reranking instruction.

Required when RerankMode is custom.

RerankMinScore

Number

No

Yes

The similarity threshold.

Only text chunks whose similarity score exceeds this value are recalled.

Valid values: [0.01-1.00].

Default value: 0.01.

RerankMode

String

No

No

The reranking mode.

Valid values:

  • qa: Question-answering scenario (default).

  • similar: Similarity scenario.

  • custom: Custom reranking instruction. You must specify RerankInstruct.

RerankModelName

String

No

No

The reranking model used by the knowledge base.

The reranking model is a scoring system outside the knowledge base.It calculates the similarity score between the user question and each text chunk in the knowledge base, sorts the text chunks in descending order, and returns the top K text chunks with the highest scores.

Default value: qwen3-rerank. Valid values:

  • qwen3-rerank-hybrid

  • qwen3-rerank (default)

  • gte-rerank-hybrid

  • gte-rerank

Separator

String

No

No

The chunk separator.

This parameter takes effect only when ChunkMode is regex.

SinkInstanceId

String

No

No

The vector storage instance ID.

Required when SinkType is ADB.

SinkRegion

String

No

No

The region to which the vector storage instance belongs.

Required when SinkType is ADB.

SinkType

String

No

No

The vector storage type.

For more information, seeKnowledge base.

Valid values:

  • BUILT_IN: Hosts vector data on the Alibaba Cloud Model Studio platform.

  • ADB: AnalyticDB for PostgreSQL database. (Recommended) Select ADB to use advanced features such as database management, auditing, and monitoring.

SparseSimilarityTopK

Integer

No

Yes

The number of text chunks to retrieve by exact keyword matching (top K).

Valid values: [0-100].

Default value: 100.

The sum of DenseSimilarityTopK and SparseSimilarityTopK must be less than or equal to 200. This parameter is supported only in UpdateIndex, not in CreateIndex.

Table

String

No

No

The table name of the structured knowledge base.

None.

TableIds

List

No

No

The IDs of the tables to import into the knowledge base.

None.

MetaExtractColumns syntax

"MetaExtractColumns": [
  {
    "EnableLlm": Boolean,
    "Desc": String,
    "Type": String,
    "Value": String,
    "EnableSearch": Boolean,
    "Key": String
  }
]

MetaExtractColumns properties

Property

Type

Required

Editable

Description

Constraints

Key

String

Yes

No

The metadata field name.

The name must be 1 to 50 characters in length, and can contain only letters and underscores.

Type

String

Yes

No

The extraction method for the metadata field.

Valid values:

  • constant

  • variable

  • custom_prompt: Large language model.

  • regular: Regular expression.

  • keywords: Keyword search.

Desc

String

No

No

The description of the metadata field.

The description must be 0 to 1,000 characters in length.

EnableLlm

Boolean

No

No

Specifies whether the metadata field participates in model response generation.

None.

EnableSearch

Boolean

No

No

Specifies whether the metadata field participates in knowledge base retrieval.

None.

Value

String

No

No

The value of the metadata field.

None.

Return values

Fn::GetAtt

  • Id: The unique ID of the knowledge base index.

Examples

Scenario 1: Create a knowledge base index

ROSTemplateFormatVersion: '2015-09-01'
Description:
  zh-cn: 在百炼平台创建一个简单的非结构化知识库索引,使用内置向量存储,从数据中心文件导入。
  en: Create a simple unstructured knowledge base index on Bailian platform with built-in vector storage, importing from data center files.
Parameters:
  WorkspaceId:
    Type: String
    Label:
      zh-cn: 工作空间ID
      en: Workspace ID
    Description:
      zh-cn: 百炼平台的工作空间ID,知识库将创建在此工作空间下。
      en: The workspace ID of the Bailian platform. The knowledge base will be created in this workspace.
  IndexName:
    Type: String
    Label:
      zh-cn: 知识库名称
      en: Index Name
    Description:
      zh-cn: 知识库名称,1-20个字符,支持中英文、数字、下划线、短划线、句号和冒号。
      en: Knowledge base name, 1-20 characters. Supports Chinese, English, numbers, underscores, hyphens, periods and colons.
    MinLength: 1
    MaxLength: 20
    Default: my-knowledge-base
  DocumentIds:
    Type: CommaDelimitedList
    Label:
      zh-cn: 文档ID列表
      en: Document IDs
    Description:
      zh-cn: 数据中心中已上传的文件ID列表,用于导入到知识库。
      en: List of file IDs already uploaded in the data center, to be imported into the knowledge base.
Resources:
  Index:
    Type: ALIYUN::Bailian::Index
    Properties:
      WorkspaceId:
        Ref: WorkspaceId
      Name:
        Ref: IndexName
      SourceType: DATA_CENTER_FILE
      StructureType: unstructured
      DocumentIds:
        Ref: DocumentIds
      SinkType: BUILT_IN
      Description:
        Ref: ALIYUN::StackName
Outputs:
  IndexId:
    Description:
      zh-cn: 知识库索引ID。
      en: Knowledge base index ID.
    Label:
      zh-cn: 知识库索引ID
      en: Index ID
    Value:
      Fn::GetAtt:
        - Index
        - Id
Metadata:
  ALIYUN::ROS::Interface:
    ParameterGroups:
      - Parameters:
          - WorkspaceId
          - IndexName
          - DocumentIds
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": {
    "zh-cn": "在百炼平台创建一个简单的非结构化知识库索引,使用内置向量存储,从数据中心文件导入。",
    "en": "Create a simple unstructured knowledge base index on Bailian platform with built-in vector storage, importing from data center files."
  },
  "Parameters": {
    "WorkspaceId": {
      "Type": "String",
      "Label": {
        "zh-cn": "工作空间ID",
        "en": "Workspace ID"
      },
      "Description": {
        "zh-cn": "百炼平台的工作空间ID,知识库将创建在此工作空间下。",
        "en": "The workspace ID of the Bailian platform. The knowledge base will be created in this workspace."
      }
    },
    "IndexName": {
      "Type": "String",
      "Label": {
        "zh-cn": "知识库名称",
        "en": "Index Name"
      },
      "Description": {
        "zh-cn": "知识库名称,1-20个字符,支持中英文、数字、下划线、短划线、句号和冒号。",
        "en": "Knowledge base name, 1-20 characters. Supports Chinese, English, numbers, underscores, hyphens, periods and colons."
      },
      "MinLength": 1,
      "MaxLength": 20,
      "Default": "my-knowledge-base"
    },
    "DocumentIds": {
      "Type": "CommaDelimitedList",
      "Label": {
        "zh-cn": "文档ID列表",
        "en": "Document IDs"
      },
      "Description": {
        "zh-cn": "数据中心中已上传的文件ID列表,用于导入到知识库。",
        "en": "List of file IDs already uploaded in the data center, to be imported into the knowledge base."
      }
    }
  },
  "Resources": {
    "Index": {
      "Type": "ALIYUN::Bailian::Index",
      "Properties": {
        "WorkspaceId": {
          "Ref": "WorkspaceId"
        },
        "Name": {
          "Ref": "IndexName"
        },
        "SourceType": "DATA_CENTER_FILE",
        "StructureType": "unstructured",
        "DocumentIds": {
          "Ref": "DocumentIds"
        },
        "SinkType": "BUILT_IN",
        "Description": {
          "Ref": "ALIYUN::StackName"
        }
      }
    }
  },
  "Outputs": {
    "IndexId": {
      "Description": {
        "zh-cn": "知识库索引ID。",
        "en": "Knowledge base index ID."
      },
      "Label": {
        "zh-cn": "知识库索引ID",
        "en": "Index ID"
      },
      "Value": {
        "Fn::GetAtt": [
          "Index",
          "Id"
        ]
      }
    }
  },
  "Metadata": {
    "ALIYUN::ROS::Interface": {
      "ParameterGroups": [
        {
          "Parameters": [
            "WorkspaceId",
            "IndexName",
            "DocumentIds"
          ]
        }
      ]
    }
  }
}

Scenario 2: Create a knowledge base index and configure a custom strategy and API key

ROSTemplateFormatVersion: '2015-09-01'
Description:
  zh-cn: 在百炼平台创建知识库索引并配置自定义切分策略、Embedding模型、Rerank模型和元数据提取,同时创建API Key用于访问。
  en: Create a knowledge base index on Bailian platform with custom chunking strategy, embedding model, rerank model, and metadata extraction, along with an API Key for access.
Parameters:
  WorkspaceId:
    Type: String
    Label:
      zh-cn: 工作空间ID
      en: Workspace ID
    Description:
      zh-cn: 百炼平台的工作空间ID,知识库将创建在此工作空间下。
      en: The workspace ID of the Bailian platform. The knowledge base will be created in this workspace.
  IndexName:
    Type: String
    Label:
      zh-cn: 知识库名称
      en: Index Name
    Description:
      zh-cn: 知识库名称,1-20个字符。
      en: Knowledge base name, 1-20 characters.
    MinLength: 1
    MaxLength: 20
    Default: custom-kb
  CategoryIds:
    Type: CommaDelimitedList
    Label:
      zh-cn: 类目ID列表
      en: Category IDs
    Description:
      zh-cn: 数据中心中的类目ID列表,将导入该类目下的所有文件。
      en: List of category IDs in the data center. All files under these categories will be imported.
  EmbeddingModelName:
    Type: String
    Label:
      zh-cn: Embedding模型
      en: Embedding Model
    Description:
      zh-cn: 知识库使用的Embedding模型。
      en: The embedding model used by the knowledge base.
    AllowedValues:
      - text-embedding-v3
      - text-embedding-v4
    Default: text-embedding-v3
  RerankModelName:
    Type: String
    Label:
      zh-cn: Rerank模型
      en: Rerank Model
    Description:
      zh-cn: 知识库使用的Rerank模型。
      en: The rerank model used by the knowledge base.
    AllowedValues:
      - qwen3-rerank
      - qwen3-rerank-hybrid
      - gte-rerank
      - gte-rerank-hybrid
    Default: qwen3-rerank
  ChunkSize:
    Type: Number
    Label:
      zh-cn: 切分块大小
      en: Chunk Size
    Description:
      zh-cn: 文本切片的最大字符数,范围1-6000。
      en: Maximum number of characters per text chunk, range 1-6000.
    Default: 500
    MinValue: 1
    MaxValue: 6000
  OverlapSize:
    Type: Number
    Label:
      zh-cn: 重叠大小
      en: Overlap Size
    Description:
      zh-cn: 相邻文本切片之间的重叠字符数,范围0-1024,必须小于切分块大小。
      en: Number of overlapping characters between adjacent text chunks, range 0-1024. Must be less than ChunkSize.
    Default: 100
    MinValue: 0
    MaxValue: 1024
Resources:
  Index:
    Type: ALIYUN::Bailian::Index
    Properties:
      WorkspaceId:
        Ref: WorkspaceId
      Name:
        Ref: IndexName
      SourceType: DATA_CENTER_CATEGORY
      StructureType: unstructured
      CategoryIds:
        Ref: CategoryIds
      SinkType: BUILT_IN
      Description: Knowledge base with custom configuration
      EmbeddingModelName:
        Ref: EmbeddingModelName
      RerankModelName:
        Ref: RerankModelName
      RerankMode: qa
      ChunkSize:
        Ref: ChunkSize
      OverlapSize:
        Ref: OverlapSize
      ChunkMode: length
      EnableRewrite: true
      EnableHeaders: true
      MetaExtractColumns:
        - Key: doc_source
          Type: constant
          Value: data-center
          Desc: Document source
          EnableSearch: true
          EnableLlm: false
        - Key: doc_keywords
          Type: keywords
          Desc: Extracted keywords
          EnableSearch: true
          EnableLlm: true
  ApiKey:
    Type: ALIYUN::Bailian::ApiKey
    Properties:
      Description:
        Fn::Sub: API Key for ${IndexName}
Outputs:
  IndexId:
    Description:
      zh-cn: 知识库索引ID。
      en: Knowledge base index ID.
    Label:
      zh-cn: 知识库索引ID
      en: Index ID
    Value:
      Fn::GetAtt:
        - Index
        - Id
  ApiKeyValue:
    Description:
      zh-cn: API Key值,用于调用百炼服务。
      en: API Key value for calling Bailian service.
    Label:
      zh-cn: API Key
      en: API Key
    Value:
      Fn::GetAtt:
        - ApiKey
        - Key
  ApiKeyId:
    Description:
      zh-cn: API Key ID。
      en: API Key ID.
    Label:
      zh-cn: API Key ID
      en: API Key ID
    Value:
      Fn::GetAtt:
        - ApiKey
        - ApiKeyId
Metadata:
  ALIYUN::ROS::Interface:
    ParameterGroups:
      - Parameters:
          - WorkspaceId
          - IndexName
          - CategoryIds
      - Parameters:
          - EmbeddingModelName
          - RerankModelName
          - ChunkSize
          - OverlapSize
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": {
    "zh-cn": "在百炼平台创建知识库索引并配置自定义切分策略、Embedding模型、Rerank模型和元数据提取,同时创建API Key用于访问。",
    "en": "Create a knowledge base index on Bailian platform with custom chunking strategy, embedding model, rerank model, and metadata extraction, along with an API Key for access."
  },
  "Parameters": {
    "WorkspaceId": {
      "Type": "String",
      "Label": {
        "zh-cn": "工作空间ID",
        "en": "Workspace ID"
      },
      "Description": {
        "zh-cn": "百炼平台的工作空间ID,知识库将创建在此工作空间下。",
        "en": "The workspace ID of the Bailian platform. The knowledge base will be created in this workspace."
      }
    },
    "IndexName": {
      "Type": "String",
      "Label": {
        "zh-cn": "知识库名称",
        "en": "Index Name"
      },
      "Description": {
        "zh-cn": "知识库名称,1-20个字符。",
        "en": "Knowledge base name, 1-20 characters."
      },
      "MinLength": 1,
      "MaxLength": 20,
      "Default": "custom-kb"
    },
    "CategoryIds": {
      "Type": "CommaDelimitedList",
      "Label": {
        "zh-cn": "类目ID列表",
        "en": "Category IDs"
      },
      "Description": {
        "zh-cn": "数据中心中的类目ID列表,将导入该类目下的所有文件。",
        "en": "List of category IDs in the data center. All files under these categories will be imported."
      }
    },
    "EmbeddingModelName": {
      "Type": "String",
      "Label": {
        "zh-cn": "Embedding模型",
        "en": "Embedding Model"
      },
      "Description": {
        "zh-cn": "知识库使用的Embedding模型。",
        "en": "The embedding model used by the knowledge base."
      },
      "AllowedValues": [
        "text-embedding-v3",
        "text-embedding-v4"
      ],
      "Default": "text-embedding-v3"
    },
    "RerankModelName": {
      "Type": "String",
      "Label": {
        "zh-cn": "Rerank模型",
        "en": "Rerank Model"
      },
      "Description": {
        "zh-cn": "知识库使用的Rerank模型。",
        "en": "The rerank model used by the knowledge base."
      },
      "AllowedValues": [
        "qwen3-rerank",
        "qwen3-rerank-hybrid",
        "gte-rerank",
        "gte-rerank-hybrid"
      ],
      "Default": "qwen3-rerank"
    },
    "ChunkSize": {
      "Type": "Number",
      "Label": {
        "zh-cn": "切分块大小",
        "en": "Chunk Size"
      },
      "Description": {
        "zh-cn": "文本切片的最大字符数,范围1-6000。",
        "en": "Maximum number of characters per text chunk, range 1-6000."
      },
      "Default": 500,
      "MinValue": 1,
      "MaxValue": 6000
    },
    "OverlapSize": {
      "Type": "Number",
      "Label": {
        "zh-cn": "重叠大小",
        "en": "Overlap Size"
      },
      "Description": {
        "zh-cn": "相邻文本切片之间的重叠字符数,范围0-1024,必须小于切分块大小。",
        "en": "Number of overlapping characters between adjacent text chunks, range 0-1024. Must be less than ChunkSize."
      },
      "Default": 100,
      "MinValue": 0,
      "MaxValue": 1024
    }
  },
  "Resources": {
    "Index": {
      "Type": "ALIYUN::Bailian::Index",
      "Properties": {
        "WorkspaceId": {
          "Ref": "WorkspaceId"
        },
        "Name": {
          "Ref": "IndexName"
        },
        "SourceType": "DATA_CENTER_CATEGORY",
        "StructureType": "unstructured",
        "CategoryIds": {
          "Ref": "CategoryIds"
        },
        "SinkType": "BUILT_IN",
        "Description": "Knowledge base with custom configuration",
        "EmbeddingModelName": {
          "Ref": "EmbeddingModelName"
        },
        "RerankModelName": {
          "Ref": "RerankModelName"
        },
        "RerankMode": "qa",
        "ChunkSize": {
          "Ref": "ChunkSize"
        },
        "OverlapSize": {
          "Ref": "OverlapSize"
        },
        "ChunkMode": "length",
        "EnableRewrite": true,
        "EnableHeaders": true,
        "MetaExtractColumns": [
          {
            "Key": "doc_source",
            "Type": "constant",
            "Value": "data-center",
            "Desc": "Document source",
            "EnableSearch": true,
            "EnableLlm": false
          },
          {
            "Key": "doc_keywords",
            "Type": "keywords",
            "Desc": "Extracted keywords",
            "EnableSearch": true,
            "EnableLlm": true
          }
        ]
      }
    },
    "ApiKey": {
      "Type": "ALIYUN::Bailian::ApiKey",
      "Properties": {
        "Description": {
          "Fn::Sub": "API Key for ${IndexName}"
        }
      }
    }
  },
  "Outputs": {
    "IndexId": {
      "Description": {
        "zh-cn": "知识库索引ID。",
        "en": "Knowledge base index ID."
      },
      "Label": {
        "zh-cn": "知识库索引ID",
        "en": "Index ID"
      },
      "Value": {
        "Fn::GetAtt": [
          "Index",
          "Id"
        ]
      }
    },
    "ApiKeyValue": {
      "Description": {
        "zh-cn": "API Key值,用于调用百炼服务。",
        "en": "API Key value for calling Bailian service."
      },
      "Label": {
        "zh-cn": "API Key",
        "en": "API Key"
      },
      "Value": {
        "Fn::GetAtt": [
          "ApiKey",
          "Key"
        ]
      }
    },
    "ApiKeyId": {
      "Description": {
        "zh-cn": "API Key ID。",
        "en": "API Key ID."
      },
      "Label": {
        "zh-cn": "API Key ID",
        "en": "API Key ID"
      },
      "Value": {
        "Fn::GetAtt": [
          "ApiKey",
          "ApiKeyId"
        ]
      }
    }
  },
  "Metadata": {
    "ALIYUN::ROS::Interface": {
      "ParameterGroups": [
        {
          "Parameters": [
            "WorkspaceId",
            "IndexName",
            "CategoryIds"
          ]
        },
        {
          "Parameters": [
            "EmbeddingModelName",
            "RerankModelName",
            "ChunkSize",
            "OverlapSize"
          ]
        }
      ]
    }
  }
}

Scenario 3: Create an Enterprise knowledge base solution

ROSTemplateFormatVersion: '2015-09-01'
Description:
  zh-cn: 创建完整的企业级百炼知识库方案,包含ADB向量存储实例、企业级知识库索引(高级检索配置)、API Key访问控制(IP白名单),实现高可用知识库服务。
  en: Create a complete enterprise-level Bailian knowledge base solution including ADB vector storage instance, enterprise knowledge base index with advanced retrieval configuration, and API Key with IP whitelist access control.
Parameters:
  WorkspaceId:
    Type: String
    Label:
      zh-cn: 工作空间ID
      en: Workspace ID
    Description:
      zh-cn: 百炼平台的工作空间ID。
      en: The workspace ID of the Bailian platform.
  IndexName:
    Type: String
    Label:
      zh-cn: 知识库名称
      en: Index Name
    Description:
      zh-cn: 知识库名称,1-20个字符。
      en: Knowledge base name, 1-20 characters.
    MinLength: 1
    MaxLength: 20
    Default: enterprise-kb
  DocumentIds:
    Type: CommaDelimitedList
    Label:
      zh-cn: 文档ID列表
      en: Document IDs
    Description:
      zh-cn: 数据中心中已上传的文件ID列表。
      en: List of file IDs already uploaded in the data center.
  ZoneId:
    Type: String
    Label:
      zh-cn: 可用区
      en: Availability Zone
    Description:
      zh-cn: ADB实例所在的可用区。
      en: The availability zone for the ADB instance.
    AssociationProperty: ALIYUN::ECS::Instance::ZoneId
    AssociationPropertyMetadata:
      AutoSelectFirst: true
  VpcId:
    Type: String
    Label:
      zh-cn: VPC ID
      en: VPC ID
    Description:
      zh-cn: ADB实例所属的VPC。
      en: The VPC for the ADB instance.
    AssociationProperty: ALIYUN::ECS::VPC::VPCId
  VSwitchId:
    Type: String
    Label:
      zh-cn: 交换机ID
      en: VSwitch ID
    Description:
      zh-cn: ADB实例所属的交换机。
      en: The VSwitch for the ADB instance.
    AssociationProperty: ALIYUN::ECS::VSwitch::VSwitchId
    AssociationPropertyMetadata:
      VpcId: ${VpcId}
      ZoneId: ${ZoneId}
  DenseSimilarityTopK:
    Type: Number
    Label:
      zh-cn: 向量检索TopK
      en: Dense Similarity Top K
    Description:
      zh-cn: 通过向量相似度检索最相似的K个文本切片,范围0-100。
      en: Retrieve the K most similar text chunks by vector similarity, range 0-100.
    Default: 80
    MinValue: 0
    MaxValue: 100
  SparseSimilarityTopK:
    Type: Number
    Label:
      zh-cn: 关键词检索TopK
      en: Sparse Similarity Top K
    Description:
      zh-cn: 通过关键词精确匹配检索文本切片,范围0-100。DenseSimilarityTopK + SparseSimilarityTopK 必须 <= 200。
      en: Retrieve text chunks by exact keyword matching, range 0-100. DenseSimilarityTopK + SparseSimilarityTopK must be <= 200.
    Default: 60
    MinValue: 0
    MaxValue: 100
  RerankMinScore:
    Type: Number
    Label:
      zh-cn: 相似度阈值
      en: Rerank Min Score
    Description:
      zh-cn: 仅召回相似度分数超过该值的文本切片,范围0.01-1.00。
      en: Only recall text chunks with similarity score exceeding this value, range 0.01-1.00.
    Default: 0.2
  AllowedIpList:
    Type: CommaDelimitedList
    Label:
      zh-cn: API Key允许的IP白名单
      en: API Key Allowed IP List
    Description:
      zh-cn: 允许访问API的IP地址列表。
      en: List of IP addresses allowed to access the API.
    Default:
      - 0.0.0.0/0
Resources:
  ADBInstance:
    Type: ALIYUN::ADB::DBCluster
    Properties:
      ZoneId:
        Ref: ZoneId
      VPCId:
        Ref: VpcId
      VSwitchId:
        Ref: VSwitchId
      DBClusterDescription:
        Fn::Sub: Vector storage for ${IndexName}
      DBClusterClass: T8
      DBClusterCategory: Basic
      DBClusterVersion: '3.0'
      Mode: Reserved
      PayType: Postpaid
      DBNodeGroupCount: 1
      DBNodeStorage: 100
  Index:
    Type: ALIYUN::Bailian::Index
    DependsOn: ADBInstance
    Properties:
      WorkspaceId:
        Ref: WorkspaceId
      Name:
        Ref: IndexName
      SourceType: DATA_CENTER_FILE
      StructureType: unstructured
      DocumentIds:
        Ref: DocumentIds
      SinkType: ADB
      SinkInstanceId:
        Ref: ADBInstance
      SinkRegion:
        Ref: ALIYUN::Region
      Description: Enterprise knowledge base with ADB vector storage
      EmbeddingModelName: text-embedding-v3
      RerankModelName: qwen3-rerank
      RerankMode: custom
      RerankInstruct: Rank documents by relevance to the user query, prioritizing accuracy and completeness of information.
      RerankMinScore:
        Ref: RerankMinScore
      ChunkSize: 800
      OverlapSize: 150
      ChunkMode: length
      EnableRewrite: true
      EnableHeaders: true
      PipelineCommercialType: enterprise
      PipelineCommercialCu: 4
      DenseSimilarityTopK:
        Ref: DenseSimilarityTopK
      SparseSimilarityTopK:
        Ref: SparseSimilarityTopK
      MetaExtractColumns:
        - Key: doc_category
          Type: constant
          Value: enterprise-doc
          Desc: Document category
          EnableSearch: true
          EnableLlm: false
        - Key: doc_summary
          Type: custom_prompt
          Value: Please summarize the key points of this document in one sentence.
          Desc: AI-generated document summary
          EnableSearch: true
          EnableLlm: true
        - Key: doc_keywords
          Type: keywords
          Desc: Extracted keywords
          EnableSearch: true
          EnableLlm: true
  ApiKey:
    Type: ALIYUN::Bailian::ApiKey
    Properties:
      Description:
        Fn::Sub: API Key for ${IndexName}
      AuthSetModel:
        AuthSetMode: Custom
        AccessIps:
          Ref: AllowedIpList
Outputs:
  IndexId:
    Description:
      zh-cn: 知识库索引ID。
      en: Knowledge base index ID.
    Label:
      zh-cn: 知识库索引ID
      en: Index ID
    Value:
      Fn::GetAtt:
        - Index
        - Id
  ADBInstanceId:
    Description:
      zh-cn: ADB向量存储实例ID。
      en: ADB vector storage instance ID.
    Label:
      zh-cn: ADB实例ID
      en: ADB Instance ID
    Value:
      Ref: ADBInstance
  ApiKeyValue:
    Description:
      zh-cn: API Key值,用于调用百炼服务。
      en: API Key value for calling Bailian service.
    Label:
      zh-cn: API Key
      en: API Key
    Value:
      Fn::GetAtt:
        - ApiKey
        - Key
  ApiKeyId:
    Description:
      zh-cn: API Key ID。
      en: API Key ID.
    Label:
      zh-cn: API Key ID
      en: API Key ID
    Value:
      Fn::GetAtt:
        - ApiKey
        - ApiKeyId
Metadata:
  ALIYUN::ROS::Interface:
    ParameterGroups:
      - Parameters:
          - WorkspaceId
          - IndexName
          - DocumentIds
      - Parameters:
          - ZoneId
          - VpcId
          - VSwitchId
      - Parameters:
          - DenseSimilarityTopK
          - SparseSimilarityTopK
          - RerankMinScore
          - AllowedIpList
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": {
    "zh-cn": "创建完整的企业级百炼知识库方案,包含ADB向量存储实例、企业级知识库索引(高级检索配置)、API Key访问控制(IP白名单),实现高可用知识库服务。",
    "en": "Create a complete enterprise-level Bailian knowledge base solution including ADB vector storage instance, enterprise knowledge base index with advanced retrieval configuration, and API Key with IP whitelist access control."
  },
  "Parameters": {
    "WorkspaceId": {
      "Type": "String",
      "Label": {
        "zh-cn": "工作空间ID",
        "en": "Workspace ID"
      },
      "Description": {
        "zh-cn": "百炼平台的工作空间ID。",
        "en": "The workspace ID of the Bailian platform."
      }
    },
    "IndexName": {
      "Type": "String",
      "Label": {
        "zh-cn": "知识库名称",
        "en": "Index Name"
      },
      "Description": {
        "zh-cn": "知识库名称,1-20个字符。",
        "en": "Knowledge base name, 1-20 characters."
      },
      "MinLength": 1,
      "MaxLength": 20,
      "Default": "enterprise-kb"
    },
    "DocumentIds": {
      "Type": "CommaDelimitedList",
      "Label": {
        "zh-cn": "文档ID列表",
        "en": "Document IDs"
      },
      "Description": {
        "zh-cn": "数据中心中已上传的文件ID列表。",
        "en": "List of file IDs already uploaded in the data center."
      }
    },
    "ZoneId": {
      "Type": "String",
      "Label": {
        "zh-cn": "可用区",
        "en": "Availability Zone"
      },
      "Description": {
        "zh-cn": "ADB实例所在的可用区。",
        "en": "The availability zone for the ADB instance."
      },
      "AssociationProperty": "ALIYUN::ECS::Instance::ZoneId",
      "AssociationPropertyMetadata": {
        "AutoSelectFirst": true
      }
    },
    "VpcId": {
      "Type": "String",
      "Label": {
        "zh-cn": "VPC ID",
        "en": "VPC ID"
      },
      "Description": {
        "zh-cn": "ADB实例所属的VPC。",
        "en": "The VPC for the ADB instance."
      },
      "AssociationProperty": "ALIYUN::ECS::VPC::VPCId"
    },
    "VSwitchId": {
      "Type": "String",
      "Label": {
        "zh-cn": "交换机ID",
        "en": "VSwitch ID"
      },
      "Description": {
        "zh-cn": "ADB实例所属的交换机。",
        "en": "The VSwitch for the ADB instance."
      },
      "AssociationProperty": "ALIYUN::ECS::VSwitch::VSwitchId",
      "AssociationPropertyMetadata": {
        "VpcId": "${VpcId}",
        "ZoneId": "${ZoneId}"
      }
    },
    "DenseSimilarityTopK": {
      "Type": "Number",
      "Label": {
        "zh-cn": "向量检索TopK",
        "en": "Dense Similarity Top K"
      },
      "Description": {
        "zh-cn": "通过向量相似度检索最相似的K个文本切片,范围0-100。",
        "en": "Retrieve the K most similar text chunks by vector similarity, range 0-100."
      },
      "Default": 80,
      "MinValue": 0,
      "MaxValue": 100
    },
    "SparseSimilarityTopK": {
      "Type": "Number",
      "Label": {
        "zh-cn": "关键词检索TopK",
        "en": "Sparse Similarity Top K"
      },
      "Description": {
        "zh-cn": "通过关键词精确匹配检索文本切片,范围0-100。DenseSimilarityTopK + SparseSimilarityTopK 必须 <= 200。",
        "en": "Retrieve text chunks by exact keyword matching, range 0-100. DenseSimilarityTopK + SparseSimilarityTopK must be <= 200."
      },
      "Default": 60,
      "MinValue": 0,
      "MaxValue": 100
    },
    "RerankMinScore": {
      "Type": "Number",
      "Label": {
        "zh-cn": "相似度阈值",
        "en": "Rerank Min Score"
      },
      "Description": {
        "zh-cn": "仅召回相似度分数超过该值的文本切片,范围0.01-1.00。",
        "en": "Only recall text chunks with similarity score exceeding this value, range 0.01-1.00."
      },
      "Default": 0.2
    },
    "AllowedIpList": {
      "Type": "CommaDelimitedList",
      "Label": {
        "zh-cn": "API Key允许的IP白名单",
        "en": "API Key Allowed IP List"
      },
      "Description": {
        "zh-cn": "允许访问API的IP地址列表。",
        "en": "List of IP addresses allowed to access the API."
      },
      "Default": [
        "0.0.0.0/0"
      ]
    }
  },
  "Resources": {
    "ADBInstance": {
      "Type": "ALIYUN::ADB::DBCluster",
      "Properties": {
        "ZoneId": {
          "Ref": "ZoneId"
        },
        "VPCId": {
          "Ref": "VpcId"
        },
        "VSwitchId": {
          "Ref": "VSwitchId"
        },
        "DBClusterDescription": {
          "Fn::Sub": "Vector storage for ${IndexName}"
        },
        "DBClusterClass": "T8",
        "DBClusterCategory": "Basic",
        "DBClusterVersion": "3.0",
        "Mode": "Reserved",
        "PayType": "Postpaid",
        "DBNodeGroupCount": 1,
        "DBNodeStorage": 100
      }
    },
    "Index": {
      "Type": "ALIYUN::Bailian::Index",
      "DependsOn": "ADBInstance",
      "Properties": {
        "WorkspaceId": {
          "Ref": "WorkspaceId"
        },
        "Name": {
          "Ref": "IndexName"
        },
        "SourceType": "DATA_CENTER_FILE",
        "StructureType": "unstructured",
        "DocumentIds": {
          "Ref": "DocumentIds"
        },
        "SinkType": "ADB",
        "SinkInstanceId": {
          "Ref": "ADBInstance"
        },
        "SinkRegion": {
          "Ref": "ALIYUN::Region"
        },
        "Description": "Enterprise knowledge base with ADB vector storage",
        "EmbeddingModelName": "text-embedding-v3",
        "RerankModelName": "qwen3-rerank",
        "RerankMode": "custom",
        "RerankInstruct": "Rank documents by relevance to the user query, prioritizing accuracy and completeness of information.",
        "RerankMinScore": {
          "Ref": "RerankMinScore"
        },
        "ChunkSize": 800,
        "OverlapSize": 150,
        "ChunkMode": "length",
        "EnableRewrite": true,
        "EnableHeaders": true,
        "PipelineCommercialType": "enterprise",
        "PipelineCommercialCu": 4,
        "DenseSimilarityTopK": {
          "Ref": "DenseSimilarityTopK"
        },
        "SparseSimilarityTopK": {
          "Ref": "SparseSimilarityTopK"
        },
        "MetaExtractColumns": [
          {
            "Key": "doc_category",
            "Type": "constant",
            "Value": "enterprise-doc",
            "Desc": "Document category",
            "EnableSearch": true,
            "EnableLlm": false
          },
          {
            "Key": "doc_summary",
            "Type": "custom_prompt",
            "Value": "Please summarize the key points of this document in one sentence.",
            "Desc": "AI-generated document summary",
            "EnableSearch": true,
            "EnableLlm": true
          },
          {
            "Key": "doc_keywords",
            "Type": "keywords",
            "Desc": "Extracted keywords",
            "EnableSearch": true,
            "EnableLlm": true
          }
        ]
      }
    },
    "ApiKey": {
      "Type": "ALIYUN::Bailian::ApiKey",
      "Properties": {
        "Description": {
          "Fn::Sub": "API Key for ${IndexName}"
        },
        "AuthSetModel": {
          "AuthSetMode": "Custom",
          "AccessIps": {
            "Ref": "AllowedIpList"
          }
        }
      }
    }
  },
  "Outputs": {
    "IndexId": {
      "Description": {
        "zh-cn": "知识库索引ID。",
        "en": "Knowledge base index ID."
      },
      "Label": {
        "zh-cn": "知识库索引ID",
        "en": "Index ID"
      },
      "Value": {
        "Fn::GetAtt": [
          "Index",
          "Id"
        ]
      }
    },
    "ADBInstanceId": {
      "Description": {
        "zh-cn": "ADB向量存储实例ID。",
        "en": "ADB vector storage instance ID."
      },
      "Label": {
        "zh-cn": "ADB实例ID",
        "en": "ADB Instance ID"
      },
      "Value": {
        "Ref": "ADBInstance"
      }
    },
    "ApiKeyValue": {
      "Description": {
        "zh-cn": "API Key值,用于调用百炼服务。",
        "en": "API Key value for calling Bailian service."
      },
      "Label": {
        "zh-cn": "API Key",
        "en": "API Key"
      },
      "Value": {
        "Fn::GetAtt": [
          "ApiKey",
          "Key"
        ]
      }
    },
    "ApiKeyId": {
      "Description": {
        "zh-cn": "API Key ID。",
        "en": "API Key ID."
      },
      "Label": {
        "zh-cn": "API Key ID",
        "en": "API Key ID"
      },
      "Value": {
        "Fn::GetAtt": [
          "ApiKey",
          "ApiKeyId"
        ]
      }
    }
  },
  "Metadata": {
    "ALIYUN::ROS::Interface": {
      "ParameterGroups": [
        {
          "Parameters": [
            "WorkspaceId",
            "IndexName",
            "DocumentIds"
          ]
        },
        {
          "Parameters": [
            "ZoneId",
            "VpcId",
            "VSwitchId"
          ]
        },
        {
          "Parameters": [
            "DenseSimilarityTopK",
            "SparseSimilarityTopK",
            "RerankMinScore",
            "AllowedIpList"
          ]
        }
      ]
    }
  }
}