Skip to content

Commit f9ddcb5

Browse files
authored
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 <>
1 parent fa6826e commit f9ddcb5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

langchain/vectorstores/qdrant.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,11 @@ def from_texts(
182182

183183
qdrant_host = get_from_dict_or_env(kwargs, "host", "QDRANT_HOST")
184184
kwargs.pop("host")
185+
collection_name = kwargs.pop("collection_name", uuid.uuid4().hex)
186+
distance_func = kwargs.pop("distance_func", "Cosine").upper()
187+
185188
client = qdrant_client.QdrantClient(host=qdrant_host, **kwargs)
186189

187-
collection_name = kwargs.get("collection_name", uuid.uuid4().hex)
188-
distance_func = kwargs.pop("distance_func", "Cosine").upper()
189190
client.recreate_collection(
190191
collection_name=collection_name,
191192
vectors_config=rest.VectorParams(

0 commit comments

Comments
 (0)