llama-index-vector-stores-opensearch 0.1.10__py3-none-any.whl → 0.1.11__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 +28 -6
- {llama_index_vector_stores_opensearch-0.1.10.dist-info → llama_index_vector_stores_opensearch-0.1.11.dist-info}/METADATA +2 -1
- llama_index_vector_stores_opensearch-0.1.11.dist-info/RECORD +5 -0
- {llama_index_vector_stores_opensearch-0.1.10.dist-info → llama_index_vector_stores_opensearch-0.1.11.dist-info}/WHEEL +1 -1
- llama_index_vector_stores_opensearch-0.1.10.dist-info/RECORD +0 -5
|
@@ -265,17 +265,34 @@ class OpensearchVectorClient:
|
|
|
265
265
|
k: int,
|
|
266
266
|
filters: Optional[MetadataFilters] = None,
|
|
267
267
|
) -> Dict:
|
|
268
|
-
knn_query = self._knn_search_query(
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
268
|
+
knn_query = self._knn_search_query(embedding_field, query_embedding, k, filters)
|
|
269
|
+
lexical_query = self._lexical_search_query(text_field, query_str, k, filters)
|
|
270
|
+
|
|
271
|
+
return {
|
|
272
|
+
"size": k,
|
|
273
|
+
"query": {
|
|
274
|
+
"hybrid": {"queries": [lexical_query["query"], knn_query["query"]]}
|
|
275
|
+
},
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
def _lexical_search_query(
|
|
279
|
+
self,
|
|
280
|
+
text_field: str,
|
|
281
|
+
query_str: str,
|
|
282
|
+
k: int,
|
|
283
|
+
filters: Optional[MetadataFilters] = None,
|
|
284
|
+
) -> Dict:
|
|
285
|
+
lexical_query = {
|
|
286
|
+
"bool": {"must": {"match": {text_field: {"query": query_str}}}}
|
|
287
|
+
}
|
|
272
288
|
|
|
273
289
|
parsed_filters = self._parse_filters(filters)
|
|
274
290
|
if len(parsed_filters) > 0:
|
|
275
|
-
lexical_query["filter"] = parsed_filters
|
|
291
|
+
lexical_query["bool"]["filter"] = parsed_filters
|
|
292
|
+
|
|
276
293
|
return {
|
|
277
294
|
"size": k,
|
|
278
|
-
"query":
|
|
295
|
+
"query": lexical_query,
|
|
279
296
|
}
|
|
280
297
|
|
|
281
298
|
def __get_painless_scripting_source(
|
|
@@ -389,6 +406,11 @@ class OpensearchVectorClient:
|
|
|
389
406
|
params = {
|
|
390
407
|
"search_pipeline": self._search_pipeline,
|
|
391
408
|
}
|
|
409
|
+
elif query_mode == VectorStoreQueryMode.TEXT_SEARCH:
|
|
410
|
+
search_query = self._lexical_search_query(
|
|
411
|
+
self._text_field, query_str, k, filters=filters
|
|
412
|
+
)
|
|
413
|
+
params = None
|
|
392
414
|
else:
|
|
393
415
|
search_query = self._knn_search_query(
|
|
394
416
|
self._embedding_field, query_embedding, k, filters=filters
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: llama-index-vector-stores-opensearch
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.11
|
|
4
4
|
Summary: llama-index vector_stores opensearch integration
|
|
5
5
|
License: MIT
|
|
6
6
|
Author: Your Name
|
|
@@ -11,6 +11,7 @@ Classifier: Programming Language :: Python :: 3
|
|
|
11
11
|
Classifier: Programming Language :: Python :: 3.9
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.10
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
15
|
Requires-Dist: llama-index-core (>=0.10.1,<0.11.0)
|
|
15
16
|
Requires-Dist: opensearch-py[async] (>=2.4.2,<3.0.0)
|
|
16
17
|
Description-Content-Type: text/markdown
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
llama_index/vector_stores/opensearch/__init__.py,sha256=U1_XAkZb6zcskOk4s10NB8Tjs9AZRGdRQLzOGpbWdBA,176
|
|
2
|
+
llama_index/vector_stores/opensearch/base.py,sha256=bHE7FV-CLU-x_ChG9CdoE4WzT1YkkZyIg23PYB7Eg30,19780
|
|
3
|
+
llama_index_vector_stores_opensearch-0.1.11.dist-info/METADATA,sha256=JrqjHpIkrncELU0t2pNIKbbYaAahVnFP8r9Tz0LeYrE,729
|
|
4
|
+
llama_index_vector_stores_opensearch-0.1.11.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
5
|
+
llama_index_vector_stores_opensearch-0.1.11.dist-info/RECORD,,
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
llama_index/vector_stores/opensearch/__init__.py,sha256=U1_XAkZb6zcskOk4s10NB8Tjs9AZRGdRQLzOGpbWdBA,176
|
|
2
|
-
llama_index/vector_stores/opensearch/base.py,sha256=LGXHRzcMVpvE-cb778I_W_I7wfGbLKgFQq9jR4OY6N8,19162
|
|
3
|
-
llama_index_vector_stores_opensearch-0.1.10.dist-info/METADATA,sha256=_-b77ZvNRypAK2awVaSGwoKqL3VdyS9SgpfVmyvmH1o,678
|
|
4
|
-
llama_index_vector_stores_opensearch-0.1.10.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
|
|
5
|
-
llama_index_vector_stores_opensearch-0.1.10.dist-info/RECORD,,
|