ydb-qdrant 4.3.5 → 4.4.0
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.
- package/README.md +40 -216
- package/dist/config/env.d.ts +2 -2
- package/dist/config/env.js +2 -2
- package/dist/ydb/schema.js +5 -1
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -4,6 +4,12 @@
|
|
|
4
4
|
[](https://github.com/astandrik/ydb-qdrant/actions/workflows/ci-tests.yml)
|
|
5
5
|
[](https://github.com/astandrik/ydb-qdrant/actions/workflows/ci-integration.yml)
|
|
6
6
|
[](https://coveralls.io/github/astandrik/ydb-qdrant?branch=main)
|
|
7
|
+
|
|
8
|
+
[](https://github.com/astandrik/ydb-qdrant/actions/workflows/ci-recall.yml)
|
|
9
|
+
[](https://github.com/astandrik/ydb-qdrant/actions/workflows/ci-recall.yml)
|
|
10
|
+
[](https://github.com/astandrik/ydb-qdrant/actions/workflows/ci-recall.yml)
|
|
11
|
+
[](https://github.com/astandrik/ydb-qdrant/actions/workflows/ci-recall.yml)
|
|
12
|
+
|
|
7
13
|
[](https://www.npmjs.com/package/ydb-qdrant)
|
|
8
14
|
[](https://github.com/users/astandrik/packages/container/package/ydb-qdrant)
|
|
9
15
|
[](https://opensource.org/licenses/ISC)
|
|
@@ -23,6 +29,13 @@ Architecture diagrams: [docs page](http://ydb-qdrant.tech/docs/)
|
|
|
23
29
|
|
|
24
30
|

|
|
25
31
|
|
|
32
|
+
## Documentation
|
|
33
|
+
|
|
34
|
+
- **Vector dimensions and embedding models**: [docs/vector-dimensions.md](docs/vector-dimensions.md)
|
|
35
|
+
- **Deployment and Docker options**: [docs/deployment-and-docker.md](docs/deployment-and-docker.md)
|
|
36
|
+
- **Architecture, storage layout, and vector indexing**: [docs/architecture-and-storage.md](docs/architecture-and-storage.md)
|
|
37
|
+
- **Evaluation, CI, and release process**: [docs/evaluation-and-ci.md](docs/evaluation-and-ci.md)
|
|
38
|
+
|
|
26
39
|
## Requirements
|
|
27
40
|
- Node.js 18+
|
|
28
41
|
- A YDB endpoint and database path
|
|
@@ -171,50 +184,7 @@ This pattern avoids running a separate HTTP service: vector search is executed d
|
|
|
171
184
|
|
|
172
185
|
## Recommended Vector Dimensions
|
|
173
186
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
### Commercial API Models
|
|
177
|
-
|
|
178
|
-
| Provider | Model | Dimensions | Use Cases |
|
|
179
|
-
|----------|-------|------------|-----------|
|
|
180
|
-
| **OpenAI** | `text-embedding-3-small` | 1536 (default, can reduce to 256-1536) | RAG, semantic search, general-purpose embeddings |
|
|
181
|
-
| **OpenAI** | `text-embedding-3-large` | 3072 (default, can reduce to 256, 512, 1024, 1536, 3072) | High-accuracy RAG, multilingual tasks |
|
|
182
|
-
| **OpenAI** | `text-embedding-ada-002` | 1536 | Legacy model, widely adopted |
|
|
183
|
-
| **OpenAI** (Legacy) | `text-search-curie-doc-001` | 4096 | Legacy GPT-3 model, deprecated |
|
|
184
|
-
| **OpenAI** (Legacy) | `text-search-davinci-doc-001` | 12288 | Legacy GPT-3 model, deprecated |
|
|
185
|
-
| **Cohere** | `embed-v4.0` | 256, 512, 1024, 1536 (default) | Multimodal (text + image), RAG, enterprise search |
|
|
186
|
-
| **Cohere** | `embed-english-v3.0` | 1024 | English text, semantic search, classification |
|
|
187
|
-
| **Cohere** | `embed-multilingual-v3.0` | 1024 | 100+ languages, long-document retrieval, clustering |
|
|
188
|
-
| **Google** | `gemini-embedding-001` | 3072 (configurable) | Multilingual, general-purpose, RAG |
|
|
189
|
-
| **Google** | `text-embedding-004` | 768 | General-purpose text embeddings |
|
|
190
|
-
| **Google** | `text-embedding-005` | 768 | Improved version of text-embedding-004 |
|
|
191
|
-
| **Google** | `text-multilingual-embedding-002` | 768 | Multilingual text embeddings |
|
|
192
|
-
|
|
193
|
-
### Open-Source Models (HuggingFace)
|
|
194
|
-
|
|
195
|
-
| Model | Dimensions | Use Cases |
|
|
196
|
-
|-------|------------|-----------|
|
|
197
|
-
| `sentence-transformers/all-MiniLM-L6-v2` | 384 | Fast semantic search, low-resource environments |
|
|
198
|
-
| `BAAI/bge-base-en-v1.5` | 768 | RAG, retrieval, English text |
|
|
199
|
-
| `BAAI/bge-large-en-v1.5` | 1024 | High-accuracy RAG, English text |
|
|
200
|
-
| `BAAI/bge-m3` | 1024 | Multilingual, dense/sparse/multi-vector |
|
|
201
|
-
| `intfloat/e5-base-v2` | 768 | General retrieval, English text |
|
|
202
|
-
| `intfloat/e5-large-v2` | 1024 | High-accuracy retrieval, English text |
|
|
203
|
-
| `intfloat/e5-mistral-7b-instruct` | 4096 | High-dimensional embeddings, advanced RAG |
|
|
204
|
-
| `nomic-ai/nomic-embed-text-v1` | 768 | General-purpose, open weights |
|
|
205
|
-
|
|
206
|
-
### Choosing Dimensions
|
|
207
|
-
|
|
208
|
-
- **Higher dimensions (1024-4096)**: Better semantic fidelity, higher storage/compute costs
|
|
209
|
-
- **Lower dimensions (384-768)**: Faster queries, lower costs, suitable for many use cases
|
|
210
|
-
- **Variable dimensions**: Some models (OpenAI v3, Cohere v4) allow dimension reduction with minimal accuracy loss
|
|
211
|
-
- **Legacy models**: Older OpenAI GPT-3 models (Curie: 4096, Davinci: 12288) are deprecated but may still be in use
|
|
212
|
-
|
|
213
|
-
**References:**
|
|
214
|
-
- [OpenAI Embeddings Guide](https://platform.openai.com/docs/guides/embeddings)
|
|
215
|
-
- [Cohere Embed Models](https://docs.cohere.com/docs/cohere-embed)
|
|
216
|
-
- [Google Gemini Embeddings](https://ai.google.dev/gemini-api/docs/embeddings)
|
|
217
|
-
- [HuggingFace Sentence Transformers](https://huggingface.co/sentence-transformers)
|
|
187
|
+
For full tables of popular embedding models and their dimensions, see [docs/vector-dimensions.md](docs/vector-dimensions.md).
|
|
218
188
|
|
|
219
189
|
## Quick Start
|
|
220
190
|
|
|
@@ -231,6 +201,23 @@ When creating a collection, you must specify the vector `size` matching your emb
|
|
|
231
201
|
- API key optional (not enforced)
|
|
232
202
|
- Full control and privacy
|
|
233
203
|
|
|
204
|
+
**Option 3: All-in-one local YDB + ydb-qdrant (Docker)**
|
|
205
|
+
|
|
206
|
+
Run a single container that includes both YDB and ydb-qdrant (no external YDB required):
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
docker run -d --name ydb-qdrant-local \
|
|
210
|
+
-p 8080:8080 \
|
|
211
|
+
-p 8765:8765 \
|
|
212
|
+
ghcr.io/astandrik/ydb-qdrant-local:latest
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
- HTTP API available at `http://localhost:8080`
|
|
216
|
+
- YDB Embedded UI at `http://localhost:8765`
|
|
217
|
+
- No credentials or env vars needed for local dev
|
|
218
|
+
|
|
219
|
+
For detailed configuration and env tuning, see [docs/deployment-and-docker.md](docs/deployment-and-docker.md).
|
|
220
|
+
|
|
234
221
|
### cURL smoke test (Self-hosted)
|
|
235
222
|
```bash
|
|
236
223
|
# 1) Install & run
|
|
@@ -281,11 +268,9 @@ curl -s http://localhost:8080/health
|
|
|
281
268
|
|
|
282
269
|
Published container: [`ghcr.io/astandrik/ydb-qdrant`](https://github.com/users/astandrik/packages/container/package/ydb-qdrant)
|
|
283
270
|
|
|
284
|
-
|
|
271
|
+
Basic example:
|
|
285
272
|
|
|
286
273
|
```bash
|
|
287
|
-
docker pull ghcr.io/astandrik/ydb-qdrant:latest
|
|
288
|
-
|
|
289
274
|
docker run -d --name ydb-qdrant \
|
|
290
275
|
-p 8080:8080 \
|
|
291
276
|
-e YDB_ENDPOINT=grpcs://ydb.serverless.yandexcloud.net:2135 \
|
|
@@ -295,115 +280,7 @@ docker run -d --name ydb-qdrant \
|
|
|
295
280
|
ghcr.io/astandrik/ydb-qdrant:latest
|
|
296
281
|
```
|
|
297
282
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
From the `ydb-qdrant/` directory:
|
|
301
|
-
|
|
302
|
-
```bash
|
|
303
|
-
docker build -t ydb-qdrant:latest .
|
|
304
|
-
|
|
305
|
-
docker run -d --name ydb-qdrant \
|
|
306
|
-
-p 8080:8080 \
|
|
307
|
-
-e YDB_ENDPOINT=grpcs://ydb.serverless.yandexcloud.net:2135 \
|
|
308
|
-
-e YDB_DATABASE=/ru-central1/<cloud>/<db> \
|
|
309
|
-
-e YDB_SERVICE_ACCOUNT_KEY_FILE_CREDENTIALS=/sa-key.json \
|
|
310
|
-
-v /abs/path/sa-key.json:/sa-key.json:ro \
|
|
311
|
-
ydb-qdrant:latest
|
|
312
|
-
```
|
|
313
|
-
|
|
314
|
-
#### Docker (all-in-one: local YDB + ydb-qdrant)
|
|
315
|
-
|
|
316
|
-
For a single-container local dev/demo setup with both YDB and ydb-qdrant inside:
|
|
317
|
-
|
|
318
|
-
```bash
|
|
319
|
-
docker pull ghcr.io/astandrik/ydb-qdrant-local:latest
|
|
320
|
-
|
|
321
|
-
docker run -d --name ydb-qdrant-local \
|
|
322
|
-
-p 8080:8080 \
|
|
323
|
-
-p 8765:8765 \
|
|
324
|
-
ghcr.io/astandrik/ydb-qdrant-local:latest
|
|
325
|
-
```
|
|
326
|
-
|
|
327
|
-
Key env vars (all optional; the image provides sensible defaults, override only when you need custom tuning):
|
|
328
|
-
|
|
329
|
-
- YDB / local YDB:
|
|
330
|
-
- `YDB_LOCAL_GRPC_PORT` (default `2136`): internal YDB gRPC port.
|
|
331
|
-
- `YDB_LOCAL_MON_PORT` (default `8765`): internal YDB Embedded UI HTTP port.
|
|
332
|
-
- `YDB_DATABASE` (default `/local`).
|
|
333
|
-
- `YDB_ANONYMOUS_CREDENTIALS` (default `1` inside this image).
|
|
334
|
-
- `YDB_USE_IN_MEMORY_PDISKS` (default `0`, values `0`/`1`): store data in RAM only when `1` (fast, non-persistent).
|
|
335
|
-
- `YDB_LOCAL_SURVIVE_RESTART` (default `0`, values `0`/`1`): control persistence across restarts when using a mounted data volume.
|
|
336
|
-
- `YDB_DEFAULT_LOG_LEVEL`, `YDB_FEATURE_FLAGS`, `YDB_ENABLE_COLUMN_TABLES`, `YDB_KAFKA_PROXY_PORT`, `POSTGRES_USER`, `POSTGRES_PASSWORD` – passed through to YDB as in the official `local-ydb` image.
|
|
337
|
-
|
|
338
|
-
- ydb-qdrant:
|
|
339
|
-
- `PORT` (default `8080`): HTTP port inside the container.
|
|
340
|
-
- `LOG_LEVEL` (default `info`).
|
|
341
|
-
- `VECTOR_INDEX_BUILD_ENABLED`.
|
|
342
|
-
- `YDB_QDRANT_COLLECTION_STORAGE_MODE` / `YDB_QDRANT_TABLE_LAYOUT` (`multi_table` or `one_table`).
|
|
343
|
-
- `YDB_QDRANT_GLOBAL_POINTS_AUTOMIGRATE`.
|
|
344
|
-
|
|
345
|
-
> Note: In the `ydb-qdrant-local` image, `YDB_ENDPOINT` is unconditionally set to `grpc://localhost:<YDB_LOCAL_GRPC_PORT>` by the entrypoint — any user-provided value is ignored. Use the standalone `ydb-qdrant` image if you need to connect to an external YDB.
|
|
346
|
-
|
|
347
|
-
#### Apple Silicon (Mac) notes
|
|
348
|
-
|
|
349
|
-
The `ydb-qdrant-local` image is built on top of the `local-ydb` Docker image, which is x86_64/amd64-only. On Apple Silicon (M1/M2/M3) you need to run it under x86_64/amd64 emulation:
|
|
350
|
-
|
|
351
|
-
- Enable Rosetta (x86_64/amd64 emulation) in your Docker backend:
|
|
352
|
-
- Docker Desktop: enable Rosetta to run x86_64/amd64 containers.
|
|
353
|
-
- Or use Colima as in the YDB docs:
|
|
354
|
-
- `colima start --arch aarch64 --vm-type=vz --vz-rosetta`
|
|
355
|
-
- When running the container, force the amd64 platform explicitly:
|
|
356
|
-
|
|
357
|
-
```bash
|
|
358
|
-
docker run --platform linux/amd64 -d --name ydb-qdrant-local \
|
|
359
|
-
-p 8080:8080 -p 8765:8765 \
|
|
360
|
-
ghcr.io/astandrik/ydb-qdrant-local:latest
|
|
361
|
-
```
|
|
362
|
-
|
|
363
|
-
This keeps behavior aligned with the official YDB `local-ydb` image recommendations for macOS/Apple Silicon.
|
|
364
|
-
|
|
365
|
-
#### Docker Compose
|
|
366
|
-
|
|
367
|
-
Example `docker-compose.yml` (can be used instead of raw `docker run`):
|
|
368
|
-
|
|
369
|
-
```yaml
|
|
370
|
-
services:
|
|
371
|
-
ydb-qdrant:
|
|
372
|
-
image: ghcr.io/astandrik/ydb-qdrant:latest
|
|
373
|
-
ports:
|
|
374
|
-
- "8080:8080"
|
|
375
|
-
env_file:
|
|
376
|
-
- .env
|
|
377
|
-
environment:
|
|
378
|
-
YDB_ENDPOINT: ${YDB_ENDPOINT}
|
|
379
|
-
YDB_DATABASE: ${YDB_DATABASE}
|
|
380
|
-
YDB_SERVICE_ACCOUNT_KEY_FILE_CREDENTIALS: /sa-key.json
|
|
381
|
-
PORT: ${PORT:-8080}
|
|
382
|
-
LOG_LEVEL: ${LOG_LEVEL:-info}
|
|
383
|
-
volumes:
|
|
384
|
-
- ${YDB_SA_KEY_PATH}:/sa-key.json:ro
|
|
385
|
-
```
|
|
386
|
-
|
|
387
|
-
Example `.env` (per environment):
|
|
388
|
-
|
|
389
|
-
```bash
|
|
390
|
-
YDB_ENDPOINT=grpcs://ydb.serverless.yandexcloud.net:2135
|
|
391
|
-
YDB_DATABASE=/ru-central1/<cloud>/<db>
|
|
392
|
-
YDB_SA_KEY_PATH=/abs/path/to/ydb-sa.json
|
|
393
|
-
PORT=8080
|
|
394
|
-
LOG_LEVEL=info
|
|
395
|
-
```
|
|
396
|
-
|
|
397
|
-
- **Updating to a newer image with Compose** (no rebuild):
|
|
398
|
-
- Pull the latest tag and restart the service:
|
|
399
|
-
```bash
|
|
400
|
-
docker-compose pull ydb-qdrant
|
|
401
|
-
docker-compose up -d ydb-qdrant
|
|
402
|
-
```
|
|
403
|
-
|
|
404
|
-
- **Environment**: uses the same variables as documented in **Configure credentials** (`YDB_ENDPOINT`, `YDB_DATABASE`, one of the `YDB_*_CREDENTIALS` options, optional `PORT`/`LOG_LEVEL`).
|
|
405
|
-
- **Qdrant URL for tools/clients**: set to `http://localhost:8080` (or `http://<host>:<hostPort>` if you map a different port).
|
|
406
|
-
- **Health check inside container**: `GET http://localhost:8080/health`.
|
|
283
|
+
For full deployment options (local builds, all-in-one image, Docker Compose, Apple Silicon notes), see [docs/deployment-and-docker.md](docs/deployment-and-docker.md) — including an optional “Persistence across restarts” example for the `ydb-qdrant-local` image when you want embedded YDB data to survive container restarts.
|
|
407
284
|
|
|
408
285
|
|
|
409
286
|
## API Reference
|
|
@@ -450,63 +327,10 @@ curl -X POST http://localhost:8080/collections/mycol/points/delete \
|
|
|
450
327
|
-d '{"points": ["1"]}'
|
|
451
328
|
```
|
|
452
329
|
|
|
453
|
-
##
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
- Search uses a single-phase top‑k over `embedding` with automatic YDB vector index (`emb_idx`) when available; falls back to table scan if missing.
|
|
461
|
-
- **Vector index auto-build** (multi_table mode only): After ≥100 points upserted + 5s quiet window, a `vector_kmeans_tree` index (levels=1, clusters=128) is built automatically. Incremental updates (<100 points) skip index rebuild. In one_table mode, vector indexes are not supported; searches use a two‑phase approximate+exact flow over `qdrant_all_points` (bit‑quantized candidates via `embedding_bit` using the corresponding distance function, then exact re‑ranking over `embedding`). Note: For Dot metric, Phase 1 uses CosineDistance as a proxy since there is no direct distance equivalent for inner product on bit vectors.
|
|
462
|
-
- **Concurrency**: During index rebuilds, YDB may return transient `Aborted`/schema metadata errors. Upserts include bounded retries with backoff to handle this automatically.
|
|
463
|
-
- Filters are not yet modeled; can be added if needed.
|
|
464
|
-
|
|
465
|
-
## Scoring semantics
|
|
466
|
-
- Cosine/Dot: higher score is better; `score_threshold` filters with `>=`.
|
|
467
|
-
- Euclid/Manhattan: lower score is better; `score_threshold` filters with `<=`.
|
|
468
|
-
|
|
469
|
-
## Request normalization (Qdrant-compatible)
|
|
470
|
-
- Accepts `limit` as alias of `top`.
|
|
471
|
-
- Accepts `with_payload` as boolean/object/array (object/array treated as `true`).
|
|
472
|
-
- Extracts query vector from common shapes: `vector`, `embedding`, `query.vector`, `query.nearest.vector`, or nested keys.
|
|
473
|
-
|
|
474
|
-
## Qdrant compatibility scope
|
|
475
|
-
This service implements a minimal subset expected by common tooling:
|
|
476
|
-
- Create/get/delete collection
|
|
477
|
-
- Upsert points
|
|
478
|
-
- Top‑k search with optional payload
|
|
479
|
-
- Delete points
|
|
480
|
-
|
|
481
|
-
Compatibility notes:
|
|
482
|
-
- Accepts `PUT /collections/:collection/points` as an alias of upsert.
|
|
483
|
-
- Accepts `POST /collections/:collection/points/query` as an alias of search.
|
|
484
|
-
- Accepts `limit` as an alias of `top`; honors `score_threshold`.
|
|
485
|
-
- Search response shape: `{ status: "ok", result: { points: [{ id, score, payload? }] } }`.
|
|
486
|
-
- `PUT /collections/:collection/index` is a no-op (Qdrant compatibility; Roo Code calls this for payload indexes). The YDB vector index (`emb_idx`) is built automatically after ≥100 points are upserted + 5-second quiet window. Incremental updates (<100 points) skip rebuild.
|
|
487
|
-
|
|
488
|
-
For broader Qdrant API coverage, extend routes in `src/routes/*`.
|
|
489
|
-
|
|
490
|
-
## Releasing & publishing (maintainers)
|
|
491
|
-
|
|
492
|
-
- **Versioning**
|
|
493
|
-
- Use semantic versioning as described in the npm docs.
|
|
494
|
-
- From `ydb-qdrant/`, run `npm version patch|minor|major` to bump the version and create a git tag (for example, `ydb-qdrant-v0.2.0`).
|
|
495
|
-
- **Manual publish**
|
|
496
|
-
- Ensure you are logged in to npm (`npm whoami`).
|
|
497
|
-
- From `ydb-qdrant/`, run:
|
|
498
|
-
- `npm publish`
|
|
499
|
-
This will run tests and build via the `prepublishOnly` script before uploading the tarball.
|
|
500
|
-
- **CI publish**
|
|
501
|
-
- GitHub Actions workflow `.github/workflows/publish-ydb-qdrant.yml` publishes on tags matching `ydb-qdrant-v*`.
|
|
502
|
-
- Configure the `NPM_TOKEN` secret in the repository; the workflow runs `npm ci`, `npm test`, `npm run build`, and `npm publish`.
|
|
503
|
-
|
|
504
|
-
## References
|
|
505
|
-
- YDB docs (overview): https://ydb.tech/docs/en/
|
|
506
|
-
- YDB vector indexes (vector_kmeans_tree): https://ydb.tech/docs/en/dev/vector-indexes
|
|
507
|
-
- YDB VIEW syntax for indexes: https://ydb.tech/docs/en/yql/reference/syntax/select/secondary_index
|
|
508
|
-
- YQL getting started: https://ydb.tech/docs/en/getting_started/yql/
|
|
509
|
-
- YQL reference (syntax, functions): https://ydb.tech/docs/en/yql/reference/
|
|
510
|
-
- YQL functions index: https://ydb.tech/docs/en/yql/reference/functions/
|
|
511
|
-
- ydb-sdk (Node.js): https://github.com/ydb-platform/ydb-nodejs-sdk
|
|
512
|
-
- YDB Cloud (endpoints, auth): https://cloud.yandex.com/en/docs/ydb/
|
|
330
|
+
## Architecture and Storage
|
|
331
|
+
|
|
332
|
+
For details on the YDB storage layout (multi_table vs one_table), vector serialization, vector index auto-build behavior, request normalization, and Qdrant compatibility semantics, see [docs/architecture-and-storage.md](docs/architecture-and-storage.md).
|
|
333
|
+
|
|
334
|
+
## Evaluation, CI, and Release
|
|
335
|
+
|
|
336
|
+
Badges at the top of this README link to build, test, integration, and recall/F1 workflows. For a deeper explanation of how recall is measured and how publishing to npm works, see [docs/evaluation-and-ci.md](docs/evaluation-and-ci.md).
|
package/dist/config/env.d.ts
CHANGED
|
@@ -3,11 +3,11 @@ export declare const YDB_ENDPOINT: string;
|
|
|
3
3
|
export declare const YDB_DATABASE: string;
|
|
4
4
|
export declare const PORT: number;
|
|
5
5
|
export declare const LOG_LEVEL: string;
|
|
6
|
-
export declare const GLOBAL_POINTS_AUTOMIGRATE_ENABLED: boolean;
|
|
7
|
-
export declare const VECTOR_INDEX_BUILD_ENABLED: boolean;
|
|
8
6
|
export declare enum CollectionStorageMode {
|
|
9
7
|
MultiTable = "multi_table",
|
|
10
8
|
OneTable = "one_table"
|
|
11
9
|
}
|
|
12
10
|
export declare const COLLECTION_STORAGE_MODE: CollectionStorageMode;
|
|
11
|
+
export declare const GLOBAL_POINTS_AUTOMIGRATE_ENABLED: boolean;
|
|
12
|
+
export declare const VECTOR_INDEX_BUILD_ENABLED: boolean;
|
|
13
13
|
export declare function isOneTableMode(mode: CollectionStorageMode): mode is CollectionStorageMode.OneTable;
|
package/dist/config/env.js
CHANGED
|
@@ -3,7 +3,6 @@ export const YDB_ENDPOINT = process.env.YDB_ENDPOINT ?? "";
|
|
|
3
3
|
export const YDB_DATABASE = process.env.YDB_DATABASE ?? "";
|
|
4
4
|
export const PORT = process.env.PORT ? Number(process.env.PORT) : 8080;
|
|
5
5
|
export const LOG_LEVEL = process.env.LOG_LEVEL ?? "info";
|
|
6
|
-
export const GLOBAL_POINTS_AUTOMIGRATE_ENABLED = parseBooleanEnv(process.env.YDB_QDRANT_GLOBAL_POINTS_AUTOMIGRATE, false);
|
|
7
6
|
function parseBooleanEnv(value, defaultValue) {
|
|
8
7
|
if (value === undefined) {
|
|
9
8
|
return defaultValue;
|
|
@@ -18,7 +17,6 @@ function parseBooleanEnv(value, defaultValue) {
|
|
|
18
17
|
}
|
|
19
18
|
return true;
|
|
20
19
|
}
|
|
21
|
-
export const VECTOR_INDEX_BUILD_ENABLED = parseBooleanEnv(process.env.VECTOR_INDEX_BUILD_ENABLED, false);
|
|
22
20
|
export var CollectionStorageMode;
|
|
23
21
|
(function (CollectionStorageMode) {
|
|
24
22
|
CollectionStorageMode["MultiTable"] = "multi_table";
|
|
@@ -33,6 +31,8 @@ function resolveCollectionStorageModeEnv() {
|
|
|
33
31
|
return CollectionStorageMode.MultiTable;
|
|
34
32
|
}
|
|
35
33
|
export const COLLECTION_STORAGE_MODE = resolveCollectionStorageModeEnv();
|
|
34
|
+
export const GLOBAL_POINTS_AUTOMIGRATE_ENABLED = parseBooleanEnv(process.env.YDB_QDRANT_GLOBAL_POINTS_AUTOMIGRATE, false);
|
|
35
|
+
export const VECTOR_INDEX_BUILD_ENABLED = parseBooleanEnv(process.env.VECTOR_INDEX_BUILD_ENABLED, COLLECTION_STORAGE_MODE === CollectionStorageMode.MultiTable);
|
|
36
36
|
export function isOneTableMode(mode) {
|
|
37
37
|
return mode === CollectionStorageMode.OneTable;
|
|
38
38
|
}
|
package/dist/ydb/schema.js
CHANGED
|
@@ -60,7 +60,11 @@ export async function ensureGlobalPointsTable() {
|
|
|
60
60
|
ALTER TABLE ${GLOBAL_POINTS_TABLE}
|
|
61
61
|
ADD COLUMN embedding_bit String;
|
|
62
62
|
`;
|
|
63
|
-
|
|
63
|
+
const rawSession = s;
|
|
64
|
+
await rawSession.api.executeSchemeQuery({
|
|
65
|
+
sessionId: rawSession.sessionId,
|
|
66
|
+
yqlText: alterDdl,
|
|
67
|
+
});
|
|
64
68
|
logger.info(`added embedding_bit column to existing table ${GLOBAL_POINTS_TABLE}`);
|
|
65
69
|
needsBackfill = true;
|
|
66
70
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ydb-qdrant",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.4.0",
|
|
4
4
|
"main": "dist/package/api.js",
|
|
5
5
|
"types": "dist/package/api.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
"scripts": {
|
|
17
17
|
"test": "vitest run --exclude \"test/integration/**\"",
|
|
18
18
|
"test:coverage": "vitest run --coverage --exclude \"test/integration/**\"",
|
|
19
|
-
"test:integration": "VECTOR_INDEX_BUILD_ENABLED=false vitest run test/integration/YdbRealIntegration.index-disabled.test.ts && VECTOR_INDEX_BUILD_ENABLED=true vitest run test/integration/YdbRealIntegration.test.ts",
|
|
19
|
+
"test:integration": "VECTOR_INDEX_BUILD_ENABLED=false vitest run test/integration/YdbRealIntegration.index-disabled.test.ts && VECTOR_INDEX_BUILD_ENABLED=true vitest run test/integration/YdbRealIntegration.test.ts test/integration/YdbRecallIntegration.test.ts && YDB_QDRANT_COLLECTION_STORAGE_MODE=one_table vitest run test/integration/YdbRealIntegration.one-table.test.ts",
|
|
20
|
+
"test:recall": "VECTOR_INDEX_BUILD_ENABLED=true vitest run test/integration/YdbRecallIntegration.test.ts && YDB_QDRANT_COLLECTION_STORAGE_MODE=one_table vitest run test/integration/YdbRealIntegration.one-table.test.ts",
|
|
20
21
|
"build": "tsc -p tsconfig.json",
|
|
21
22
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
22
23
|
"dev": "tsx watch src/index.ts",
|
|
@@ -80,4 +81,4 @@
|
|
|
80
81
|
"typescript-eslint": "^8.47.0",
|
|
81
82
|
"vitest": "^4.0.12"
|
|
82
83
|
}
|
|
83
|
-
}
|
|
84
|
+
}
|