ragx-cli 0.2.0__tar.gz → 0.3.2__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.
Files changed (96) hide show
  1. ragx_cli-0.3.2/.agents/skills/zvec/SKILL.md +219 -0
  2. ragx_cli-0.3.2/.agents/skills/zvec/api-cheatsheet.md +354 -0
  3. ragx_cli-0.3.2/.agents/skills/zvec/collection-management/python.md +247 -0
  4. ragx_cli-0.3.2/.agents/skills/zvec/collection-management/typescript.md +252 -0
  5. ragx_cli-0.3.2/.agents/skills/zvec/configuration.md +183 -0
  6. ragx_cli-0.3.2/.agents/skills/zvec/data-model.md +170 -0
  7. ragx_cli-0.3.2/.agents/skills/zvec/data-operations/python.md +370 -0
  8. ragx_cli-0.3.2/.agents/skills/zvec/data-operations/typescript.md +371 -0
  9. ragx_cli-0.3.2/.agents/skills/zvec/embedding.md +237 -0
  10. ragx_cli-0.3.2/.agents/skills/zvec/hybrid-search/python.md +136 -0
  11. ragx_cli-0.3.2/.agents/skills/zvec/hybrid-search/typescript.md +138 -0
  12. ragx_cli-0.3.2/.agents/skills/zvec/multimodal-search/python.md +177 -0
  13. ragx_cli-0.3.2/.agents/skills/zvec/multimodal-search/typescript.md +179 -0
  14. ragx_cli-0.3.2/.agents/skills/zvec/quick-start/python.md +111 -0
  15. ragx_cli-0.3.2/.agents/skills/zvec/quick-start/typescript.md +112 -0
  16. ragx_cli-0.3.2/.agents/skills/zvec/rag-system/python.md +429 -0
  17. ragx_cli-0.3.2/.agents/skills/zvec/rag-system/typescript.md +136 -0
  18. ragx_cli-0.3.2/.agents/skills/zvec/reranker.md +340 -0
  19. ragx_cli-0.3.2/.agents/skills/zvec/troubleshooting.md +84 -0
  20. ragx_cli-0.3.2/.agents/skills/zvec/vector-search/python.md +118 -0
  21. ragx_cli-0.3.2/.agents/skills/zvec/vector-search/typescript.md +106 -0
  22. {ragx_cli-0.2.0 → ragx_cli-0.3.2}/.github/workflows/publish.yml +4 -4
  23. ragx_cli-0.3.2/CHANGELOG.md +102 -0
  24. {ragx_cli-0.2.0 → ragx_cli-0.3.2}/CLAUDE.md +45 -10
  25. {ragx_cli-0.2.0 → ragx_cli-0.3.2}/PKG-INFO +149 -17
  26. {ragx_cli-0.2.0 → ragx_cli-0.3.2}/README.md +146 -16
  27. {ragx_cli-0.2.0 → ragx_cli-0.3.2}/pyproject.toml +3 -1
  28. ragx_cli-0.3.2/research/bge-m3-colbert-multi-vector-late-interaction-for-ragx-rerank-alternative-and-token-level-graph-edges.md +339 -0
  29. ragx_cli-0.3.2/research/bge-m3-dense-embeddings-as-ragx-provider-multilingual-quality-and-threshold-calibration.md +295 -0
  30. ragx_cli-0.3.2/research/bge-m3-dense-q8-vs-nomic-q4-benchmark-2026-07-12-worktree-eval-results.md +82 -0
  31. ragx_cli-0.3.2/research/bge-m3-sparse-lexical-weights-hybrid-retrieval-leg-for-ragx-vs-sqlite-fts5-bm25.md +402 -0
  32. ragx_cli-0.3.2/research/bge-m3-subchunk-edge-ablation-2026-07-13-ties-again-and-beta-zero-shortlist-mechanism.md +64 -0
  33. ragx_cli-0.3.2/research/fine-grained-sub-chunk-edges-with-coarse-chunk-nodes-multi-granularity-graph-rag-literature-validation.md +309 -0
  34. ragx_cli-0.3.2/research/subchunk-edge-ablation-2026-07-12-two-round-experiment-protocol-results-and-verdict.md +112 -0
  35. ragx_cli-0.3.2/skills-lock.json +11 -0
  36. {ragx_cli-0.2.0 → ragx_cli-0.3.2}/src/ragx/cli/app.py +48 -16
  37. ragx_cli-0.3.2/src/ragx/cli/detect.py +53 -0
  38. {ragx_cli-0.2.0 → ragx_cli-0.3.2}/src/ragx/cli/eval_cmd.py +2 -2
  39. ragx_cli-0.3.2/src/ragx/cli/init_prompt.py +119 -0
  40. {ragx_cli-0.2.0 → ragx_cli-0.3.2}/src/ragx/cli/inspect_cmd.py +46 -0
  41. {ragx_cli-0.2.0 → ragx_cli-0.3.2}/src/ragx/cli/output.py +11 -0
  42. {ragx_cli-0.2.0 → ragx_cli-0.3.2}/src/ragx/cli/pipeline.py +3 -3
  43. {ragx_cli-0.2.0 → ragx_cli-0.3.2}/src/ragx/core/chunking.py +39 -0
  44. ragx_cli-0.3.2/src/ragx/core/communities.py +43 -0
  45. {ragx_cli-0.2.0 → ragx_cli-0.3.2}/src/ragx/core/config.py +50 -11
  46. {ragx_cli-0.2.0 → ragx_cli-0.3.2}/src/ragx/core/discovery.py +7 -2
  47. {ragx_cli-0.2.0 → ragx_cli-0.3.2}/src/ragx/core/errors.py +1 -1
  48. ragx_cli-0.3.2/src/ragx/core/graph.py +103 -0
  49. ragx_cli-0.3.2/src/ragx/core/indexer.py +208 -0
  50. {ragx_cli-0.2.0 → ragx_cli-0.3.2}/src/ragx/core/store.py +71 -3
  51. {ragx_cli-0.2.0 → ragx_cli-0.3.2}/src/ragx/providers/st_reranker.py +10 -1
  52. {ragx_cli-0.2.0 → ragx_cli-0.3.2}/tests/test_chunking.py +30 -1
  53. ragx_cli-0.3.2/tests/test_cli.py +215 -0
  54. ragx_cli-0.3.2/tests/test_communities.py +36 -0
  55. {ragx_cli-0.2.0 → ragx_cli-0.3.2}/tests/test_config_rc.py +52 -0
  56. {ragx_cli-0.2.0 → ragx_cli-0.3.2}/tests/test_discovery.py +10 -0
  57. {ragx_cli-0.2.0 → ragx_cli-0.3.2}/tests/test_eval.py +2 -2
  58. ragx_cli-0.3.2/tests/test_graph.py +169 -0
  59. {ragx_cli-0.2.0 → ragx_cli-0.3.2}/tests/test_inspect.py +44 -0
  60. ragx_cli-0.3.2/tests/test_integration.py +223 -0
  61. {ragx_cli-0.2.0 → ragx_cli-0.3.2}/tests/test_providers.py +20 -0
  62. ragx_cli-0.3.2/tests/test_store.py +263 -0
  63. ragx_cli-0.2.0/src/ragx/core/graph.py +0 -37
  64. ragx_cli-0.2.0/src/ragx/core/indexer.py +0 -118
  65. ragx_cli-0.2.0/tests/test_cli.py +0 -86
  66. ragx_cli-0.2.0/tests/test_graph.py +0 -84
  67. ragx_cli-0.2.0/tests/test_integration.py +0 -109
  68. ragx_cli-0.2.0/tests/test_store.py +0 -142
  69. {ragx_cli-0.2.0 → ragx_cli-0.3.2}/.gitignore +0 -0
  70. {ragx_cli-0.2.0 → ragx_cli-0.3.2}/AGENTS.md +0 -0
  71. {ragx_cli-0.2.0 → ragx_cli-0.3.2}/CONTRACTS-PHASE23.md +0 -0
  72. {ragx_cli-0.2.0 → ragx_cli-0.3.2}/CONTRACTS.md +0 -0
  73. {ragx_cli-0.2.0 → ragx_cli-0.3.2}/LICENSE +0 -0
  74. {ragx_cli-0.2.0 → ragx_cli-0.3.2}/docs/feature-temporal-weighting.md +0 -0
  75. {ragx_cli-0.2.0 → ragx_cli-0.3.2}/ragx-cli-plan.md +0 -0
  76. {ragx_cli-0.2.0 → ragx_cli-0.3.2}/src/ragx/__init__.py +0 -0
  77. {ragx_cli-0.2.0 → ragx_cli-0.3.2}/src/ragx/cli/__init__.py +0 -0
  78. {ragx_cli-0.2.0 → ragx_cli-0.3.2}/src/ragx/core/__init__.py +0 -0
  79. {ragx_cli-0.2.0 → ragx_cli-0.3.2}/src/ragx/core/eval.py +0 -0
  80. {ragx_cli-0.2.0 → ragx_cli-0.3.2}/src/ragx/core/expansion.py +0 -0
  81. {ragx_cli-0.2.0 → ragx_cli-0.3.2}/src/ragx/core/fusion.py +0 -0
  82. {ragx_cli-0.2.0 → ragx_cli-0.3.2}/src/ragx/core/models.py +0 -0
  83. {ragx_cli-0.2.0 → ragx_cli-0.3.2}/src/ragx/core/query.py +0 -0
  84. {ragx_cli-0.2.0 → ragx_cli-0.3.2}/src/ragx/core/scoring.py +0 -0
  85. {ragx_cli-0.2.0 → ragx_cli-0.3.2}/src/ragx/core/traversal.py +0 -0
  86. {ragx_cli-0.2.0 → ragx_cli-0.3.2}/src/ragx/core/vectors.py +0 -0
  87. {ragx_cli-0.2.0 → ragx_cli-0.3.2}/src/ragx/providers/__init__.py +0 -0
  88. {ragx_cli-0.2.0 → ragx_cli-0.3.2}/src/ragx/providers/base.py +0 -0
  89. {ragx_cli-0.2.0 → ragx_cli-0.3.2}/src/ragx/providers/openai_compat.py +0 -0
  90. {ragx_cli-0.2.0 → ragx_cli-0.3.2}/src/ragx/providers/registry.py +0 -0
  91. {ragx_cli-0.2.0 → ragx_cli-0.3.2}/tests/__init__.py +0 -0
  92. {ragx_cli-0.2.0 → ragx_cli-0.3.2}/tests/conftest.py +0 -0
  93. {ragx_cli-0.2.0 → ragx_cli-0.3.2}/tests/test_expansion.py +0 -0
  94. {ragx_cli-0.2.0 → ragx_cli-0.3.2}/tests/test_fusion.py +0 -0
  95. {ragx_cli-0.2.0 → ragx_cli-0.3.2}/tests/test_traversal.py +0 -0
  96. {ragx_cli-0.2.0 → ragx_cli-0.3.2}/tests/test_vectors.py +0 -0
