mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-24 23:54:14 +00:00
Harrison/open search kwargs (#2040)
Signed-off-by: Marcel Coetzee <marcelcoetzee@tutanota.com> Co-authored-by: Marcel <34739235+Pipboyguy@users.noreply.github.com>
This commit is contained in:
parent
b26fa1935d
commit
0bbcc7815b
@ -35,11 +35,11 @@ def _import_bulk() -> Any:
|
||||
return bulk
|
||||
|
||||
|
||||
def _get_opensearch_client(opensearch_url: str) -> Any:
|
||||
def _get_opensearch_client(opensearch_url: str, **kwargs: Any) -> Any:
|
||||
"""Get OpenSearch client from the opensearch_url, otherwise raise error."""
|
||||
try:
|
||||
opensearch = _import_opensearch()
|
||||
client = opensearch(opensearch_url)
|
||||
client = opensearch(opensearch_url, **kwargs)
|
||||
except ValueError as e:
|
||||
raise ValueError(
|
||||
f"OpenSearch client string provided is not in proper format. "
|
||||
@ -218,12 +218,16 @@ class OpenSearchVectorSearch(VectorStore):
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self, opensearch_url: str, index_name: str, embedding_function: Embeddings
|
||||
self,
|
||||
opensearch_url: str,
|
||||
index_name: str,
|
||||
embedding_function: Embeddings,
|
||||
**kwargs: Any,
|
||||
):
|
||||
"""Initialize with necessary components."""
|
||||
self.embedding_function = embedding_function
|
||||
self.index_name = index_name
|
||||
self.client = _get_opensearch_client(opensearch_url)
|
||||
self.client = _get_opensearch_client(opensearch_url, **kwargs)
|
||||
|
||||
def add_texts(
|
||||
self,
|
||||
|
Loading…
Reference in New Issue
Block a user