@bridgerust/embex 0.1.3 → 0.1.7

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 CHANGED
@@ -26,49 +26,50 @@ bun add embex
26
26
 
27
27
  ## ⚡ Quick Start
28
28
 
29
- ### 1. Connect to a Provider
29
+ **Try Embex in 30 seconds - No setup required!** Uses LanceDB embedded mode (no server needed).
30
30
 
31
31
  ```typescript
32
- import { EmbexClient } from "embex";
33
-
34
- // Connect to Qdrant
35
- const client = new EmbexClient("qdrant", "http://localhost:6333");
36
-
37
- // Or use async initialization (required for some providers like LanceDB/Milvus)
38
- const client = await EmbexClient.newAsync("lancedb", "./data/lancedb");
39
- ```
40
-
41
- ### 2. Create a Collection
42
-
43
- ```typescript
44
- const collection = client.collection("my_collection");
45
-
46
- // Create with specific dimension and metric
47
- await collection.create(768, "cosine");
32
+ import { EmbexClient } from "@bridgerust/embex";
33
+
34
+ async function main() {
35
+ // LanceDB embedded - zero setup, just a local path
36
+ const client = await EmbexClient.newAsync("lancedb", "./data");
37
+ const collection = client.collection("documents");
38
+
39
+ // Create collection
40
+ await collection.create(768, "cosine");
41
+
42
+ // Insert data
43
+ await collection.insert([
44
+ {
45
+ id: "1",
46
+ vector: Array(768).fill(0.1),
47
+ metadata: { text: "Hello World" },
48
+ },
49
+ ]);
50
+
51
+ // Search
52
+ const results = await collection.search(Array(768).fill(0.1), 5);
53
+ console.log(results.results);
54
+ }
55
+
56
+ main();
48
57
  ```
49
58
 
50
- ### 3. Insert Vectors
59
+ **Run it:** `npx tsx examples/lancedb/node/quickstart.ts`
51
60
 
52
- ```typescript
53
- await collection.insert([
54
- {
55
- id: "1",
56
- vector: [0.1, 0.2, ...], // 768 dimensions
57
- metadata: { title: "Hello World", category: "greeting" }
58
- }
59
- ]);
60
- ```
61
+ ### All Provider Quick Starts
61
62
 
62
- ### 4. Search
63
+ Try Embex with any provider! Same API, different backend:
63
64
 
64
- ```typescript
65
- const results = await collection.search(
66
- [0.1, 0.2, ...], // Query vector
67
- 5 // Limit
68
- );
65
+ | Provider | Setup | Quick Start |
66
+ | ------------ | --------------- | ---------------------------------------------- |
67
+ | **LanceDB** | None (embedded) | `npx tsx examples/lancedb/node/quickstart.ts` |
68
+ | **Qdrant** | Docker server | `npx tsx examples/qdrant/node/quickstart.ts` |
69
+ | **Pinecone** | API key | `npx tsx examples/pinecone/node/quickstart.ts` |
70
+ | **Chroma** | Optional server | `npx tsx examples/chroma/node/quickstart.ts` |
69
71
 
70
- console.log(results.results);
71
- ```
72
+ > 💡 **Same API everywhere!** Just change the provider name - all code stays the same. See [examples/README.md](../../../../examples/README.md) for setup instructions.
72
73
 
73
74
  ### 5. Filtered Search (Builder Pattern)
74
75
 
@@ -81,6 +82,38 @@ const results = await collection.buildSearch([0.1, 0.2, ...])
81
82
  .execute();
