From b72dd2635afb8cf83324a6affdba6f1377c5c3ab Mon Sep 17 00:00:00 2001 From: generall Date: Thu, 23 Jan 2025 23:24:38 +0100 Subject: [PATCH] function to get embeddings size --- qdrant_client/qdrant_fastembed.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/qdrant_client/qdrant_fastembed.py b/qdrant_client/qdrant_fastembed.py index 9c17d385..a2dc373e 100644 --- a/qdrant_client/qdrant_fastembed.py +++ b/qdrant_client/qdrant_fastembed.py @@ -437,6 +437,23 @@ def _validate_collection_info(self, collection_info: models.CollectionInfo) -> N modifier == models.Modifier.IDF ), f"{self.sparse_embedding_model_name} requires modifier IDF, current modifier is {modifier}" + def get_embedding_size( + self, + model_name: Optional[str] = None, + ) -> int: + """ + Get the size of the embeddings produced by the specified model. + + Args: + model_name: optional, the name of the model to get the embedding size for. If None, the default model will be used. + + Returns: + int: the size of the embeddings produced by the model. + """ + model_name = model_name or self.embedding_model_name + embeddings_size, _ = self._get_model_params(model_name=model_name) + return embeddings_size + def get_fastembed_vector_params( self, on_disk: Optional[bool] = None,