From 06fafc6651eab7ef2106b7cffefc45c39e55fccc Mon Sep 17 00:00:00 2001 From: Mohammad Mohtashim <45242107+keenborder786@users.noreply.github.com> Date: Tue, 26 Nov 2024 23:26:56 +0500 Subject: [PATCH] Community: Marqo Index Setting GET Request Updated according to `2.x` API version while keep backward compatability for 1.5.x (#28342) - **Description:** `add_texts` was using `get_setting` for marqo client which was being used according to 1.5.x API version. However, this PR updates the `add_text` accounting for updated response payload for 2.x and later while maintaining backward compatibility. Plus I have verified this was the only place where marqo client was not accounting for updated API version. - **Issue:** #28323 --------- Co-authored-by: ccurme --- libs/community/langchain_community/vectorstores/marqo.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libs/community/langchain_community/vectorstores/marqo.py b/libs/community/langchain_community/vectorstores/marqo.py index a2331bc65d8..96b762662d7 100644 --- a/libs/community/langchain_community/vectorstores/marqo.py +++ b/libs/community/langchain_community/vectorstores/marqo.py @@ -109,9 +109,12 @@ class Marqo(VectorStore): List[str]: The list of ids that were added. """ - if self._client.index(self._index_name).get_settings()["index_defaults"][ - "treat_urls_and_pointers_as_images" - ]: + settings = self._client.index(self._index_name).get_settings() + if ( + "index_defaults" in settings + and settings["index_defaults"]["treat_urls_and_pointers_as_images"] + or settings.get("treat_urls_and_pointers_as_images") + ): raise ValueError( "Marqo.add_texts is disabled for multimodal indexes. To add documents " "with a multimodal index use the Python client for Marqo directly."