接口定义
ListCollectionViews()
接口用于查询指定 AI 类 Database 中所有的 CollectionView。ListCollectionViews(ctx context.Context) (result *ListAICollectionViewsResult, err error)
请求示例
如下示例,查询数据库 go-sdk-test-ai-db 的集合视图配置信息。
var (ctx = context.Background()aiDatabase = "go-sdk-test-ai-db"collectionViewName = "go-sdk-test-ai-coll")db := client.AIDatabase(aiDatabase)coll, _ := db.ListCollectionViews(ctx)for _, col := range coll.CollectionViews{data, _ := json.Marshal(col)log.Printf("%+v", string(data))}
返回信息
{"databaseName": "go-sdk-test-ai-db","collectionViewName": "go-sdk-test-ai-coll","alias": null,"embedding": {"language": "zh","enableWordsEmbedding": true},"splitterPreprocess": {"appendTitleToChunk": true,"appendKeywordsToChunk": false},"indexedDocumentSets": 0,"totalDocumentSets": 0,"unIndexedDocumentSets": 0,"filterIndexes": [{"FieldName": "author_name","FieldType": "string","ElemType": "","IndexType": "filter"}, {"FieldName": "documentSetName","FieldType": "string","ElemType": "","IndexType": "filter"}, {"FieldName": "documentSetId","FieldType": "string","ElemType": "","IndexType": "primaryKey"}],"description": "test ai collectionView","createTime": "2023-12-20T17:48:03Z"}
参数 | 子参数 | 子参数 | 参数含义 |
databaseName | - | - | 显示 collectionView 所在的 AI 类 Database 名称。 |
collectionViewName | - | - | 显示 collectionView 的名称。 |
embedding | | language | 指定文件的语言类型,取值如下所示: zh:中文。 en:英文。 multi:多语言。 |
| | enableWordsEmbedding | 配置在检索时,是否开启词(Words)向量精排,并进行词向量化。 true:开启。 false:不开启。 |
alias | - | - | |
createTime | - | - | 显示 CollectionView 的创建时间。 |
description | - | - | 显示 CollectionView 的描述信息。 |
stats
| 文件处理的状态 |
indexedDocumentSets
| 已处理完成的文件的数量。 |
| |
totalDocumentSets
| 所有的文件的数量。 |
| |
unIndexedDocumentSets
| 未处理的文件数量。 |
splitterPreprocess
| 文件预处理策略 |
appendTitleToChunk
| 在对文件拆分时,配置是否将 Title 追加到切分后的段落后面一并 Embedding。取值如下所示: True:将段落 Title 追加到切分后的段落。 False:不追加。 |
| |
appendKeywordsToChunk
| 在对文件拆分时,配置是否将关键字 keywords 追加到切分后的段落一并 Embedding。取值如下所示: false:不追加。 true:将全文的 keywords 追加到切分后的段落。 |
Indexes
| 默认以 documentSetId 文件 ID 创建主键索引 | fieldName | 标识索引对象为 documentSetId 。 |
| | filedType | 显示该索引对象的数据类型,固定为 string 。 |
| | indexType | 该参数固定显示为 primaryKey 。 |
| 默认以 documentSetName 文件名创建 Filter 索引 | fieldName | 标识索引对象为文件名,固定为 documentSetName 。 |
| | filedType | 显示索引对象为文件名的数据类型,固定为 string 。 |
| | indexType | 显示索引对象为文件名的索引类型,固定为 filter 。在后续检索数据时,才能对该字段设置 Filter 条件表达式检索文件。 |
| 其他自定义需建立 Filter 索引的标量字段 | fieldName | 自定义扩展字段,例如:author、tags。 |
| | filedType | 显示自定义字段的数据类型。 |
| | indexType |