feat: support opensearch approximate k-NN (#5322)

This commit is contained in:
baojingyu 2024-06-19 12:44:33 +08:00 • committed by GitHub
commit d160d1ed02
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 793 additions and 4 deletions

View file

@ -327,6 +327,14 @@ def migrate_knowledge_vector_database():
"vector_store": {"class_prefix": collection_name}
}
dataset.index_struct = json.dumps(index_struct_dict)
elif vector_type == VectorType.OPENSEARCH:
dataset_id = dataset.id
collection_name = Dataset.gen_collection_name_by_id(dataset_id)
index_struct_dict = {
"type": VectorType.OPENSEARCH,
"vector_store": {"class_prefix": collection_name}
}
dataset.index_struct = json.dumps(index_struct_dict)
else:
raise ValueError(f"Vector store {vector_type} is not supported.")