Skip to content

Commit 97c3544

Browse files
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.
1 parent b69b551 commit 97c3544

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

langchain/vectorstores/qdrant.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ def from_texts(
177177
from qdrant_client.http import models as rest
178178

179179
# Just do a single quick embedding to get vector size
180-
embeddings = embedding.embed_documents(texts[:1])
181-
vector_size = len(embeddings[0])
180+
partial_embeddings = embedding.embed_documents(texts[:1])
181+
vector_size = len(partial_embeddings[0])
182182

183183
qdrant_host = get_from_dict_or_env(kwargs, "host", "QDRANT_HOST")
184184
kwargs.pop("host")
@@ -194,6 +194,9 @@ def from_texts(
194194
),
195195
)
196196

197+
# Now generate the embeddings for all the texts
198+
embeddings = embedding.embed_documents(texts)
199+
197200
client.upsert(
198201
collection_name=collection_name,
199202
points=rest.Batch(

0 commit comments

Comments
 (0)