Skip to content

qdrant_client.get_fastembed_vector_params() with upload_collectionΒ #496

@uguraydrd

Description

@uguraydrd

Hello folks!

Firstly, I would like to run fastembed integration. I suppose there is a bug or problem or I am wrong. I am going to explain this problem.

Normally, you know we follow these steps for example if we want to give the vector size:

qdrant_client = QdrantClient("http://localhost:6333")
qdrant_client.set_model("BAAI/bge-small-en-v1.5")
qdrant_client.recreate_collection(
    collection_name="test",
    vectors_config=VectorParams(size=384, distance=Distance.COSINE),
)

We know there is no problem here.

But if we want the vector size to be retrieved dynamically based on the model we follow these steps as in documentation like:

qdrant_client = QdrantClient("http://localhost:6333")
qdrant_client.set_model("BAAI/bge-small-en-v1.5")
qdrant_client.recreate_collection(
    collection_name="test",
    vectors_config=qdrant_client.get_fastembed_vector_params()
)

unfortunately my vectors are not loaded into the collection. I do not get any error but my vectors are not loaded either.

We know vectors_config has two typehint like Union[types.VectorParams, Mapping[str, types.VectorParams]]. We also have a mapping. After calling qdrant_client.get_fastembed_vector_params() , it returns a dictionary for us to feed to vectors_config like this:

{
    "fast-bge-small-en-v1.5": models.VectorParams(
        size = embeddings_size,
        distance = distance,
        ...
    )
}

Finally,

I check the your dev codes. Based on my many tests and observations, I noticed if I do this there is no problem but this is not a solution, just an indication that it works if I do this:

qdrant_client = QdrantClient("http://localhost:6333")
qdrant_client.set_model("BAAI/bge-small-en-v1.5")
qdrant_client.recreate_collection(
    collection_name="test",
    vectors_config=qdrant_client.get_fastembed_vector_params()[self.client.get_vector_field_name()]
)

because if I do this 'vectors_config' is no longer a dictionary but a pydantic class and equals a value like below. It can then be verified directly by models.VectorParams.

VectorParams(size=384, distance=<Distance.COSINE: 'Cosine'>, ...)

What is your comment on this topic? Please let me know what is the right approach or solution?

Cheers!

--
Uguray

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions