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 <chester.curme@gmail.com>
This commit is contained in:
Mohammad Mohtashim 2024-11-26 23:26:56 +05:00 committed by GitHub
parent 7d95a10ada
commit 06fafc6651
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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."