@@ -0,0 +1,219 @@
1
+ ---
2
+ name: zvec
3
+ description: |
4
+ Zvec vector database development assistant. Use this skill when users need to develop vector search applications based on zvec,
5
+ build RAG systems, implement semantic search, or handle vector data storage and querying.
6
+ Suitable for Python and Node.js development environments, providing complete technical guidance from basic concepts to advanced usage.
7
+ Proactively use this skill when users mention vector databases, similarity search, embedding storage, HNSW/IVF indexes,
8
+ hybrid search, multi-vector queries, or zvec API usage.
9
+ ---
10
+
11
+ ## Usage Instructions
12
+
13
+ ### Before starting, understand the following:
14
+
15
+ 1. **Development Language**: Python or Node.js?
16
+ - Python: use `pip install zvec`
17
+ - Node.js: use `npm install @zvec/zvec`
18
+
19
+ 2. **Use Cases**:
20
+ - RAG document retrieval system
21
+ - Semantic search
22
+ - Multimodal search (image + text)
23
+ - Hybrid search (keywords + semantic)
24
+
25
+ 3. **Data Scale**:
26
+ - < 100k: use FLAT index (exact search)
27
+ - 100k-10M: use HNSW index (recommended default)
28
+ - > 10M: use IVF index (memory optimized)
29
+
30
+ ### Decision Workflow
31
+
32
+ - User needs vector search functionality
33
+ - Choose development language (Python/Node.js)
34
+ - Determine use case
35
+ - RAG system → use single-vector search + document chunk management
36
+ - E-commerce search → use hybrid search (vector + filter)
37
+ - Multimodal → use multi-vector search + weighted ranking
38
+ - Design Schema (vector fields + scalar fields)
39
+ - Select index type (HNSW/FLAT/IVF)
40
+ - Implement data synchronization strategy
41
+
42
+ ### Default Recommendations
43
+
44
+ - Use `create_and_open()` / `ZVecCreateAndOpen()` to create Collection
45
+ - Use cosine similarity (COSINE) as default distance metric
46
+ - Use FP32 type for dense vectors
47
+ - Create `InvertIndexParam` index for filter fields
48
+
49
+ ### Validation Checklist
50
+
51
+ - Vector dimensions match Schema definition
52
+ - Scalar field types are correct
53
+ - Filter condition syntax is correct
54
+ - Call `optimize()` after large batch writes
55
+
56
+ ## Quick Start
57
+
58
+ **Python:**
59
+
60
+ ```python
61
+ import zvec
62
+
63
+ # Create Collection
64
+ schema = zvec.CollectionSchema(
65
+ name="my_collection",
66
+ fields=[
67
+ zvec.FieldSchema(name="title", data_type=zvec.DataType.STRING),
68
+ ],
69
+ vectors=[
70
+ zvec.VectorSchema(
71
+ name="embedding",
72
+ data_type=zvec.DataType.VECTOR_FP32,
73
+ dimension=768,
74
+ index_param=zvec.HnswIndexParam(
75
+ metric_type=zvec.MetricType.COSINE
76
+ ),
77
+ ),
78
+ ],
79
+ )
80
+
81
+ collection = zvec.create_and_open("./my_data", schema)
82
+
83
+ # Insert document
84
+ collection.upsert(zvec.Doc(
85
+ id="doc_1",
86
+ vectors={"embedding": [0.1] * 768},
87
+ fields={"title": "Hello World"},
88
+ ))
89
+
90
+ # Search
91
+ results = collection.query(
92
+ vectors=zvec.VectorQuery(
93
+ field_name="embedding",
94
+ vector=[0.1] * 768,
95
+ ),
96
+ topk=10,
97
+ )
98
+ ```
99
+
100
+ **Node.js:**
101
+
102
+ ```typescript
103
+ import { ZVecCreateAndOpen, ZVecCollectionSchema, ZVecFieldSchema, ZVecVectorSchema, ZVecDataType, ZVecHnswIndexParams, ZVecMetricType } from "@zvec/zvec";
104
+
105
+ const schema = new ZVecCollectionSchema({
106
+ name: "my_collection",
107
+ fields: [new ZVecFieldSchema({ name: "title", dataType: ZVecDataType.STRING })],
108
+ vectors: [new ZVecVectorSchema({
109
+ name: "embedding",
110
+ dataType: ZVecDataType.VECTOR_FP32,
111
+ dimension: 768,
112
+ indexParams: new ZVecHnswIndexParams({ metricType: ZVecMetricType.COSINE }),
113
+ })],
114
+ });
115
+
116
+ const collection = ZVecCreateAndOpen("./my_data", schema);
117
+ ```
118
+
119
+ ## Core Concepts
120
+
121
+ ### Data Model
122
+
123
+ **Collection**
124
+ - Similar to a table in relational databases, a container for storing, organizing, and querying data
125
+ - Each Collection has a Schema defining its structure
126
+ - Each Collection is independently persisted in a dedicated directory on disk
127
+
128
+ **Document**
129
+ - Basic unit of data storage, similar to a row in a relational table
130
+ - Contains three core components:
131
+ - `id`: unique string identifier
132
+ - `vectors`: named vector collection (supports dense and sparse vectors)
133
+ - `fields`: named scalar field collection
134
+
135
+ **Schema**
136
+ - Dynamic Schema: scalar fields and vectors can be added or removed at any time
137
+ - Strong type system: each field must declare a DataType
138
+
139
+ ### Vector Types
140
+
141
+ **Dense Vector**
142
+ - Fixed-length real-valued embeddings
143
+ - Types: `VECTOR_FP16`, `VECTOR_FP32`, `VECTOR_INT8`
144
+ - Suitable for: semantic understanding, context capture
145
+
146
+ **Sparse Vector**
147
+ - High-dimensional representation with only a few non-zero dimensions
148
+ - Types: `SPARSE_VECTOR_FP32`, `SPARSE_VECTOR_FP16`
149
+ - Suitable for: keyword matching, BM25 scoring
150
+
151
+ ### Index Types
152
+
153
+ | Index Type | Characteristics | Use Case |
154
+ |---------|------|---------|
155
+ | **FLAT** | Brute force search, exact results | Small scale data (<100k) |
156
+ | **HNSW** | Approximate nearest neighbor, graph structure | Large scale data (recommended default) |
157
+ | **IVF** | Inverted file index | Very large scale data |
158
+
159
+ ## Available Topics
160
+
161
+ ### Python
162
+
163
+ - [Quick Start](./quick-start/python.md) - Quick start with Zvec Python API
164
+ - [Collection Management](./collection-management/python.md) - Create, open, and manage Collections
165
+ - [Data Operations](./data-operations/python.md) - Insert, update, and delete documents
166
+ - [Vector Search](./vector-search/python.md) - Single-vector, multi-vector, and hybrid search
167
+ - [RAG System](./rag-system/python.md) - Build document retrieval system
168
+ - [Hybrid Search](./hybrid-search/python.md) - Vector similarity + scalar filtering
169
+ - [Multimodal Search](./multimodal-search/python.md) - Image + text joint search
170
+
171
+ ### Node.js
172
+
173
+ - [Quick Start](./quick-start/typescript.md) - Quick start with Zvec Node.js API
174
+ - [Collection Management](./collection-management/typescript.md) - Create, open, and manage Collections
175
+ - [Data Operations](./data-operations/typescript.md) - Insert, update, and delete documents
176
+ - [Vector Search](./vector-search/typescript.md) - Single-vector, multi-vector, and hybrid search
177
+ - [RAG System](./rag-system/typescript.md) - Build document retrieval system
178
+ - [Hybrid Search](./hybrid-search/typescript.md) - Vector similarity + scalar filtering
179
+ - [Multimodal Search](./multimodal-search/typescript.md) - Image + text joint search
180
+
181
+ ### General
182
+
183
+ - [Configuration](./configuration.md) - Global configuration and initialization
184
+ - [Data Model](./data-model.md) - Zvec data model overview
185
+ - [Embedding](./embedding.md) - Text embedding functions (Python only)
186
+ - [Reranker](./reranker.md) - Result reranking functions (Python only)
187
+ - [API Cheatsheet](./api-cheatsheet.md) - Python & Node.js API quick reference
188
+ - [Troubleshooting](./troubleshooting.md) - Common issues and solutions
189
+
190
+ ## Available Topics
191
+
192
+ ### Python
193
+
194
+ - [Collection Management](./collection-management/python.md)
195
+ - [Data Operations](./data-operations/python.md)
196
+ - [Hybrid Search](./hybrid-search/python.md)
197
+ - [Multimodal Search](./multimodal-search/python.md)
198
+ - [Quick Start](./quick-start/python.md)
199
+ - [Rag System](./rag-system/python.md)
200
+ - [Vector Search](./vector-search/python.md)
201
+
202
+ ### Node.js
203
+
204
+ - [Collection Management](./collection-management/typescript.md)
205
+ - [Data Operations](./data-operations/typescript.md)
206
+ - [Hybrid Search](./hybrid-search/typescript.md)
207
+ - [Multimodal Search](./multimodal-search/typescript.md)
208
+ - [Quick Start](./quick-start/typescript.md)
209
+ - [Rag System](./rag-system/typescript.md)
210
+ - [Vector Search](./vector-search/typescript.md)
211
+
212
+ ### General
213
+
214
+ - [Configuration](./configuration.md)
215
+ - [Data Model](./data-model.md)
216
+ - [Embedding](./embedding.md)
217
+ - [Reranker](./reranker.md)
218
+ - [Api Cheatsheet](./api-cheatsheet.md)
219
+ - [Troubleshooting](./troubleshooting.md)
@@ -0,0 +1,354 @@
1
+ # Zvec API Cheatsheet
2
+
3
+ ## Python API
4
+
5
+ ### Installation
6
+ ```bash
7
+ pip install zvec
8
+ ```
9
+
10
+ ### Global Configuration
11
+ ```python
12
+ import zvec
13
+
14
+ # Initialize with defaults
15
+ zvec.init()
16
+
17
+ # Initialize with custom settings
18
+ zvec.init(
19
+ log_type=zvec.LogType.CONSOLE, # or LogType.FILE
20
+ log_level=zvec.LogLevel.WARN, # DEBUG, INFO, WARN, ERROR, FATAL
21
+ query_threads=4,
22
+ optimize_threads=2,
23
+ memory_limit_mb=2048,
24
+ )
25
+ ```
26
+
27
+ ### Core Classes
28
+ ```python
29
+ import zvec
30
+ ```
31
+
32
+ ### Data Types
33
+
34
+ **Scalar Types:**
35
+ - `zvec.DataType.STRING`
36
+ - `zvec.DataType.BOOL`
37
+ - `zvec.DataType.INT32`, `INT64`, `UINT32`, `UINT64`
38
+ - `zvec.DataType.FLOAT`, `DOUBLE`
39
+ - Arrays: `ARRAY_STRING`, `ARRAY_BOOL`, `ARRAY_INT32`, etc.
40
+
41
+ **Vector Types:**
42
+ - `zvec.DataType.VECTOR_FP16`, `VECTOR_FP32`, `VECTOR_INT8`
43
+ - `zvec.DataType.SPARSE_VECTOR_FP32`, `SPARSE_VECTOR_FP16`
44
+
45
+ **Distance Metrics:**
46
+ - `zvec.MetricType.COSINE`
47
+ - `zvec.MetricType.IP`
48
+ - `zvec.MetricType.L2`
49
+
50
+ ### Index Parameters
51
+
52
+ ```python
53
+ # HNSW
54
+ zvec.HnswIndexParam(
55
+ metric_type=zvec.MetricType.COSINE,
56
+ M=16,
57
+ ef_construction=100,
58
+ )
59
+
60
+ # FLAT
61
+ zvec.FlatIndexParam(metric_type=zvec.MetricType.COSINE)
62
+
63
+ # IVF
64
+ zvec.IVFIndexParam(
65
+ metric_type=zvec.MetricType.COSINE,
66
+ nlist=100,
67
+ nprobe=10,
68
+ )
69
+
70
+ # Scalar index
71
+ zvec.InvertIndexParam(enable_range_optimization=True)
72
+ ```
73
+
74
+ ### Collection Operations
75
+
76
+ ```python
77
+ # Create/Open
78
+ collection = zvec.create_and_open(path, schema, option)
79
+ collection = zvec.open(path, option)
80
+
81
+ # Properties
82
+ collection.path
83
+ collection.schema
84
+ collection.stats
85
+ collection.option
86
+
87
+ # Data Write
88
+ collection.insert(doc)
89
+ collection.insert([doc1, doc2]) # batch
90
+ collection.upsert(doc)
91
+ collection.update(ids, vectors, fields)
92
+
93
+ # Data Query
94
+ doc = collection.fetch(id)
95
+ results = collection.query(vectors, topk, filter)
96
+
97
+ # Data Delete
98
+ collection.delete(ids)
99
+ collection.delete_by_filter(filter)
100
+
101
+ # Schema Modify
102
+ collection.add_column(field, expression="default_value")
103
+ collection.drop_column(name)
104
+ collection.alter_column(old_name="old", new_name="new")
105
+ collection.alter_column(field_schema=updated_field)
106
+ collection.create_index(field_name, index_param)
107
+ collection.drop_index(field_name)
108
+
109
+ # Maintenance
110
+ collection.optimize()
111
+ collection.flush()
112
+ collection.destroy()
113
+ ```
114
+
115
+ ### Document Structure
116
+
117
+ ```python
118
+ doc = zvec.Doc(
119
+ id="unique_id",
120
+ vectors={
121
+ "dense_vec": [0.1, 0.2, ...],
122
+ "sparse_vec": {42: 1.25, 1337: 0.8},
123
+ },
124
+ fields={
125
+ "string_field": "value",
126
+ "int_field": 123,
127
+ "bool_field": True,
128
+ },
129
+ )
130
+ ```
131
+
132
+ ### Query Structure
133
+
134
+ ```python
135
+ # Vector query
136
+ zvec.VectorQuery(
137
+ field_name="vector_name",
138
+ vector=[0.1, 0.2, ...],
139
+ param=zvec.HnswQueryParam(ef=100),
140
+ )
141
+
142
+ # Reranker
143
+ zvec.WeightedReRanker(
144
+ topn=10,
145
+ metric=zvec.MetricType.IP,
146
+ weights={"vec1": 1.0, "vec2": 0.8},
147
+ )
148
+
149
+ zvec.RRFReRanker(topn=10, rank_constant=60)
150
+ ```
151
+
152
+ ---
153
+
154
+ ## Node.js API
155
+
156
+ ### Installation
157
+ ```bash
158
+ npm install @zvec/zvec
159
+ ```
160
+
161
+ ### Global Configuration
162
+ ```typescript
163
+ import { ZVecInitialize, ZVecLogType, ZVecLogLevel } from "@zvec/zvec";
164
+
165
+ // Initialize with defaults
166
+ ZVecInitialize();
167
+
168
+ // Initialize with custom settings
169
+ ZVecInitialize({
170
+ logType: ZVecLogType.CONSOLE, // or ZVecLogType.FILE
171
+ logLevel: ZVecLogLevel.WARN, // DEBUG, INFO, WARN, ERROR, FATAL
172
+ queryThreads: 4,
173
+ optimizeThreads: 2,
174
+ memoryLimitMb: 2048,
175
+ });
176
+ ```
177
+
178
+ ### Core Imports
179
+
180
+ ```typescript
181
+ import {
182
+ ZVecInitialize,
183
+ ZVecCollectionSchema,
184
+ ZVecFieldSchema,
185
+ ZVecVectorSchema,
186
+ ZVecDataType,
187
+ ZVecHnswIndexParams,
188
+ ZVecMetricType,
189
+ ZVecCreateAndOpen,
190
+ ZVecOpen,
191
+ } from "@zvec/zvec";
192
+ ```
193
+
194
+ ### Data Type Enums
195
+
196
+ **Scalar Types:**
197
+ - `ZVecDataType.STRING`
198
+ - `ZVecDataType.BOOL`
199
+ - `ZVecDataType.INT32`, `INT64`, `UINT32`, `UINT64`
200
+ - `ZVecDataType.FLOAT`, `DOUBLE`
201
+
202
+ **Vector Types:**
203
+ - `ZVecDataType.VECTOR_FP16`, `VECTOR_FP32`, `VECTOR_INT8`
204
+ - `ZVecDataType.SPARSE_VECTOR_FP32`, `SPARSE_VECTOR_FP16`
205
+
206
+ **Distance Metrics:**
207
+ - `ZVecMetricType.COSINE`
208
+ - `ZVecMetricType.IP`
209
+ - `ZVecMetricType.L2`
210
+
211
+ ### Index Parameters
212
+
213
+ ```typescript
214
+ // HNSW
215
+ new ZVecHnswIndexParams({
216
+ metricType: ZVecMetricType.COSINE,
217
+ M: 16,
218
+ efConstruction: 100,
219
+ });
220
+
221
+ // FLAT
222
+ new ZVecFlatIndexParams({ metricType: ZVecMetricType.COSINE });
223
+
224
+ // IVF
225
+ new ZVecIVFIndexParams({
226
+ metricType: ZVecMetricType.COSINE,
227
+ nlist: 100,
228
+ nprobe: 10,
229
+ });
230
+
231
+ // Scalar index
232
+ new ZVecInvertIndexParams({ enableRangeOptimization: true });
233
+ ```
234
+
235
+ ### Collection Operations
236
+
237
+ ```typescript
238
+ // Create/Open
239
+ const collection = ZVecCreateAndOpen(path, schema, option);
240
+ const collection = ZVecOpen(path, option);
241
+
242
+ // Properties
243
+ collection.path;
244
+ collection.schema;
245
+ collection.stats;
246
+ collection.option;
247
+
248
+ // Data Write
249
+ collection.upsertSync(doc);
250
+ collection.upsertSync([doc1, doc2]); // batch
251
+ collection.updateSync({ ids, vectors, fields });
252
+
253
+ // Data Query
254
+ const doc = collection.fetchSync(id);
255
+ const results = collection.querySync({ vectors, topk, filter });
256
+
257
+ // Data Delete
258
+ collection.deleteSync({ ids });
259
+ collection.deleteByFilterSync(filter);
260
+
261
+ // Schema Modify
262
+ collection.addColumnSync({ field, expression: "default_value" });
263
+ collection.dropColumnSync(name);
264
+ collection.alterColumnSync({ oldName: "old", newName: "new" });
265
+ collection.alterColumnSync({ field: updatedField });
266
+ collection.createIndexSync({ fieldName, indexParams });
267
+ collection.dropIndexSync(fieldName);
268
+
269
+ // Maintenance
270
+ collection.optimizeSync();
271
+ collection.flushSync();
272
+ collection.destroySync();
273
+ ```
274
+
275
+ ### Document Structure
276
+
277
+ ```typescript
278
+ interface ZVecDocInput {
279
+ id: string;
280
+ vectors: {
281
+ [name: string]: number[] | { [index: number]: number };
282
+ };
283
+ fields: {
284
+ [name: string]: any;
285
+ };
286
+ }
287
+
288
+ // Example
289
+ const doc: ZVecDocInput = {
290
+ id: "unique_id",
291
+ vectors: {
292
+ dense_vec: [0.1, 0.2, 0.3],
293
+ sparse_vec: { 42: 1.25, 1337: 0.8 },
294
+ },
295
+ fields: {
296
+ string_field: "value",
297
+ int_field: 123,
298
+ bool_field: true,
299
+ },
300
+ };
301
+ ```
302
+
303
+ ### Query Structure
304
+
305
+ ```typescript
306
+ // Vector query
307
+ interface ZVecQuery {
308
+ fieldName: string;
309
+ vector?: number[] | { [index: number]: number };
310
+ id?: string;
311
+ params?: ZVecHnswQueryParams | ZVecIVFQueryParams;
312
+ }
313
+
314
+ // Example
315
+ const query: ZVecQuery = {
316
+ fieldName: "vector_name",
317
+ vector: [0.1, 0.2, ...],
318
+ params: new ZVecHnswQueryParams({ ef: 100 }),
319
+ };
320
+ ```
321
+
322
+ ---
323
+
324
+ ## Filter Syntax (Common)
325
+
326
+ ```
327
+ # Comparison
328
+ field == value
329
+ field != value
330
+ field > value
331
+ field >= value
332
+ field < value
333
+ field <= value
334
+
335
+ # Range
336
+ field BETWEEN min AND max
337
+
338
+ # Logical operations
339
+ condition1 AND condition2
340
+ condition1 OR condition2
341
+ NOT condition
342
+
343
+ # Array contains
344
+ 'value' IN array_field
345
+
346
+ # String matching
347
+ field LIKE 'prefix%'
348
+ field LIKE '%suffix'
349
+ field LIKE '%contains%'
350
+
351
+ # Null check
352
+ field IS NULL
353
+ field IS NOT NULL
354
+ ```