Harrison/opensearch vectorstore (#1907)

Co-authored-by: Mehmet Öner Yalçın <oneryalcin@gmail.com>
This commit is contained in:
Harrison Chase 2023-03-22 19:57:38 -07:00 committed by GitHub
parent ea142f6a32
commit eec9b1b306
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -363,7 +363,11 @@ class OpenSearchVectorSearch(VectorStore):
embeddings = embedding.embed_documents(texts)
_validate_embeddings_and_bulk_size(len(embeddings), bulk_size)
dim = len(embeddings[0])
index_name = uuid.uuid4().hex
# Get the index name from either from kwargs or ENV Variable
# before falling back to random generation
index_name = get_from_dict_or_env(
kwargs, "index_name", "OPENSEARCH_INDEX_NAME", default=uuid.uuid4().hex
)
is_appx_search = _get_kwargs_value(kwargs, "is_appx_search", True)
if is_appx_search:
engine = _get_kwargs_value(kwargs, "engine", "nmslib")