llama-index-vector-stores-opensearch 0.1.9__tar.gz → 0.1.10__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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: llama-index-vector-stores-opensearch
3
- Version: 0.1.9
3
+ Version: 0.1.10
4
4
  Summary: llama-index vector_stores opensearch integration
5
5
  License: MIT
6
6
  Author: Your Name
@@ -239,12 +239,12 @@ class OpensearchVectorClient:
239
239
  Returns:
240
240
  Up to k docs closest to query_embedding
241
241
  """
242
- if filters is None:
242
+ pre_filter = self._parse_filters(filters)
243
+ if not pre_filter:
243
244
  search_query = self._default_approximate_search_query(
244
245
  query_embedding, k, vector_field=embedding_field
245
246
  )
246
247
  else:
247
- pre_filter = self._parse_filters(filters)
248
248
  # https://opensearch.org/docs/latest/search-plugins/knn/painless-functions/
249
249
  search_query = self._default_painless_scripting_query(
250
250
  query_embedding,
@@ -388,17 +388,20 @@ class OpensearchVectorClient:
388
388
  )
389
389
  params = {
390
390
  "search_pipeline": self._search_pipeline,
391
- "_source_excludes": ["embedding"],
392
391
  }
393
392
  else:
394
393
  search_query = self._knn_search_query(
395
394
  self._embedding_field, query_embedding, k, filters=filters
396
395
  )
397
- params = {"_source_excludes": ["embedding"]}
396
+ params = None
398
397
 
399
398
  res = await self._os_client.search(
400
399
  index=self._index, body=search_query, params=params
401
400
  )
401
+
402
+ return self._to_query_result(res)
403
+
404
+ def _to_query_result(self, res) -> VectorStoreQueryResult:
402
405
  nodes = []
403
406
  ids = []
404
407
  scores = []
@@ -433,6 +436,7 @@ class OpensearchVectorClient:
433
436
  ids.append(node_id)
434
437
  nodes.append(node)
435
438
  scores.append(hit["_score"])
439
+
436
440
  return VectorStoreQueryResult(nodes=nodes, ids=ids, similarities=scores)
437
441
 
438
442
 
@@ -27,7 +27,7 @@ exclude = ["**/BUILD"]
27
27
  license = "MIT"
28
28
  name = "llama-index-vector-stores-opensearch"
29
29
  readme = "README.md"
30
- version = "0.1.9"
30
+ version = "0.1.10"
31
31
 
32
32
  [tool.poetry.dependencies]
33
33
  python = ">=3.8.1,<4.0"