From 77235bbe43a58eb235bd8e997e4a7c1498dab8a2 Mon Sep 17 00:00:00 2001 From: yunfeilu92 <102935330+yunfeilu92@users.noreply.github.com> Date: Tue, 25 Apr 2023 01:43:41 +0800 Subject: [PATCH] propogate kwargs to cls in OpenSearchVectorSearch (#3416) kwargs shoud be passed into cls so that opensearch client can be properly initlized in __init__(). Otherwise logic like below will not work. as auth will not be passed into __init__ ```python docsearch = OpenSearchVectorSearch.from_documents(docs, embeddings, opensearch_url="http://localhost:9200") query = "What did the president say about Ketanji Brown Jackson" docs = docsearch.similarity_search(query) ``` Co-authored-by: EC2 Default User --- langchain/vectorstores/opensearch_vector_search.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/langchain/vectorstores/opensearch_vector_search.py b/langchain/vectorstores/opensearch_vector_search.py index b44857e2..de41863d 100644 --- a/langchain/vectorstores/opensearch_vector_search.py +++ b/langchain/vectorstores/opensearch_vector_search.py @@ -536,4 +536,4 @@ class OpenSearchVectorSearch(VectorStore): _bulk_ingest_embeddings( client, index_name, embeddings, texts, metadatas, vector_field, text_field ) - return cls(opensearch_url, index_name, embedding) + return cls(opensearch_url, index_name, embedding, **kwargs)