mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-04 18:53:02 +00:00
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.
This commit is contained in:
parent
b69b551c8b
commit
97c3544a1e
@ -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…
Reference in New Issue
Block a user