haystack-velesdb 8.0.0__tar.gz → 8.2.0__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: haystack-velesdb
3
- Version: 8.0.0
3
+ Version: 8.2.0
4
4
  Summary: Haystack 2.x DocumentStore for VelesDB: The Local AI Memory Database.
5
5
  Author-email: VelesDB Team <contact@wiscale.fr>
6
6
  License: MIT
@@ -21,7 +21,7 @@ Description-Content-Type: text/markdown
21
21
  License-File: LICENSE
22
22
  Requires-Dist: haystack-ai>=2.0.0
23
23
  Requires-Dist: velesdb>=5.1.0
24
- Requires-Dist: velesdb-common>=8.0.0
24
+ Requires-Dist: velesdb-common>=8.2.0
25
25
  Provides-Extra: dev
26
26
  Requires-Dist: pytest<9.0,>=7.0; extra == "dev"
27
27
  Dynamic: license-file
@@ -82,6 +82,9 @@ and semantic search example using `SentenceTransformersDocumentEmbedder`.
82
82
  ```python
83
83
  from haystack import Pipeline
84
84
  from haystack.components.converters import PyPDFToDocument
85
+ # haystack-ai 2.x path; on haystack-ai 3.x the SentenceTransformers embedders
86
+ # moved to the `sentence-transformers-haystack` package:
87
+ # from haystack_integrations.components.embedders.sentence_transformers import (...)
85
88
  from haystack.components.embedders import (
86
89
  SentenceTransformersDocumentEmbedder,
87
90
  SentenceTransformersTextEmbedder,
@@ -139,7 +142,7 @@ print(result["retriever"]["documents"])
139
142
  | `write_documents_streaming(documents, policy, sparse_vectors=None, batch_size=100)` | Same `DuplicatePolicy` semantics as `write_documents`, but sent through the streaming channel in `batch_size`-sized chunks — better throughput for large bulk loads. See "Note on streaming ingestion" below |
140
143
  | `flush()` | Flush pending changes to disk. See "Note on streaming ingestion" below |
141
144
  | `filter_documents(filters)` | Scroll documents matching a VelesDB filter dict, up to `scroll_limit` |
142
- | `embedding_retrieval(query_embedding, top_k, filters, scale_score, fusion=None, fusion_params=None)` | Vector similarity search. `fusion` selects a `velesdb.FusionStrategy` (`"average"`, `"maximum"`, `"rrf"`, `"weighted"`, `"relative_score"` / `"rsf"`) applied via `Collection.multi_query_search`, changing the ranking; `fusion_params` configures it (e.g. `{"dense_weight": 0.7, "sparse_weight": 0.3}` for `"rsf"`). `filters` cannot be combined with `fusion` |
145
+ | `embedding_retrieval(query_embedding, top_k, filters, scale_score, fusion=None, fusion_params=None)` | Vector similarity search. `fusion` selects a `velesdb.FusionStrategy` (`"average"`, `"maximum"`, `"rrf"`, `"weighted_rrf"`, `"weighted"`, `"relative_score"` / `"rsf"`) applied via `Collection.multi_query_search`, changing the ranking; `fusion_params` configures it (e.g. `{"dense_weight": 0.7, "sparse_weight": 0.3}` for `"rsf"`, `{"weights": [...]}` for `"weighted_rrf"`). `filters` cannot be combined with `fusion` |
143
146
  | `count_documents()` | Total document count |
144
147
  | `delete_documents(document_ids)` | Delete by Haystack string IDs |
145
148
  | `train_pq(m=8, k=256, opq=False)` | Train Product Quantization on the collection |
@@ -150,9 +153,11 @@ print(result["retriever"]["documents"])
150
153
  | `to_dict()` / `from_dict()` | Haystack pipeline serialisation |
151
154
 
152
155
  **Note on `DuplicatePolicy`:** `NONE` and `OVERWRITE` use VelesDB upsert semantics
153
- and always overwrite on collision. `FAIL` is fully enforced: a pre-scan is
154
- performed before writing and `DuplicateDocumentError` is raised if any document
155
- already exists (prefer `OVERWRITE` or `NONE` for bulk loads to skip the scan cost).
156
+ and always overwrite on collision. `SKIP` drops incoming documents whose ID
157
+ already exists and writes only the new subset. `FAIL` is fully enforced: a
158
+ pre-scan is performed before writing and `DuplicateDocumentError` is raised if
159
+ any document already exists (prefer `OVERWRITE` or `NONE` for bulk loads to
160
+ skip the scan cost).
156
161
 
157
162
  **Note on document IDs and SHA-256:** Haystack string IDs are mapped to 63-bit
158
163
  integers using the first 8 bytes of SHA-256 (~9.2 × 10¹⁸ slots). For a
@@ -54,6 +54,9 @@ and semantic search example using `SentenceTransformersDocumentEmbedder`.
54
54
  ```python
