llama-index-vector-stores-opensearch 0.5.3__tar.gz → 0.5.4__tar.gz
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-0.5.3 → llama_index_vector_stores_opensearch-0.5.4}/PKG-INFO +1 -1
- {llama_index_vector_stores_opensearch-0.5.3 → llama_index_vector_stores_opensearch-0.5.4}/llama_index/vector_stores/opensearch/base.py +25 -16
- {llama_index_vector_stores_opensearch-0.5.3 → llama_index_vector_stores_opensearch-0.5.4}/pyproject.toml +3 -2
- {llama_index_vector_stores_opensearch-0.5.3 → llama_index_vector_stores_opensearch-0.5.4}/.gitignore +0 -0
- {llama_index_vector_stores_opensearch-0.5.3 → llama_index_vector_stores_opensearch-0.5.4}/LICENSE +0 -0
- {llama_index_vector_stores_opensearch-0.5.3 → llama_index_vector_stores_opensearch-0.5.4}/README.md +0 -0
- {llama_index_vector_stores_opensearch-0.5.3 → llama_index_vector_stores_opensearch-0.5.4}/llama_index/py.typed +0 -0
- {llama_index_vector_stores_opensearch-0.5.3 → llama_index_vector_stores_opensearch-0.5.4}/llama_index/vector_stores/opensearch/__init__.py +0 -0
|
@@ -348,7 +348,8 @@ class OpensearchVectorClient:
|
|
|
348
348
|
return query
|
|
349
349
|
|
|
350
350
|
def _is_text_field(self, value: Any) -> bool:
|
|
351
|
-
"""
|
|
351
|
+
"""
|
|
352
|
+
Check if value is a string and keyword filtering needs to be performed.
|
|
352
353
|
|
|
353
354
|
Not applied to datetime strings.
|
|
354
355
|
"""
|
|
@@ -362,7 +363,8 @@ class OpensearchVectorClient:
|
|
|
362
363
|
return False
|
|
363
364
|
|
|
364
365
|
def _parse_filter(self, filter: MetadataFilter) -> dict:
|
|
365
|
-
"""
|
|
366
|
+
"""
|
|
367
|
+
Parse a single MetadataFilter to equivalent OpenSearch expression.
|
|
366
368
|
|
|
367
369
|
As Opensearch does not differentiate between scalar/array keyword fields, IN and ANY are equivalent.
|
|
368
370
|
"""
|
|
@@ -464,6 +466,7 @@ class OpensearchVectorClient:
|
|
|
464
466
|
|
|
465
467
|
Returns:
|
|
466
468
|
Dict: Up to k documents closest to query_embedding.
|
|
469
|
+
|
|
467
470
|
"""
|
|
468
471
|
filters = self._parse_filters(filters)
|
|
469
472
|
|
|
@@ -553,7 +556,8 @@ class OpensearchVectorClient:
|
|
|
553
556
|
def __get_painless_scripting_source(
|
|
554
557
|
self, space_type: str, vector_field: str = "embedding"
|
|
555
558
|
) -> str:
|
|
556
|
-
"""
|
|
559
|
+
"""
|
|
560
|
+
For Painless Scripting, it returns the script source based on space type.
|
|
557
561
|
This does not work with Opensearch Serverless currently.
|
|
558
562
|
"""
|
|
559
563
|
source_value = (
|
|
@@ -594,7 +598,8 @@ class OpensearchVectorClient:
|
|
|
594
598
|
pre_filter: Optional[Union[Dict, List]] = None,
|
|
595
599
|
vector_field: str = "embedding",
|
|
596
600
|
) -> Dict:
|
|
597
|
-
"""
|
|
601
|
+
"""
|
|
602
|
+
For Scoring Script Search, this is the default query. Has to account for Opensearch Service
|
|
598
603
|
Serverless which does not support painless scripting functions so defaults to knn_score.
|
|
599
604
|
"""
|
|
600
605
|
if not pre_filter:
|
|
@@ -625,13 +630,7 @@ class OpensearchVectorClient:
|
|
|
625
630
|
|
|
626
631
|
def _is_aoss_enabled(self, http_auth: Any) -> bool:
|
|
627
632
|
"""Check if the service is http_auth is set as `aoss`."""
|
|
628
|
-
|
|
629
|
-
http_auth is not None
|
|
630
|
-
and hasattr(http_auth, "service")
|
|
631
|
-
and http_auth.service == "aoss"
|
|
632
|
-
):
|
|
633
|
-
return True
|
|
634
|
-
return False
|
|
633
|
+
return http_auth is not None and hasattr(http_auth, "service") and http_auth.service == "aoss"
|
|
635
634
|
|
|
636
635
|
def _is_efficient_filtering_enabled(self) -> bool:
|
|
637
636
|
"""Check if kNN with efficient filtering is enabled."""
|
|
@@ -704,6 +703,7 @@ class OpensearchVectorClient:
|
|
|
704
703
|
|
|
705
704
|
Args:
|
|
706
705
|
doc_id (str): a LlamaIndex `Document` id
|
|
706
|
+
|
|
707
707
|
"""
|
|
708
708
|
search_query = {
|
|
709
709
|
"query": {"term": {"metadata.doc_id.keyword": {"value": doc_id}}}
|
|
@@ -718,6 +718,7 @@ class OpensearchVectorClient:
|
|
|
718
718
|
|
|
719
719
|
Args:
|
|
720
720
|
doc_id (str): a LlamaIndex `Document` id
|
|
721
|
+
|
|
721
722
|
"""
|
|
722
723
|
search_query = {
|
|
723
724
|
"query": {"term": {"metadata.doc_id.keyword": {"value": doc_id}}}
|
|
@@ -732,11 +733,13 @@ class OpensearchVectorClient:
|
|
|
732
733
|
filters: Optional[MetadataFilters] = None,
|
|
733
734
|
**delete_kwargs: Any,
|
|
734
735
|
) -> None:
|
|
735
|
-
"""
|
|
736
|
+
"""
|
|
737
|
+
Deletes nodes.
|
|
736
738
|
|
|
737
739
|
Args:
|
|
738
740
|
node_ids (Optional[List[str]], optional): IDs of nodes to delete. Defaults to None.
|
|
739
741
|
filters (Optional[MetadataFilters], optional): Metadata filters. Defaults to None.
|
|
742
|
+
|
|
740
743
|
"""
|
|
741
744
|
if not node_ids and not filters:
|
|
742
745
|
return
|
|
@@ -756,11 +759,13 @@ class OpensearchVectorClient:
|
|
|
756
759
|
filters: Optional[MetadataFilters] = None,
|
|
757
760
|
**delete_kwargs: Any,
|
|
758
761
|
) -> None:
|
|
759
|
-
"""
|
|
762
|
+
"""
|
|
763
|
+
Deletes nodes.
|
|
760
764
|
|
|
761
765
|
Args:
|
|
762
766
|
node_ids (Optional[List[str]], optional): IDs of nodes to delete. Defaults to None.
|
|
763
767
|
filters (Optional[MetadataFilters], optional): Metadata filters. Defaults to None.
|
|
768
|
+
|
|
764
769
|
"""
|
|
765
770
|
if not node_ids and not filters:
|
|
766
771
|
return
|
|
@@ -896,7 +901,6 @@ class OpensearchVectorClient:
|
|
|
896
901
|
start_char_idx=start_char_idx,
|
|
897
902
|
end_char_idx=end_char_idx,
|
|
898
903
|
relationships=relationships,
|
|
899
|
-
extra_info=source,
|
|
900
904
|
)
|
|
901
905
|
ids.append(node_id)
|
|
902
906
|
nodes.append(node)
|
|
@@ -941,6 +945,7 @@ class OpensearchVectorStore(BasePydanticVectorStore):
|
|
|
941
945
|
# initialize vector store
|
|
942
946
|
vector_store = OpensearchVectorStore(client)
|
|
943
947
|
```
|
|
948
|
+
|
|
944
949
|
"""
|
|
945
950
|
|
|
946
951
|
stores_text: bool = True
|
|
@@ -1015,11 +1020,13 @@ class OpensearchVectorStore(BasePydanticVectorStore):
|
|
|
1015
1020
|
filters: Optional[MetadataFilters] = None,
|
|
1016
1021
|
**delete_kwargs: Any,
|
|
1017
1022
|
) -> None:
|
|
1018
|
-
"""
|
|
1023
|
+
"""
|
|
1024
|
+
Deletes nodes async.
|
|
1019
1025
|
|
|
1020
1026
|
Args:
|
|
1021
1027
|
node_ids (Optional[List[str]], optional): IDs of nodes to delete. Defaults to None.
|
|
1022
1028
|
filters (Optional[MetadataFilters], optional): Metadata filters. Defaults to None.
|
|
1029
|
+
|
|
1023
1030
|
"""
|
|
1024
1031
|
self._client.delete_nodes(node_ids, filters, **delete_kwargs)
|
|
1025
1032
|
|
|
@@ -1029,11 +1036,13 @@ class OpensearchVectorStore(BasePydanticVectorStore):
|
|
|
1029
1036
|
filters: Optional[MetadataFilters] = None,
|
|
1030
1037
|
**delete_kwargs: Any,
|
|
1031
1038
|
) -> None:
|
|
1032
|
-
"""
|
|
1039
|
+
"""
|
|
1040
|
+
Async deletes nodes async.
|
|
1033
1041
|
|
|
1034
1042
|
Args:
|
|
1035
1043
|
node_ids (Optional[List[str]], optional): IDs of nodes to delete. Defaults to None.
|
|
1036
1044
|
filters (Optional[MetadataFilters], optional): Metadata filters. Defaults to None.
|
|
1045
|
+
|
|
1037
1046
|
"""
|
|
1038
1047
|
await self._client.adelete_nodes(node_ids, filters, **delete_kwargs)
|
|
1039
1048
|
|
|
@@ -13,7 +13,6 @@ dev = [
|
|
|
13
13
|
"pytest-asyncio==0.21.0",
|
|
14
14
|
"pytest-mock==3.11.1",
|
|
15
15
|
"ruff==0.0.292",
|
|
16
|
-
"tree-sitter-languages>=1.8.0,<2",
|
|
17
16
|
"types-Deprecated>=0.1.0",
|
|
18
17
|
"types-PyYAML>=6.0.12.12,<7",
|
|
19
18
|
"types-protobuf>=4.24.0.4,<5",
|
|
@@ -22,11 +21,13 @@ dev = [
|
|
|
22
21
|
"types-setuptools==67.1.0.0",
|
|
23
22
|
"black[jupyter]<=23.9.1,>=23.7.0",
|
|
24
23
|
"codespell[toml]>=v2.2.6",
|
|
24
|
+
"diff-cover>=9.2.0",
|
|
25
|
+
"pytest-cov>=6.1.1",
|
|
25
26
|
]
|
|
26
27
|
|
|
27
28
|
[project]
|
|
28
29
|
name = "llama-index-vector-stores-opensearch"
|
|
29
|
-
version = "0.5.
|
|
30
|
+
version = "0.5.4"
|
|
30
31
|
description = "llama-index vector_stores opensearch integration"
|
|
31
32
|
authors = [{name = "Your Name", email = "you@example.com"}]
|
|
32
33
|
requires-python = ">=3.9,<4.0"
|
{llama_index_vector_stores_opensearch-0.5.3 → llama_index_vector_stores_opensearch-0.5.4}/.gitignore
RENAMED
|
File without changes
|
{llama_index_vector_stores_opensearch-0.5.3 → llama_index_vector_stores_opensearch-0.5.4}/LICENSE
RENAMED
|
File without changes
|
{llama_index_vector_stores_opensearch-0.5.3 → llama_index_vector_stores_opensearch-0.5.4}/README.md
RENAMED
|
File without changes
|
|
File without changes
|