82
83
  ```
83
84
 
85
+ ## ☁️ Connecting to Cloud Providers
86
+
87
+ To connect to managed services like Pinecone, Qdrant Cloud, or Zilliz (Milvus), simply provide your API key and endpoint URL.
88
+
89
+ ```typescript
90
+ import { EmbexClient } from "@bridgerust/embex";
91
+
92
+ // Connect to Pinecone
93
+ const client = new EmbexClient(
94
+ "pinecone",
95
+ "https://index-name.svc.pinecone.io",
96
+ process.env.PINECONE_API_KEY
97
+ );
98
+
99
+ // Connect to Qdrant Cloud
100
+ const qdrantClient = new EmbexClient(
101
+ "qdrant",
102
+ "https://xyz-example.eu-central.aws.cloud.qdrant.io:6333",
103
+ process.env.QDRANT_API_KEY
104
+ );
105
+ ```
106
+
107
+ ### Official Documentation & API Keys
108
+
109
+ Need help finding your API key? Check the official provider documentation:
110
+
111
+ - **Pinecone**: [Authentication & API Keys](https://docs.pinecone.io/guides/get-started/quickstart#2-get-an-api-key)
112
+ - **Qdrant**: [Cloud Authentication](https://qdrant.tech/documentation/cloud/authentication/)
113
+ - **Milvus (Zilliz)**: [Manage Credentials](https://docs.zilliz.com/docs/manage-api-keys)
114
+ - **Weaviate**: [Authentication](https://weaviate.io/developers/weaviate/configuration/authentication)
115
+ - **Chroma**: [Auth & Client Settings](https://docs.trychroma.com/guides#authentication)
116
+
84
117
  ## 🔌 Supported Providers
85
118
 
86
119
  | Provider | Key | Async Init? |
@@ -0,0 +1,133 @@
1
+ # Embex (Node.js)
2
+
3
+ **The Universal Vector Database ORM.** One API for Qdrant, Pinecone, Chroma, LanceDB, and more.
4
+
5
+ Embex is a high-performance, universal client for vector databases, built on a shared Rust core related to [BridgeRust](https://github.com/bridgerust/bridgerust).
6
+
7
+ ## 🚀 Features
8
+
9
+ - **Unified API**: Switch providers instantly. "Write once, run anywhere."
10
+ - **Performance**: Powered by Rust with SIMD acceleration.
11
+ - **Type Safety**: Full TypeScript support.
12
+
13
+ ## 📦 Installation
14
+
15
+ ```bash
16
+ npm install embex
17
+ ```
18
+
19
+ ```bash
20
+ yarn add embex
21
+ ```
22
+
23
+ ```bash
24
+ bun add embex
25
+ ```
26
+
27
+ ## ⚡ Quick Start
28
+
29
+ **Try Embex in 30 seconds - No setup required!** Uses LanceDB embedded mode (no server needed).
30
+
31
+ ```typescript
32
+ import { EmbexClient } from "@bridgerust/embex";
33
+
34
+ async function main() {
35
+ // LanceDB embedded - zero setup, just a local path
36
+ const client = await EmbexClient.newAsync("lancedb", "./data");
37
+ const collection = client.collection("documents");
38
+
39
+ // Create collection
40
+ await collection.create(768, "cosine");
41
+
42
+ // Insert data
43
+ await collection.insert([
44
+ {
45
+ id: "1",
46
+ vector: Array(768).fill(0.1),
47
+ metadata: { text: "Hello World" },
48
+ },
49
+ ]);
50
+
51
+ // Search
52
+ const results = await collection.search(Array(768).fill(0.1), 5);
53
+ console.log(results.results);
54
+ }
55
+
56
+ main();
57
+ ```
58
+
59
+ **Run it:** `npx tsx examples/lancedb/node/quickstart.ts`
60
+
61
+ ### All Provider Quick Starts
62
+
63
+ Try Embex with any provider! Same API, different backend:
64
+
65
+ | Provider | Setup | Quick Start |
66
+ | ------------ | --------------- | ---------------------------------------------- |
67
+ | **LanceDB** | None (embedded) | `npx tsx examples/lancedb/node/quickstart.ts` |
68
+ | **Qdrant** | Docker server | `npx tsx examples/qdrant/node/quickstart.ts` |
69
+ | **Pinecone** | API key | `npx tsx examples/pinecone/node/quickstart.ts` |
70
+ | **Chroma** | Optional server | `npx tsx examples/chroma/node/quickstart.ts` |
71
+
72
+ > 💡 **Same API everywhere!** Just change the provider name - all code stays the same. See [examples/README.md](../../../../examples/README.md) for setup instructions.
73
+
74
+ ### 5. Filtered Search (Builder Pattern)
75
+
76
+ ```typescript
77
+ const results = await collection.buildSearch([0.1, 0.2, ...])
78
+ .limit(10)
79
+ .filter({
80
+ course: "CS101"
81
+ })
82
+ .execute();
83
+ ```
84
+
85
+ ## ☁️ Connecting to Cloud Providers
86
+
87
+ To connect to managed services like Pinecone, Qdrant Cloud, or Zilliz (Milvus), simply provide your API key and endpoint URL.
88
+
89
+ ```typescript
90
+ import { EmbexClient } from "@bridgerust/embex";
91
+
92
+ // Connect to Pinecone
93
+ const client = new EmbexClient(
94
+ "pinecone",
95
+ "https://index-name.svc.pinecone.io",
96
+ process.env.PINECONE_API_KEY
97
+ );
98
+
99
+ // Connect to Qdrant Cloud
100
+ const qdrantClient = new EmbexClient(
101
+ "qdrant",
102
+ "https://xyz-example.eu-central.aws.cloud.qdrant.io:6333",
103
+ process.env.QDRANT_API_KEY
104
+ );
105
+ ```
106
+
107
+ ### Official Documentation & API Keys
108
+
109
+ Need help finding your API key? Check the official provider documentation:
110
+
111
+ - **Pinecone**: [Authentication & API Keys](https://docs.pinecone.io/guides/get-started/quickstart#2-get-an-api-key)
112
+ - **Qdrant**: [Cloud Authentication](https://qdrant.tech/documentation/cloud/authentication/)
113
+ - **Milvus (Zilliz)**: [Manage Credentials](https://docs.zilliz.com/docs/manage-api-keys)
114
+ - **Weaviate**: [Authentication](https://weaviate.io/developers/weaviate/configuration/authentication)
115
+ - **Chroma**: [Auth & Client Settings](https://docs.trychroma.com/guides#authentication)
116
+
117
+ ## 🔌 Supported Providers
118
+
119
+ | Provider | Key | Async Init? |
120
+ | -------- | ---------- | ----------- |
121
+ | Qdrant | `qdrant` | No |
122
+ | Chroma | `chroma` | No |
123
+ | Pinecone | `pinecone` | No |
124
+ | Weaviate | `weaviate` | No |
125
+ | LanceDB | `lancedb` | **Yes** |
126
+ | Milvus | `milvus` | **Yes** |
127
+ | PgVector | `pgvector` | **Yes** |
128
+
129
+ ## 🔗 Resources
130
+
131
+ - **Main Repository**: [github.com/bridgerust/bridgerust](https://github.com/bridgerust/bridgerust)
132
+ - **Issues**: [github.com/bridgerust/bridgerust/issues](https://github.com/bridgerust/bridgerust/issues)
133
+ - **Documentation**: [Full Docs](https://github.com/bridgerust/bridgerust#documentation)
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "@bridgerust/embex-darwin-arm64",
3
+ "version": "0.1.7",
4
+ "description": "Embex Vector Database ORM Node.js Bindings",
5
+ "os": [
6
+ "darwin"
7
+ ],
8
+ "cpu": [
9
+ "arm64"
10
+ ],
11
+ "main": "embex.darwin-arm64.node",
12
+ "files": [
13
+ "embex.darwin-arm64.node"
14
+ ],
15
+ "license": "MIT",
16
+ "engines": {
17
+ "node": ">= 10"
18
+ }
19
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bridgerust/embex",
3
- "version": "0.1.3",
3
+ "version": "0.1.7",
4
4
  "description": "Embex Vector Database ORM Node.js Bindings",
5
5
  "homepage": "https://github.com/bridgerust/bridgerust/embex",
6
6
  "repository": {
@@ -48,12 +48,12 @@
48
48
  "scripts": {
49
49
  "build": "napi build --platform --release --js native.js --dts native.d.ts && tsc",
50
50
  "build:debug": "napi build --platform --js native.js --dts native.d.ts && tsc",
51
- "prepublishOnly": "napi prepublish -t npm",
52
51
  "artifacts": "napi artifacts",
53
52
  "test": "vitest run",
54
53
  "test:unit": "vitest run tests/unit",
55
54
  "test:integration": "vitest run tests/integration",
56
- "test:watch": "vitest watch"
55
+ "test:watch": "vitest watch",
56
+ "prepublishOnly": "napi prepublish -t npm"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@napi-rs/cli": "^3.5.0",
@@ -61,11 +61,11 @@
61
61
  "@types/node": "^25.0.3"
62
62
  },
63
63
  "optionalDependencies": {
64
- "@bridgerust/embex-darwin-arm64": "0.1.3",
65
- "@bridgerust/embex-darwin-x64": "0.1.3",
66
- "@bridgerust/embex-linux-x64-musl": "0.1.3",
67
- "@bridgerust/embex-linux-arm64-musl": "0.1.3",
68
- "@bridgerust/embex-win32-ia32-msvc": "0.1.3",
69
- "@bridgerust/embex-linux-arm-gnueabihf": "0.1.3"
64
+ "@bridgerust/embex-darwin-arm64": "0.1.7",
65
+ "@bridgerust/embex-darwin-x64": "0.1.7",
66
+ "@bridgerust/embex-linux-x64-musl": "0.1.7",
67
+ "@bridgerust/embex-linux-arm64-musl": "0.1.7",
68
+ "@bridgerust/embex-win32-ia32-msvc": "0.1.7",
69
+ "@bridgerust/embex-linux-arm-gnueabihf": "0.1.7"
70
70
  }
71
71
  }
package/dist/index.js DELETED
@@ -1,17 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./src"), exports);
package/dist/src/index.js DELETED
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.cli = exports.SearchBuilder = exports.QueryBuilder = exports.EmbexClient = exports.Collection = void 0;
4
- const native_1 = require("../native");
5
- Object.defineProperty(exports, "Collection", { enumerable: true, get: function () { return native_1.Collection; } });
6
- Object.defineProperty(exports, "EmbexClient", { enumerable: true, get: function () { return native_1.EmbexClient; } });
7
- Object.defineProperty(exports, "QueryBuilder", { enumerable: true, get: function () { return native_1.QueryBuilder; } });
8
- Object.defineProperty(exports, "SearchBuilder", { enumerable: true, get: function () { return native_1.SearchBuilder; } });
9
- Object.defineProperty(exports, "cli", { enumerable: true, get: function () { return
10
- // @ts-ignore
11
- native_1.cli; } });
12
- // Monkey patch
13
- native_1.Collection.prototype.insertStream = async function (points, parallel = 5) {
14
- const BATCH_SIZE = 100;
15
- let batch = [];
16
- for await (const point of points) {
17
- batch.push(point);
18
- if (batch.length >= BATCH_SIZE) {
19
- await this.insertBatch(batch, BATCH_SIZE, parallel);
20
- batch = [];
21
- }
22
- }
23
- if (batch.length > 0) {
24
- await this.insertBatch(batch, BATCH_SIZE, parallel);
25
- }
26
- };