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 <ec2-user@ip-172-31-28-97.ec2.internal>
This commit is contained in:
yunfeilu92 2023-04-25 01:43:41 +08:00 committed by GitHub
parent 46c9636012
commit 77235bbe43
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -536,4 +536,4 @@ class OpenSearchVectorSearch(VectorStore):
_bulk_ingest_embeddings( _bulk_ingest_embeddings(
client, index_name, embeddings, texts, metadatas, vector_field, text_field 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)