From d2adec38189004da15f708b6852de28d2113b9b9 Mon Sep 17 00:00:00 2001 From: Naveen Tatikonda Date: Wed, 2 Aug 2023 03:16:38 -0500 Subject: [PATCH] [Opensearch] : Fix the service validation in http_auth (#8609) ### Description OpenSearch supports validation using both Master Credentials (Username and password) and IAM. For Master Credentials users will not pass the argument `service` in `http_auth` and the existing code will break. To fix this, I have updated the condition to check if service attribute is present in http_auth before accessing it. ### Maintainers @baskaryan @navneet1v Signed-off-by: Naveen Tatikonda --- .../langchain/vectorstores/opensearch_vector_search.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/langchain/langchain/vectorstores/opensearch_vector_search.py b/libs/langchain/langchain/vectorstores/opensearch_vector_search.py index df76805852d..fe3cb45ad7a 100644 --- a/libs/langchain/langchain/vectorstores/opensearch_vector_search.py +++ b/libs/langchain/langchain/vectorstores/opensearch_vector_search.py @@ -85,7 +85,7 @@ def _is_aoss_enabled(http_auth: Any) -> bool: """Check if the service is http_auth is set as `aoss`.""" if ( http_auth is not None - and http_auth.service is not None + and hasattr(http_auth, "service") and http_auth.service == "aoss" ): return True