Skip to content

feat: add Qdrant vector database client for JavaScript SDK (#273)#456

Open
tarai-dl wants to merge 1 commit intoarakoodev:tsfrom
tarai-dl:rn/qdrant-vector-db-support
Open

feat: add Qdrant vector database client for JavaScript SDK (#273)#456
tarai-dl wants to merge 1 commit intoarakoodev:tsfrom
tarai-dl:rn/qdrant-vector-db-support

Conversation

@tarai-dl
Copy link
Copy Markdown

Summary

Implements Qdrant vector database support for the JavaScript SDK, addressing bounty issue #273.

Uses the Qdrant REST API directly as requested (no qdrant npm packages).

Changes

  • New module: QdrantClient class in db/src/lib/qdrant-client/QdrantClient.ts
  • Exported from: @arakoodev/edgechains.js/db
  • Distance metrics: Cosine, Inner Product (Dot), L2 (Euclid) — matching Qdrant's native metrics
  • Namespace filtering: Multi-tenant support via Qdrant payload filters
  • RRF scoring: Reciprocal Rank Fusion with configurable text/similarity/date weights (matching PostgresClient pattern)
  • CRUD operations: Search, create collection, upsert points, delete points, get collection info
  • Tests: Comprehensive Jest unit tests with mocks

Usage

import { QdrantClient, QdrantDistanceMetric } from "@arakoodev/edgechains.js/db";

const client = new QdrantClient(
    wordEmbeddings,           // number[][]
    QdrantDistanceMetric.COSINE,
    10,                       // topK
    "my_collection",          // collection name
    "my_namespace",           // namespace filter
    arkRequest,               // RRF weight config
    20,                       // upperLimit
    "localhost",              // Qdrant host
    6333                      // Qdrant port
);

// Search vectors
const results = await client.dbQuery();

// Create collection
await client.createCollection(384); // vector dimension

// Upsert points
await client.upsertPoints([{
    id: "doc1",
    vector: [0.1, 0.2, ...],
    payload: { raw_text: "...", namespace: "my_ns" }
}]);

API Compatibility

The dbQuery() method returns results in the same format as PostgresClient, making it a drop-in replacement:

// Switching from Postgres to Qdrant:
// const client = new PostgresClient(embeddings, metric, topK, probes, table, ns, arkRequest, limit);
const client = new QdrantClient(embeddings, metric, topK, collection, ns, arkRequest, limit, host, port);
const results = await client.dbQuery(); // Same interface

Closes #273

…#273)

Implements Qdrant vector database support following the same pattern as
the existing PostgresClient. Uses the Qdrant REST API directly as
requested (no qdrant npm packages).

Features:
- QdrantClient class with full CRUD operations (search, create collection,
  upsert points, delete points, get collection info)
- Support for Cosine, Inner Product (Dot), and L2 (Euclid) distance metrics
- Namespace filtering for multi-tenant support
- RRF (Reciprocal Rank Fusion) scoring with configurable weights
- Deduplication and configurable result sorting
- TypeScript with full type definitions
- Comprehensive unit tests with Jest mocks

Usage:
  import { QdrantClient, QdrantDistanceMetric } from '@arakoodev/edgechains.js/db'

  const client = new QdrantClient(
    embeddings, QdrantDistanceMetric.COSINE, 10,
    'my_collection', 'my_namespace', arkRequest, 20,
    'localhost', 6333
  )
  const results = await client.dbQuery()

Closes arakoodev#273
@github-actions
Copy link
Copy Markdown

CLA Assistant Lite bot: Thank you for your submission, we really appreciate it. Before we can accept your contribution, we ask that you sign the Arakoo Contributor License Agreement. You can sign the CLA by adding a new comment to this pull request and pasting exactly the following text.


I have read the Arakoo CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BOUNTY: add support for qdrant vector database in javascript sdk

1 participant