llama-index-vector-stores-opensearch 0.5.0__py3-none-any.whl → 0.5.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of llama-index-vector-stores-opensearch might be problematic. Click here for more details.
- llama_index/vector_stores/opensearch/base.py +24 -8
- {llama_index_vector_stores_opensearch-0.5.0.dist-info → llama_index_vector_stores_opensearch-0.5.2.dist-info}/METADATA +1 -1
- llama_index_vector_stores_opensearch-0.5.2.dist-info/RECORD +6 -0
- llama_index_vector_stores_opensearch-0.5.0.dist-info/RECORD +0 -6
- {llama_index_vector_stores_opensearch-0.5.0.dist-info → llama_index_vector_stores_opensearch-0.5.2.dist-info}/WHEEL +0 -0
|
@@ -4,8 +4,8 @@ import uuid
|
|
|
4
4
|
from datetime import datetime
|
|
5
5
|
from typing import Any, Dict, Iterable, List, Optional, Union, cast
|
|
6
6
|
|
|
7
|
+
from llama_index.core.async_utils import asyncio_run
|
|
7
8
|
from llama_index.core.bridge.pydantic import PrivateAttr
|
|
8
|
-
|
|
9
9
|
from llama_index.core.schema import BaseNode, MetadataMode, TextNode
|
|
10
10
|
from llama_index.core.vector_stores.types import (
|
|
11
11
|
FilterCondition,
|
|
@@ -123,14 +123,22 @@ class OpensearchVectorClient:
|
|
|
123
123
|
self._os_async_client = os_async_client or self._get_async_opensearch_client(
|
|
124
124
|
self._endpoint, **kwargs
|
|
125
125
|
)
|
|
126
|
-
self.
|
|
127
|
-
self._efficient_filtering_enabled = self._is_efficient_filtering_enabled(
|
|
128
|
-
self._os_version
|
|
129
|
-
)
|
|
126
|
+
self._efficient_filtering_enabled = self._is_efficient_filtering_enabled()
|
|
130
127
|
not_found_error = self._import_not_found_error()
|
|
131
128
|
|
|
132
129
|
try:
|
|
133
130
|
self._os_client.indices.get(index=self._index)
|
|
131
|
+
except TypeError:
|
|
132
|
+
# Probably using async so switch to async client
|
|
133
|
+
try:
|
|
134
|
+
asyncio_run(self._os_async_client.indices.get(index=self._index))
|
|
135
|
+
except not_found_error:
|
|
136
|
+
asyncio_run(
|
|
137
|
+
self._os_async_client.indices.create(
|
|
138
|
+
index=self._index, body=idx_conf
|
|
139
|
+
)
|
|
140
|
+
)
|
|
141
|
+
asyncio_run(self._os_async_client.indices.refresh(index=self._index))
|
|
134
142
|
except not_found_error:
|
|
135
143
|
self._os_client.indices.create(index=self._index, body=idx_conf)
|
|
136
144
|
self._os_client.indices.refresh(index=self._index)
|
|
@@ -617,10 +625,18 @@ class OpensearchVectorClient:
|
|
|
617
625
|
return True
|
|
618
626
|
return False
|
|
619
627
|
|
|
620
|
-
def _is_efficient_filtering_enabled(self
|
|
628
|
+
def _is_efficient_filtering_enabled(self) -> bool:
|
|
621
629
|
"""Check if kNN with efficient filtering is enabled."""
|
|
622
|
-
|
|
623
|
-
|
|
630
|
+
# Technically, AOSS supports efficient filtering,
|
|
631
|
+
# but we can't check the version number using .info(); AOSS doesn't support 'GET /'
|
|
632
|
+
# so we must skip and disable by default.
|
|
633
|
+
if self.is_aoss:
|
|
634
|
+
ef_enabled = False
|
|
635
|
+
else:
|
|
636
|
+
self._os_version = self._get_opensearch_version()
|
|
637
|
+
major, minor, patch = self._os_version.split(".")
|
|
638
|
+
ef_enabled = int(major) >= 2 and int(minor) >= 9
|
|
639
|
+
return ef_enabled
|
|
624
640
|
|
|
625
641
|
def index_results(self, nodes: List[BaseNode], **kwargs: Any) -> List[str]:
|
|
626
642
|
"""Store results in the index."""
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
llama_index/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
llama_index/vector_stores/opensearch/__init__.py,sha256=U1_XAkZb6zcskOk4s10NB8Tjs9AZRGdRQLzOGpbWdBA,176
|
|
3
|
+
llama_index/vector_stores/opensearch/base.py,sha256=r6Ru-FjOrlLGo5klJnJxNdhz8F5SpVbRQr6ic8d_o70,37951
|
|
4
|
+
llama_index_vector_stores_opensearch-0.5.2.dist-info/METADATA,sha256=liN4ebro3xeiq7is5dpYP29gEOQYeUVes5ZjWrnSWZg,726
|
|
5
|
+
llama_index_vector_stores_opensearch-0.5.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
6
|
+
llama_index_vector_stores_opensearch-0.5.2.dist-info/RECORD,,
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
llama_index/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
llama_index/vector_stores/opensearch/__init__.py,sha256=U1_XAkZb6zcskOk4s10NB8Tjs9AZRGdRQLzOGpbWdBA,176
|
|
3
|
-
llama_index/vector_stores/opensearch/base.py,sha256=H_5DUMn8q4E9iY7_LIQcdpfT8dZRjLfnml3OTjoVM2Q,37141
|
|
4
|
-
llama_index_vector_stores_opensearch-0.5.0.dist-info/METADATA,sha256=n9PwzBPMOet5qPVyywZaWNu9HEHd6A6g6EoVi7D4b0M,726
|
|
5
|
-
llama_index_vector_stores_opensearch-0.5.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
6
|
-
llama_index_vector_stores_opensearch-0.5.0.dist-info/RECORD,,
|
|
File without changes
|