From 3a0d9797c1e714974c1388ca2d9f2ed1cc055d8c Mon Sep 17 00:00:00 2001 From: Joan Antoni RE Date: Wed, 31 Jul 2024 13:13:52 +0200 Subject: [PATCH] Fix migration 24 adding a new migration 25 (#2362) --- ..._models_to_kbs.py => 0025_assign_models_to_kbs_v2.py} | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) rename nucliadb/src/migrations/{0024_assign_models_to_kbs.py => 0025_assign_models_to_kbs_v2.py} (92%) diff --git a/nucliadb/src/migrations/0024_assign_models_to_kbs.py b/nucliadb/src/migrations/0025_assign_models_to_kbs_v2.py similarity index 92% rename from nucliadb/src/migrations/0024_assign_models_to_kbs.py rename to nucliadb/src/migrations/0025_assign_models_to_kbs_v2.py index bb348cdfe7..8b3115858c 100644 --- a/nucliadb/src/migrations/0024_assign_models_to_kbs.py +++ b/nucliadb/src/migrations/0025_assign_models_to_kbs_v2.py @@ -18,7 +18,7 @@ # along with this program. If not, see . # -"""Migration #24 +"""Migration #25 (Fixed migration 24) Vectorsets are coming and we need to be ready at nucliadb. Vector index config shouldn't be stored anymore in the `Shards` protobuffer, we need to migrate to @@ -62,9 +62,10 @@ async def migrate_kb(context: ExecutionContext, kbid: str) -> None: return None vectorset_id = learning_config.semantic_model - learning_similarity = learning_config.semantic_vector_similarity - learning_vector_dimension = learning_config.semantic_vector_size - learning_matryoshka_dimensions = learning_config.semantic_matryoshka_dimensions or [] + learning_model_metadata = learning_config.into_semantic_model_metadata() + learning_similarity = learning_model_metadata.similarity_function + learning_vector_dimension = learning_model_metadata.vector_dimension + learning_matryoshka_dimensions = learning_model_metadata.matryoshka_dimensions learning_normalize_vectors = len(learning_matryoshka_dimensions) > 0 async with context.kv_driver.transaction(read_only=True) as txn: