From f9ddcb5705d479cf6d1f6b07c8ce312e563e9dd9 Mon Sep 17 00:00:00 2001 From: Francisco Ingham Date: Wed, 25 Jan 2023 14:39:50 -0300 Subject: [PATCH] Hotfix: distance_func and collection_name must not be in kwargs (#735) If `distance_func` and `collection_name` are in `kwargs` they are sent to the `QdrantClient` which results in an error being raised. Co-authored-by: Francisco Ingham <> --- langchain/vectorstores/qdrant.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/langchain/vectorstores/qdrant.py b/langchain/vectorstores/qdrant.py index bc40dc263f3..47531a8cf53 100644 --- a/langchain/vectorstores/qdrant.py +++ b/langchain/vectorstores/qdrant.py @@ -182,10 +182,11 @@ class Qdrant(VectorStore): qdrant_host = get_from_dict_or_env(kwargs, "host", "QDRANT_HOST") kwargs.pop("host") + collection_name = kwargs.pop("collection_name", uuid.uuid4().hex) + distance_func = kwargs.pop("distance_func", "Cosine").upper() + client = qdrant_client.QdrantClient(host=qdrant_host, **kwargs) - collection_name = kwargs.get("collection_name", uuid.uuid4().hex) - distance_func = kwargs.pop("distance_func", "Cosine").upper() client.recreate_collection( collection_name=collection_name, vectors_config=rest.VectorParams(