Hotfix: Qdrant.from_text embeddings (#713)

I'm providing a hotfix for Qdrant integration. Calculating a single
embedding to obtain the vector size was great idea. However, that change
introduced a bug trying to put only that single embedding into the
database. It's fixed. Right now all the embeddings will be pushed to
Qdrant.
harrison/document-split
Kacper Łukawski 1 year ago committed by GitHub
parent b69b551c8b
commit 97c3544a1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -177,8 +177,8 @@ class Qdrant(VectorStore):
from qdrant_client.http import models as rest
# Just do a single quick embedding to get vector size
embeddings = embedding.embed_documents(texts[:1])
vector_size = len(embeddings[0])
partial_embeddings = embedding.embed_documents(texts[:1])
vector_size = len(partial_embeddings[0])
qdrant_host = get_from_dict_or_env(kwargs, "host", "QDRANT_HOST")
kwargs.pop("host")
@ -194,6 +194,9 @@ class Qdrant(VectorStore):
),
)
# Now generate the embeddings for all the texts
embeddings = embedding.embed_documents(texts)
client.upsert(
collection_name=collection_name,
points=rest.Batch(

Loading…
Cancel
Save