55
55
  from haystack import Pipeline
56
56
  from haystack.components.converters import PyPDFToDocument
57
+ # haystack-ai 2.x path; on haystack-ai 3.x the SentenceTransformers embedders
58
+ # moved to the `sentence-transformers-haystack` package:
59
+ # from haystack_integrations.components.embedders.sentence_transformers import (...)
57
60
  from haystack.components.embedders import (
58
61
  SentenceTransformersDocumentEmbedder,
59
62
  SentenceTransformersTextEmbedder,
@@ -111,7 +114,7 @@ print(result["retriever"]["documents"])
111
114
  | `write_documents_streaming(documents, policy, sparse_vectors=None, batch_size=100)` | Same `DuplicatePolicy` semantics as `write_documents`, but sent through the streaming channel in `batch_size`-sized chunks — better throughput for large bulk loads. See "Note on streaming ingestion" below |
112
115
  | `flush()` | Flush pending changes to disk. See "Note on streaming ingestion" below |
113
116
  | `filter_documents(filters)` | Scroll documents matching a VelesDB filter dict, up to `scroll_limit` |
114
- | `embedding_retrieval(query_embedding, top_k, filters, scale_score, fusion=None, fusion_params=None)` | Vector similarity search. `fusion` selects a `velesdb.FusionStrategy` (`"average"`, `"maximum"`, `"rrf"`, `"weighted"`, `"relative_score"` / `"rsf"`) applied via `Collection.multi_query_search`, changing the ranking; `fusion_params` configures it (e.g. `{"dense_weight": 0.7, "sparse_weight": 0.3}` for `"rsf"`). `filters` cannot be combined with `fusion` |
117
+ | `embedding_retrieval(query_embedding, top_k, filters, scale_score, fusion=None, fusion_params=None)` | Vector similarity search. `fusion` selects a `velesdb.FusionStrategy` (`"average"`, `"maximum"`, `"rrf"`, `"weighted_rrf"`, `"weighted"`, `"relative_score"` / `"rsf"`) applied via `Collection.multi_query_search`, changing the ranking; `fusion_params` configures it (e.g. `{"dense_weight": 0.7, "sparse_weight": 0.3}` for `"rsf"`, `{"weights": [...]}` for `"weighted_rrf"`). `filters` cannot be combined with `fusion` |
115
118
  | `count_documents()` | Total document count |
116
119
  | `delete_documents(document_ids)` | Delete by Haystack string IDs |
117
120
  | `train_pq(m=8, k=256, opq=False)` | Train Product Quantization on the collection |
@@ -122,9 +125,11 @@ print(result["retriever"]["documents"])
122
125
  | `to_dict()` / `from_dict()` | Haystack pipeline serialisation |
123
126
 
124
127
  **Note on `DuplicatePolicy`:** `NONE` and `OVERWRITE` use VelesDB upsert semantics
125
- and always overwrite on collision. `FAIL` is fully enforced: a pre-scan is
126
- performed before writing and `DuplicateDocumentError` is raised if any document
127
- already exists (prefer `OVERWRITE` or `NONE` for bulk loads to skip the scan cost).
128
+ and always overwrite on collision. `SKIP` drops incoming documents whose ID
129
+ already exists and writes only the new subset. `FAIL` is fully enforced: a
130
+ pre-scan is performed before writing and `DuplicateDocumentError` is raised if
131
+ any document already exists (prefer `OVERWRITE` or `NONE` for bulk loads to
132
+ skip the scan cost).
128
133
 
129
134
  **Note on document IDs and SHA-256:** Haystack string IDs are mapped to 63-bit
130
135
  integers using the first 8 bytes of SHA-256 (~9.2 × 10¹⁸ slots). For a
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "haystack-velesdb"
7
- version = "8.0.0"
7
+ version = "8.2.0"
8
8
  description = "Haystack 2.x DocumentStore for VelesDB: The Local AI Memory Database."
9
9
  readme = "README.md"
10
10
  license = {text = "MIT"}
@@ -32,7 +32,7 @@ requires-python = ">=3.10"
32
32
  dependencies = [
33
33
  "haystack-ai>=2.0.0",
34
34
  "velesdb>=5.1.0",
35
- "velesdb-common>=8.0.0",
35
+ "velesdb-common>=8.2.0",
36
36
  ]
37
37
 
38
38
  [project.optional-dependencies]
@@ -4,4 +4,4 @@ from haystack_velesdb.document_store import VelesDBDocumentStore
4
4
  from haystack_velesdb.retriever import VelesDBEmbeddingRetriever
5
5
 
6
6
  __all__ = ["VelesDBDocumentStore", "VelesDBEmbeddingRetriever"]
7
- __version__ = "8.0.0"
7
+ __version__ = "8.2.0"
@@ -23,6 +23,7 @@ from velesdb_common.scores import (
23
23
  to_similarity,
24
24
  )
25
25
  from velesdb_common.security import (
26
+ ALLOWED_CONDITION_TYPES,
26
27
  validate_collection_name,
27
28
  validate_metric,
28
29
  validate_named_sparse_vector,
@@ -60,6 +61,21 @@ _HAYSTACK_LOGIC_TO_VELES: Dict[str, str] = {
60
61
  "NOT": "not",
61
62
  }
62
63
 
64
+ # The TARGET tags are not re-listed as free literals: every value in both
65
+ # maps must be a member of ``ALLOWED_CONDITION_TYPES`` (single-sourced from
66
+ # velesdb-core through ``velesdb_common``), which this import-time guard
67
+ # enforces so the maps cannot drift from the engine's vocabulary — the same
68
+ # guard ``llamaindex_velesdb.filter_ops`` already carries (#2095 item B).
69
+ _UNKNOWN_CONDITION_TYPES = (
70
+ set(_HAYSTACK_COMPARISON_TO_VELES.values())
71
+ | set(_HAYSTACK_LOGIC_TO_VELES.values())
72
+ ) - ALLOWED_CONDITION_TYPES
73
+ if _UNKNOWN_CONDITION_TYPES:
74
+ raise RuntimeError(
75
+ "haystack_velesdb emits condition types unknown to velesdb-core: "
76
+ f"{sorted(_UNKNOWN_CONDITION_TYPES)}"
77
+ )
78
+
63
79
 
64
80
  def _strip_meta_prefix(field: str) -> str:
65
81
  """Drop the leading ``meta.`` namespace from a Haystack field path.
@@ -747,7 +763,7 @@ class VelesDBDocumentStore(CollectionAdminMixin):
747
763
  keeps (``average``, ``maximum`` or ``weighted`` over a distance
748
764
  metric) is mapped to ``1 / (1 + d)`` either way.
749
765
  fusion: Optional fusion strategy name applied to the ranking —
750
- one of ``"average"``, ``"maximum"``, ``"rrf"``,
766
+ one of ``"average"``, ``"maximum"``, ``"rrf"``, ``"weighted_rrf"``,
751
767
  ``"weighted"``, ``"relative_score"`` / ``"rsf"``. When set,
752
768
  the query is ranked through the chosen
753
769
  :class:`velesdb.FusionStrategy`, which changes the result
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: haystack-velesdb
3
- Version: 8.0.0
3
+ Version: 8.2.0
4
4
  Summary: Haystack 2.x DocumentStore for VelesDB: The Local AI Memory Database.
5
5
  Author-email: VelesDB Team <contact@wiscale.fr>
6
6
  License: MIT
@@ -21,7 +21,7 @@ Description-Content-Type: text/markdown
21
21
  License-File: LICENSE
22
22
  Requires-Dist: haystack-ai>=2.0.0
23
23
  Requires-Dist: velesdb>=5.1.0
24
- Requires-Dist: velesdb-common>=8.0.0
24
+ Requires-Dist: velesdb-common>=8.2.0
25
25
  Provides-Extra: dev
26
26
  Requires-Dist: pytest<9.0,>=7.0; extra == "dev"
27
27
  Dynamic: license-file
@@ -82,6 +82,9 @@ and semantic search example using `SentenceTransformersDocumentEmbedder`.
82
82
  ```python
83
83
  from haystack import Pipeline
84
84
  from haystack.components.converters import PyPDFToDocument
85
+ # haystack-ai 2.x path; on haystack-ai 3.x the SentenceTransformers embedders
86
+ # moved to the `sentence-transformers-haystack` package:
87
+ # from haystack_integrations.components.embedders.sentence_transformers import (...)
85
88
  from haystack.components.embedders import (
86
89
  SentenceTransformersDocumentEmbedder,
87
90
  SentenceTransformersTextEmbedder,
@@ -139,7 +142,7 @@ print(result["retriever"]["documents"])
139
142
  | `write_documents_streaming(documents, policy, sparse_vectors=None, batch_size=100)` | Same `DuplicatePolicy` semantics as `write_documents`, but sent through the streaming channel in `batch_size`-sized chunks — better throughput for large bulk loads. See "Note on streaming ingestion" below |
140
143
  | `flush()` | Flush pending changes to disk. See "Note on streaming ingestion" below |
141
144
  | `filter_documents(filters)` | Scroll documents matching a VelesDB filter dict, up to `scroll_limit` |
142
- | `embedding_retrieval(query_embedding, top_k, filters, scale_score, fusion=None, fusion_params=None)` | Vector similarity search. `fusion` selects a `velesdb.FusionStrategy` (`"average"`, `"maximum"`, `"rrf"`, `"weighted"`, `"relative_score"` / `"rsf"`) applied via `Collection.multi_query_search`, changing the ranking; `fusion_params` configures it (e.g. `{"dense_weight": 0.7, "sparse_weight": 0.3}` for `"rsf"`). `filters` cannot be combined with `fusion` |
145
+ | `embedding_retrieval(query_embedding, top_k, filters, scale_score, fusion=None, fusion_params=None)` | Vector similarity search. `fusion` selects a `velesdb.FusionStrategy` (`"average"`, `"maximum"`, `"rrf"`, `"weighted_rrf"`, `"weighted"`, `"relative_score"` / `"rsf"`) applied via `Collection.multi_query_search`, changing the ranking; `fusion_params` configures it (e.g. `{"dense_weight": 0.7, "sparse_weight": 0.3}` for `"rsf"`, `{"weights": [...]}` for `"weighted_rrf"`). `filters` cannot be combined with `fusion` |
143
146
  | `count_documents()` | Total document count |
144
147
  | `delete_documents(document_ids)` | Delete by Haystack string IDs |
145
148
  | `train_pq(m=8, k=256, opq=False)` | Train Product Quantization on the collection |
@@ -150,9 +153,11 @@ print(result["retriever"]["documents"])
150
153
  | `to_dict()` / `from_dict()` | Haystack pipeline serialisation |
151
154
 
152
155
  **Note on `DuplicatePolicy`:** `NONE` and `OVERWRITE` use VelesDB upsert semantics
153
- and always overwrite on collision. `FAIL` is fully enforced: a pre-scan is
154
- performed before writing and `DuplicateDocumentError` is raised if any document
155
- already exists (prefer `OVERWRITE` or `NONE` for bulk loads to skip the scan cost).
156
+ and always overwrite on collision. `SKIP` drops incoming documents whose ID
157
+ already exists and writes only the new subset. `FAIL` is fully enforced: a
158
+ pre-scan is performed before writing and `DuplicateDocumentError` is raised if
159
+ any document already exists (prefer `OVERWRITE` or `NONE` for bulk loads to
160
+ skip the scan cost).
156
161
 
157
162
  **Note on document IDs and SHA-256:** Haystack string IDs are mapped to 63-bit
158
163
  integers using the first 8 bytes of SHA-256 (~9.2 × 10¹⁸ slots). For a
@@ -1,6 +1,6 @@
1
1
  haystack-ai>=2.0.0
2
2
  velesdb>=5.1.0
3
- velesdb-common>=8.0.0
3
+ velesdb-common>=8.2.0
4
4
 
5
5
  [dev]
6
6
  pytest<9.0,>=7.0
@@ -339,6 +339,16 @@ def _load_module() -> types.ModuleType:
339
339
  vc_sec.validate_metric = _passthrough # type: ignore[attr-defined]
340
340
  vc_sec.validate_named_sparse_vector = _passthrough # type: ignore[attr-defined]
341
341
  vc_sec.SecurityError = ValueError # type: ignore[attr-defined]
342
+ # Mirrors velesdb_common.security._FALLBACK_CONDITION_TYPES: the store's
343
+ # import-time drift guard reads this set.
344
+ vc_sec.ALLOWED_CONDITION_TYPES = frozenset( # type: ignore[attr-defined]
345
+ {
346
+ "eq", "neq", "gt", "gte", "lt", "lte", "in", "contains",
347
+ "is_null", "is_not_null", "and", "or", "not", "like", "ilike",
348
+ "array_contains", "array_contains_any", "array_contains_all",
349
+ "geo_distance", "geo_bbox",
350
+ }
351
+ )
342
352
  sys.modules["velesdb_common.security"] = vc_sec
343
353
 
344
354
  vc_fusion = types.ModuleType("velesdb_common.fusion")