endee 1.0.7 → 1.0.8-dev.2
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 +279 -153
- package/dist/crypto.d.ts.map +1 -1
- package/dist/crypto.js +15 -20
- package/dist/crypto.js.map +1 -1
- package/dist/{endee.d.ts → endee.class.d.ts} +3 -7
- package/dist/endee.class.d.ts.map +1 -0
- package/dist/{endee.js → endee.class.js} +32 -28
- package/dist/endee.class.js.map +1 -0
- package/dist/exceptions.js +15 -15
- package/dist/{indexClient.d.ts → index.class.d.ts} +8 -13
- package/dist/index.class.d.ts.map +1 -0
- package/dist/{indexClient.js → index.class.js} +96 -39
- package/dist/index.class.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/types/index.d.ts +21 -6
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/userClient.d.ts.map +1 -1
- package/dist/userClient.js +35 -35
- package/dist/userClient.js.map +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +14 -4
- package/dist/utils.js.map +1 -1
- package/package.json +27 -4
- package/dist/endee.d.ts.map +0 -1
- package/dist/endee.js.map +0 -1
- package/dist/indexClient.d.ts.map +0 -1
- package/dist/indexClient.js.map +0 -1
package/dist/crypto.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crypto.js","sourceRoot":"","sources":["../src/crypto.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,MAAM,UAAU,WAAW,CAAC,GAAkB;IAC5C,sDAAsD;IACtD,IAAI,GAAG,KAAK,IAAI;QAAE,OAAO,CAAC,CAAC,CAAC;IAC5B,OAAO,QAAQ,CAAC,GAAG,CAAC,KAAK,CAA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Options } from './types/index.js';
|
|
6
3
|
export declare class Endee {
|
|
7
4
|
private token;
|
|
@@ -9,10 +6,9 @@ export declare class Endee {
|
|
|
9
6
|
private version;
|
|
10
7
|
constructor(token?: string | null);
|
|
11
8
|
setBaseUrl(url: string): string;
|
|
12
|
-
generateKey(): string;
|
|
13
9
|
createIndex(options: CreateIndexOptions): Promise<string>;
|
|
14
10
|
listIndexes(): Promise<unknown>;
|
|
15
11
|
deleteIndex(name: string): Promise<string>;
|
|
16
|
-
getIndex(name: string
|
|
12
|
+
getIndex(name: string): Promise<Index>;
|
|
17
13
|
}
|
|
18
|
-
//# sourceMappingURL=endee.d.ts.map
|
|
14
|
+
//# sourceMappingURL=endee.class.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endee.class.d.ts","sourceRoot":"","sources":["../src/endee.class.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAa,KAAK,kBAAkB,EAAkB,MAAM,kBAAkB,CAAC;AAEtF,qBAAa,KAAK;IAChB,OAAO,CAAC,KAAK,CAAgB;IAC7B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,OAAO,CAAS;gBAEZ,KAAK,GAAE,MAAM,GAAG,IAAW;IAavC,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAKzB,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAkEzD,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAgB/B,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAuB1C,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;CAiC7C"}
|
|
@@ -2,21 +2,19 @@
|
|
|
2
2
|
* Main Endee client for Endee-DB
|
|
3
3
|
*/
|
|
4
4
|
import axios from 'axios';
|
|
5
|
-
import crypto from 'crypto';
|
|
6
5
|
import { raiseException } from './exceptions.js';
|
|
7
|
-
import { Index } from './
|
|
8
|
-
import { isValidIndexName
|
|
6
|
+
import { Index } from './index.class.js';
|
|
7
|
+
import { isValidIndexName } from './utils.js';
|
|
9
8
|
import { Precision } from './types/index.js';
|
|
10
|
-
import { getChecksum } from './crypto.js';
|
|
11
9
|
export class Endee {
|
|
12
10
|
token;
|
|
13
11
|
baseUrl;
|
|
14
12
|
version;
|
|
15
13
|
constructor(token = null) {
|
|
16
14
|
this.token = token;
|
|
17
|
-
this.baseUrl =
|
|
15
|
+
this.baseUrl = 'http://127.0.0.1:8080/api/v1';
|
|
18
16
|
if (token) {
|
|
19
|
-
const tokenParts = token.split(
|
|
17
|
+
const tokenParts = token.split(':');
|
|
20
18
|
if (tokenParts.length > 2) {
|
|
21
19
|
this.baseUrl = `https://${tokenParts[2]}.endee.io/api/v1`;
|
|
22
20
|
this.token = `${tokenParts[0]}:${tokenParts[1]}`;
|
|
@@ -28,27 +26,24 @@ export class Endee {
|
|
|
28
26
|
this.baseUrl = url;
|
|
29
27
|
return url;
|
|
30
28
|
}
|
|
31
|
-
generateKey() {
|
|
32
|
-
// Generate a random hex key of 32 bytes (256 bit)
|
|
33
|
-
const key = crypto.randomBytes(32).toString('hex');
|
|
34
|
-
console.log("Store this encryption key in a secure location. Loss of the key will result in the irreversible loss of associated vector data.\nKey: ", key);
|
|
35
|
-
return key;
|
|
36
|
-
}
|
|
37
29
|
async createIndex(options) {
|
|
38
|
-
const { name, dimension, spaceType = 'cosine', M = 16, efCon = 128,
|
|
30
|
+
const { name, dimension, spaceType = 'cosine', M = 16, efCon = 128, precision = Precision.INT8D, version = null, sparseDimension = null, } = options;
|
|
39
31
|
if (!isValidIndexName(name)) {
|
|
40
|
-
throw new Error(
|
|
32
|
+
throw new Error('Invalid index name. Index name must be alphanumeric and can contain underscores and less than 48 characters');
|
|
41
33
|
}
|
|
42
34
|
if (dimension > 10000) {
|
|
43
|
-
throw new Error(
|
|
35
|
+
throw new Error('Dimension cannot be greater than 10000');
|
|
36
|
+
}
|
|
37
|
+
if (sparseDimension && sparseDimension < 0) {
|
|
38
|
+
throw new Error('Sparse dimension cannot be less than 0');
|
|
44
39
|
}
|
|
45
40
|
const normalizedSpaceType = spaceType.toLowerCase();
|
|
46
|
-
if (![
|
|
41
|
+
if (!['cosine', 'l2', 'ip'].includes(normalizedSpaceType)) {
|
|
47
42
|
throw new Error(`Invalid space type: ${spaceType}`);
|
|
48
43
|
}
|
|
49
44
|
const headers = {
|
|
50
45
|
Authorization: `${this.token}`,
|
|
51
|
-
|
|
46
|
+
'Content-Type': 'application/json',
|
|
52
47
|
};
|
|
53
48
|
const data = {
|
|
54
49
|
index_name: name,
|
|
@@ -56,10 +51,13 @@ export class Endee {
|
|
|
56
51
|
space_type: normalizedSpaceType,
|
|
57
52
|
M: M,
|
|
58
53
|
ef_con: efCon,
|
|
59
|
-
checksum:
|
|
54
|
+
checksum: -1,
|
|
60
55
|
precision: precision,
|
|
61
56
|
version: version,
|
|
62
57
|
};
|
|
58
|
+
if (sparseDimension) {
|
|
59
|
+
data.sparse_dim = sparseDimension;
|
|
60
|
+
}
|
|
63
61
|
if (version !== undefined) {
|
|
64
62
|
data.version = version;
|
|
65
63
|
}
|
|
@@ -80,7 +78,7 @@ export class Endee {
|
|
|
80
78
|
console.error(response.data);
|
|
81
79
|
raiseException(response.status, response.data);
|
|
82
80
|
}
|
|
83
|
-
return
|
|
81
|
+
return 'Index created successfully';
|
|
84
82
|
}
|
|
85
83
|
async listIndexes() {
|
|
86
84
|
const headers = {
|
|
@@ -121,10 +119,10 @@ export class Endee {
|
|
|
121
119
|
}
|
|
122
120
|
return `Index ${name} deleted successfully`;
|
|
123
121
|
}
|
|
124
|
-
async getIndex(name
|
|
122
|
+
async getIndex(name) {
|
|
125
123
|
const headers = {
|
|
126
124
|
Authorization: `${this.token}`,
|
|
127
|
-
|
|
125
|
+
'Content-Type': 'application/json',
|
|
128
126
|
};
|
|
129
127
|
let response;
|
|
130
128
|
try {
|
|
@@ -139,13 +137,19 @@ export class Endee {
|
|
|
139
137
|
throw err;
|
|
140
138
|
}
|
|
141
139
|
const data = response.data;
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
140
|
+
const indexInfo = {
|
|
141
|
+
name: data.index_name,
|
|
142
|
+
spaceType: data.space_type,
|
|
143
|
+
dimension: data.dimension,
|
|
144
|
+
total_elements: data.total_elements,
|
|
145
|
+
precision: data.precision,
|
|
146
|
+
M: data.M,
|
|
147
|
+
checksum: data.checksum,
|
|
148
|
+
version: data.version,
|
|
149
|
+
sparseDimension: data.sparse_dim,
|
|
150
|
+
};
|
|
151
|
+
const idx = new Index(name, this.token, this.baseUrl, this.version, indexInfo);
|
|
148
152
|
return idx;
|
|
149
153
|
}
|
|
150
154
|
}
|
|
151
|
-
//# sourceMappingURL=endee.js.map
|
|
155
|
+
//# sourceMappingURL=endee.class.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endee.class.js","sourceRoot":"","sources":["../src/endee.class.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,SAAS,EAA2C,MAAM,kBAAkB,CAAC;AAEtF,MAAM,OAAO,KAAK;IACR,KAAK,CAAgB;IACrB,OAAO,CAAS;IAChB,OAAO,CAAS;IAExB,YAAY,QAAuB,IAAI;QACrC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,OAAO,GAAG,8BAA8B,CAAC;QAC9C,IAAI,KAAK,EAAE,CAAC;YACV,MAAM,UAAU,GAAG,KAAK,C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,EAAE,IAAI,CAAC,QAAQ;YACvB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,eAAe,EAAE,IAAI,CAAC,UAAU;SACjC,CAAC;QAEF,MAAM,GAAG,GAAG,IAAI,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,KAAM,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;QAChF,OAAO,GAAG,CAAC;IACb,CAAC;CACF"}
|
package/dist/exceptions.js
CHANGED
|
@@ -2,58 +2,58 @@
|
|
|
2
2
|
* Exception classes for Endee-DB
|
|
3
3
|
*/
|
|
4
4
|
export class EndeeException extends Error {
|
|
5
|
-
constructor(message =
|
|
5
|
+
constructor(message = 'An error occurred in Endee-DB') {
|
|
6
6
|
super(message);
|
|
7
|
-
this.name =
|
|
7
|
+
this.name = 'EndeeException';
|
|
8
8
|
Object.setPrototypeOf(this, EndeeException.prototype);
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
export class APIException extends EndeeException {
|
|
12
12
|
constructor(message) {
|
|
13
13
|
super(`API Error: ${message}`);
|
|
14
|
-
this.name =
|
|
14
|
+
this.name = 'APIException';
|
|
15
15
|
Object.setPrototypeOf(this, APIException.prototype);
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
export class ServerException extends EndeeException {
|
|
19
19
|
constructor(message) {
|
|
20
20
|
super(`Server Busy: ${message}`);
|
|
21
|
-
this.name =
|
|
21
|
+
this.name = 'ServerException';
|
|
22
22
|
Object.setPrototypeOf(this, ServerException.prototype);
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
export class ForbiddenException extends EndeeException {
|
|
26
26
|
constructor(message) {
|
|
27
27
|
super(`Forbidden: ${message}`);
|
|
28
|
-
this.name =
|
|
28
|
+
this.name = 'ForbiddenException';
|
|
29
29
|
Object.setPrototypeOf(this, ForbiddenException.prototype);
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
export class ConflictException extends EndeeException {
|
|
33
33
|
constructor(message) {
|
|
34
34
|
super(`Conflict: ${message}`);
|
|
35
|
-
this.name =
|
|
35
|
+
this.name = 'ConflictException';
|
|
36
36
|
Object.setPrototypeOf(this, ConflictException.prototype);
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
export class NotFoundException extends EndeeException {
|
|
40
40
|
constructor(message) {
|
|
41
41
|
super(`Resource Not Found: ${message}`);
|
|
42
|
-
this.name =
|
|
42
|
+
this.name = 'NotFoundException';
|
|
43
43
|
Object.setPrototypeOf(this, NotFoundException.prototype);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
export class AuthenticationException extends EndeeException {
|
|
47
47
|
constructor(message) {
|
|
48
48
|
super(`Authentication Error: ${message}`);
|
|
49
|
-
this.name =
|
|
49
|
+
this.name = 'AuthenticationException';
|
|
50
50
|
Object.setPrototypeOf(this, AuthenticationException.prototype);
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
export class SubscriptionException extends EndeeException {
|
|
54
54
|
constructor(message) {
|
|
55
55
|
super(`Subscription Error: ${message}`);
|
|
56
|
-
this.name =
|
|
56
|
+
this.name = 'SubscriptionException';
|
|
57
57
|
Object.setPrototypeOf(this, SubscriptionException.prototype);
|
|
58
58
|
}
|
|
59
59
|
}
|
|
@@ -62,17 +62,17 @@ export function raiseException(code, text) {
|
|
|
62
62
|
try {
|
|
63
63
|
if (typeof text === 'string') {
|
|
64
64
|
const parsed = JSON.parse(text);
|
|
65
|
-
message = parsed.error ||
|
|
65
|
+
message = parsed.error || 'Unknown error';
|
|
66
66
|
}
|
|
67
67
|
else if (text && typeof text === 'object' && 'error' in text) {
|
|
68
|
-
message = String(text.error) ||
|
|
68
|
+
message = String(text.error) || 'Unknown error';
|
|
69
69
|
}
|
|
70
70
|
else {
|
|
71
|
-
message = String(text) ||
|
|
71
|
+
message = String(text) || 'Unknown error';
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
catch {
|
|
75
|
-
message = String(text) ||
|
|
75
|
+
message = String(text) || 'Unknown error';
|
|
76
76
|
}
|
|
77
77
|
if (code === 400) {
|
|
78
78
|
throw new APIException(message);
|
|
@@ -93,10 +93,10 @@ export function raiseException(code, text) {
|
|
|
93
93
|
throw new ConflictException(message);
|
|
94
94
|
}
|
|
95
95
|
else if (code >= 500) {
|
|
96
|
-
throw new ServerException(
|
|
96
|
+
throw new ServerException('Server is busy. Please try again in sometime');
|
|
97
97
|
}
|
|
98
98
|
else {
|
|
99
|
-
throw new APIException(
|
|
99
|
+
throw new APIException('Unknown Error. Please try again in sometime');
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
//# sourceMappingURL=exceptions.js.map
|
|
@@ -1,31 +1,26 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Index client for Endee-DB
|
|
3
3
|
*/
|
|
4
|
-
import { VectorItem, QueryOptions, QueryResult, IndexInfo, IndexDescription } from
|
|
4
|
+
import { VectorItem, QueryOptions, QueryResult, IndexInfo, IndexDescription, VectorInfo } from './types/index.js';
|
|
5
5
|
export declare class Index {
|
|
6
6
|
private name;
|
|
7
|
-
private key;
|
|
8
7
|
private token;
|
|
9
8
|
private url;
|
|
10
9
|
private count;
|
|
11
|
-
private
|
|
10
|
+
private spaceType;
|
|
12
11
|
private dimension;
|
|
13
12
|
private precision;
|
|
14
13
|
private M;
|
|
15
|
-
|
|
14
|
+
private sparseDimension;
|
|
15
|
+
constructor(name: string, token: string, url: string, _version?: number, params?: Partial<IndexInfo>);
|
|
16
16
|
toString(): string;
|
|
17
|
+
private isHybrid;
|
|
17
18
|
private _normalizeVector;
|
|
18
19
|
upsert(inputArray: VectorItem[]): Promise<string>;
|
|
19
20
|
query(options: QueryOptions): Promise<QueryResult[]>;
|
|
20
21
|
deleteVector(id: string): Promise<string>;
|
|
21
|
-
deleteWithFilter(filter: Record<string, unknown
|
|
22
|
-
getVector(id: string): Promise<
|
|
23
|
-
id: string;
|
|
24
|
-
meta: Record<string, unknown>;
|
|
25
|
-
filter: string;
|
|
26
|
-
norm: number;
|
|
27
|
-
vector: number[];
|
|
28
|
-
}>;
|
|
22
|
+
deleteWithFilter(filter: Array<Record<string, unknown>>): Promise<unknown>;
|
|
23
|
+
getVector(id: string): Promise<VectorInfo>;
|
|
29
24
|
describe(): IndexDescription;
|
|
30
25
|
}
|
|
31
|
-
//# sourceMappingURL=
|
|
26
|
+
//# sourceMappingURL=index.class.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.class.d.ts","sourceRoot":"","sources":["../src/index.class.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,OAAO,EACL,UAAU,EACV,YAAY,EACZ,WAAW,EACX,SAAS,EACT,gBAAgB,EAGhB,UAAU,EACX,MAAM,kBAAkB,CAAC;AAE1B,qBAAa,KAAK;IAChB,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,GAAG,CAAS;IACpB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,SAAS,CAAY;IAC7B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,SAAS,CAAY;IAC7B,OAAO,CAAC,CAAC,CAAS;IAClB,OAAO,CAAC,eAAe,CAAS;gBAG9B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,QAAQ,SAAI,EACZ,MAAM,GAAE,OAAO,CAAC,SAAS,CAAM;IAajC,QAAQ,IAAI,MAAM;IAIlB,OAAO,CAAC,QAAQ;IAIhB,OAAO,CAAC,gBAAgB;IAelB,MAAM,CAAC,UAAU,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC;IA6EjD,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAuHpD,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAmBzC,gBAAgB,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IAqB1E,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAwChD,QAAQ,IAAI,gBAAgB;CAY7B"}
|
|
@@ -1,40 +1,43 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Index client for Endee-DB
|
|
3
3
|
*/
|
|
4
|
-
import axios from
|
|
5
|
-
import { encode, decode } from
|
|
6
|
-
import { jsonZip, jsonUnzip } from
|
|
7
|
-
import { raiseException } from
|
|
8
|
-
import { Precision } from
|
|
4
|
+
import axios from 'axios';
|
|
5
|
+
import { encode, decode } from '@msgpack/msgpack';
|
|
6
|
+
import { jsonZip, jsonUnzip } from './crypto.js';
|
|
7
|
+
import { raiseException } from './exceptions.js';
|
|
8
|
+
import { Precision, } from './types/index.js';
|
|
9
9
|
export class Index {
|
|
10
10
|
name;
|
|
11
|
-
key;
|
|
12
11
|
token;
|
|
13
12
|
url;
|
|
14
13
|
count;
|
|
15
|
-
|
|
14
|
+
spaceType;
|
|
16
15
|
dimension;
|
|
17
16
|
precision;
|
|
18
17
|
M;
|
|
19
|
-
|
|
18
|
+
sparseDimension;
|
|
19
|
+
constructor(name, token, url, _version = 1, params = {}) {
|
|
20
20
|
this.name = name;
|
|
21
|
-
this.key = key;
|
|
22
21
|
this.token = token;
|
|
23
22
|
this.url = url;
|
|
24
23
|
this.count = params.total_elements || 0;
|
|
25
|
-
this.
|
|
24
|
+
this.spaceType = params.spaceType || 'cosine';
|
|
26
25
|
this.dimension = params.dimension || 0;
|
|
27
26
|
this.precision = params.precision || Precision.INT8D;
|
|
28
27
|
this.M = params.M || 16;
|
|
28
|
+
this.sparseDimension = params.sparseDimension || 0;
|
|
29
29
|
}
|
|
30
30
|
toString() {
|
|
31
31
|
return this.name;
|
|
32
32
|
}
|
|
33
|
+
isHybrid() {
|
|
34
|
+
return this.sparseDimension > 0;
|
|
35
|
+
}
|
|
33
36
|
_normalizeVector(vector) {
|
|
34
37
|
if (vector.length !== this.dimension) {
|
|
35
38
|
throw new Error(`Vector dimension mismatch: expected ${this.dimension}, got ${vector.length}`);
|
|
36
39
|
}
|
|
37
|
-
if (this.
|
|
40
|
+
if (this.spaceType !== 'cosine') {
|
|
38
41
|
return [vector, 1.0];
|
|
39
42
|
}
|
|
40
43
|
const norm = Math.sqrt(vector.reduce((sum, v) => sum + v * v, 0));
|
|
@@ -45,28 +48,52 @@ export class Index {
|
|
|
45
48
|
}
|
|
46
49
|
async upsert(inputArray) {
|
|
47
50
|
if (inputArray.length > 1000) {
|
|
48
|
-
throw new Error(
|
|
51
|
+
throw new Error('Cannot insert more than 1000 vectors at a time');
|
|
49
52
|
}
|
|
50
53
|
const vectorBatch = [];
|
|
51
54
|
for (const item of inputArray) {
|
|
52
55
|
const [vector, norm] = this._normalizeVector(item.vector);
|
|
53
|
-
const metaData = jsonZip(item.meta || {}
|
|
56
|
+
const metaData = jsonZip(item.meta || {});
|
|
57
|
+
const sparseIndices = item.sparseIndices || [];
|
|
58
|
+
const sparseValues = item.sparseValues || [];
|
|
59
|
+
if (!this.isHybrid() && (sparseIndices.length > 0 || sparseValues.length > 0)) {
|
|
60
|
+
throw new Error('Cannot insert sparse data into a dense-only index. Create index with sparseDimension > 0 for hybrid support.');
|
|
61
|
+
}
|
|
62
|
+
if (this.isHybrid()) {
|
|
63
|
+
if (sparseIndices.length == 0 || sparseValues.length == 0) {
|
|
64
|
+
throw new Error('Both sparse_indices and sparse_values must be provided for hybrid vectors.');
|
|
65
|
+
}
|
|
66
|
+
if (sparseIndices.length !== sparseValues.length) {
|
|
67
|
+
throw new Error(`sparseIndices and sparseValues must have the same length. Got ${sparseIndices.length} length indices and ${sparseValues.length} length values.`);
|
|
68
|
+
}
|
|
69
|
+
for (const idx of sparseIndices) {
|
|
70
|
+
if (idx < 0 || idx >= this.sparseDimension) {
|
|
71
|
+
throw new Error(`Sparse index ${idx} is out of bounds. Must be in range [0,${this.sparseDimension}).`);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
54
75
|
const vectorObj = [
|
|
55
|
-
String(item.id ||
|
|
76
|
+
String(item.id || ''),
|
|
56
77
|
metaData,
|
|
57
78
|
JSON.stringify(item.filter || {}),
|
|
58
79
|
norm,
|
|
59
80
|
vector,
|
|
60
81
|
];
|
|
82
|
+
if (this.isHybrid()) {
|
|
83
|
+
vectorObj.push(sparseIndices, sparseValues);
|
|
84
|
+
}
|
|
61
85
|
vectorBatch.push(vectorObj);
|
|
62
86
|
}
|
|
63
87
|
const serializedData = encode(vectorBatch);
|
|
64
88
|
const headers = {
|
|
65
89
|
Authorization: this.token,
|
|
66
|
-
|
|
90
|
+
'Content-Type': 'application/msgpack',
|
|
67
91
|
};
|
|
68
92
|
try {
|
|
69
|
-
await axios.post(`${this.url}/index/${this.name}/vector/insert`, serializedData, {
|
|
93
|
+
await axios.post(`${this.url}/index/${this.name}/vector/insert`, serializedData, {
|
|
94
|
+
headers,
|
|
95
|
+
responseType: 'arraybuffer',
|
|
96
|
+
});
|
|
70
97
|
}
|
|
71
98
|
catch (err) {
|
|
72
99
|
if (axios.isAxiosError(err) && err.response) {
|
|
@@ -74,33 +101,55 @@ export class Index {
|
|
|
74
101
|
}
|
|
75
102
|
throw err;
|
|
76
103
|
}
|
|
77
|
-
return
|
|
104
|
+
return 'Vectors inserted successfully';
|
|
78
105
|
}
|
|
79
106
|
async query(options) {
|
|
80
|
-
const { vector, topK = 10, filter = null, ef = 128, includeVectors = false, } = options;
|
|
81
|
-
if (
|
|
82
|
-
throw new Error(
|
|
83
|
-
if (topK > 200)
|
|
84
|
-
throw new Error("top_k cannot be greater than 200");
|
|
107
|
+
const { vector = null, topK = 10, filter = null, ef = 128, includeVectors = false, sparseIndices = null, sparseValues = null, } = options;
|
|
108
|
+
if (topK > 512 || topK < 0)
|
|
109
|
+
throw new Error('top_k cannot be greater than 512 and less than 0');
|
|
85
110
|
if (ef > 1024)
|
|
86
|
-
throw new Error(
|
|
87
|
-
const
|
|
111
|
+
throw new Error('ef search cannot be greater than 1024');
|
|
112
|
+
const hasSparse = sparseIndices && sparseIndices.length > 0 && sparseValues && sparseIndices.length > 0;
|
|
113
|
+
let hasDense = false;
|
|
114
|
+
if (vector)
|
|
115
|
+
hasDense = true;
|
|
116
|
+
if (!hasDense && !hasSparse) {
|
|
117
|
+
throw new Error("At least one of 'vector' or 'sparseIndices'/'sparseValues' must be provided.");
|
|
118
|
+
}
|
|
119
|
+
if (hasSparse && !this.isHybrid()) {
|
|
120
|
+
throw new Error('Cannot perform sparse search on a dense-only index. Create index with sparseDimension > 0 for hybrid support.');
|
|
121
|
+
}
|
|
122
|
+
if (hasSparse) {
|
|
123
|
+
if (sparseIndices.length != sparseValues.length) {
|
|
124
|
+
throw new Error(`sparseIndices and sparseValues must have the same length. Got ${sparseIndices.length} length indices and ${sparseValues.length} length values.`);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
88
127
|
const headers = {
|
|
89
128
|
Authorization: this.token,
|
|
90
|
-
|
|
129
|
+
'Content-Type': 'application/json',
|
|
91
130
|
};
|
|
92
131
|
const data = {
|
|
93
|
-
vector: queryVector,
|
|
94
132
|
k: topK,
|
|
95
133
|
ef: ef,
|
|
96
134
|
include_vectors: includeVectors,
|
|
97
135
|
};
|
|
136
|
+
if (vector) {
|
|
137
|
+
const [queryVector] = this._normalizeVector(vector);
|
|
138
|
+
data.vector = queryVector;
|
|
139
|
+
}
|
|
140
|
+
if (hasSparse) {
|
|
141
|
+
data.sparse_indices = sparseIndices;
|
|
142
|
+
data.sparse_values = sparseValues;
|
|
143
|
+
}
|
|
98
144
|
if (filter) {
|
|
99
145
|
data.filter = JSON.stringify(filter);
|
|
100
146
|
}
|
|
101
147
|
let response;
|
|
102
148
|
try {
|
|
103
|
-
response = await axios.post(`${this.url}/index/${this.name}/search`, data, {
|
|
149
|
+
response = await axios.post(`${this.url}/index/${this.name}/search`, data, {
|
|
150
|
+
headers,
|
|
151
|
+
responseType: 'arraybuffer',
|
|
152
|
+
});
|
|
104
153
|
}
|
|
105
154
|
catch (err) {
|
|
106
155
|
if (axios.isAxiosError(err) && err.response) {
|
|
@@ -110,7 +159,7 @@ export class Index {
|
|
|
110
159
|
}
|
|
111
160
|
const decoded = decode(new Uint8Array(response.data));
|
|
112
161
|
const results = Array.isArray(decoded) ? decoded : [];
|
|
113
|
-
|
|
162
|
+
const processedResults = [];
|
|
114
163
|
for (const result of results) {
|
|
115
164
|
const similarity = result[0];
|
|
116
165
|
const vectorId = result[1];
|
|
@@ -119,7 +168,7 @@ export class Index {
|
|
|
119
168
|
const normValue = result[4];
|
|
120
169
|
const vectorData = result.length > 5 ? result[5] : undefined;
|
|
121
170
|
let meta = {};
|
|
122
|
-
meta = jsonUnzip(metaData
|
|
171
|
+
meta = jsonUnzip(metaData);
|
|
123
172
|
const processedResult = {
|
|
124
173
|
id: vectorId,
|
|
125
174
|
similarity: similarity,
|
|
@@ -148,7 +197,9 @@ export class Index {
|
|
|
148
197
|
};
|
|
149
198
|
let response;
|
|
150
199
|
try {
|
|
151
|
-
response = await axios.delete(`${this.url}/index/${this.name}/vector/${id}/delete`, {
|
|
200
|
+
response = await axios.delete(`${this.url}/index/${this.name}/vector/${id}/delete`, {
|
|
201
|
+
headers,
|
|
202
|
+
});
|
|
152
203
|
}
|
|
153
204
|
catch (err) {
|
|
154
205
|
if (axios.isAxiosError(err) && err.response) {
|
|
@@ -156,18 +207,21 @@ export class Index {
|
|
|
156
207
|
}
|
|
157
208
|
throw err;
|
|
158
209
|
}
|
|
159
|
-
return response.data +
|
|
210
|
+
return response.data + ' rows deleted';
|
|
160
211
|
}
|
|
161
212
|
// Need to test this function first.
|
|
162
213
|
async deleteWithFilter(filter) {
|
|
163
214
|
const headers = {
|
|
164
215
|
Authorization: this.token,
|
|
165
|
-
|
|
216
|
+
'Content-Type': 'application/json',
|
|
166
217
|
};
|
|
167
218
|
const data = { filter };
|
|
168
219
|
let response;
|
|
169
220
|
try {
|
|
170
|
-
response = await axios.delete(`${this.url}/index/${this.name}/vectors/delete`, {
|
|
221
|
+
response = await axios.delete(`${this.url}/index/${this.name}/vectors/delete`, {
|
|
222
|
+
headers,
|
|
223
|
+
data,
|
|
224
|
+
});
|
|
171
225
|
}
|
|
172
226
|
catch (err) {
|
|
173
227
|
if (axios.isAxiosError(err) && err.response) {
|
|
@@ -180,11 +234,11 @@ export class Index {
|
|
|
180
234
|
async getVector(id) {
|
|
181
235
|
const headers = {
|
|
182
236
|
Authorization: this.token,
|
|
183
|
-
|
|
237
|
+
'Content-Type': 'application/json',
|
|
184
238
|
};
|
|
185
239
|
let response;
|
|
186
240
|
try {
|
|
187
|
-
response = await axios.post(`${this.url}/index/${this.name}/vector/get`, { id }, { headers, responseType:
|
|
241
|
+
response = await axios.post(`${this.url}/index/${this.name}/vector/get`, { id }, { headers, responseType: 'arraybuffer' });
|
|
188
242
|
}
|
|
189
243
|
catch (err) {
|
|
190
244
|
if (axios.isAxiosError(err) && err.response) {
|
|
@@ -193,12 +247,13 @@ export class Index {
|
|
|
193
247
|
throw err;
|
|
194
248
|
}
|
|
195
249
|
const vectorObj = decode(new Uint8Array(response.data));
|
|
196
|
-
const meta = jsonUnzip(vectorObj[1]
|
|
250
|
+
const meta = jsonUnzip(vectorObj[1]);
|
|
197
251
|
const vector = Array.from(vectorObj[4]);
|
|
252
|
+
const parsedFilter = JSON.parse(vectorObj[2]);
|
|
198
253
|
return {
|
|
199
254
|
id: vectorObj[0],
|
|
200
255
|
meta: meta,
|
|
201
|
-
filter:
|
|
256
|
+
filter: parsedFilter,
|
|
202
257
|
norm: vectorObj[3],
|
|
203
258
|
vector: vector,
|
|
204
259
|
};
|
|
@@ -206,12 +261,14 @@ export class Index {
|
|
|
206
261
|
describe() {
|
|
207
262
|
return {
|
|
208
263
|
name: this.name,
|
|
209
|
-
|
|
264
|
+
spaceType: this.spaceType,
|
|
210
265
|
dimension: this.dimension,
|
|
266
|
+
sparseDimension: this.sparseDimension,
|
|
267
|
+
isHybrid: this.isHybrid(),
|
|
211
268
|
count: this.count,
|
|
212
269
|
precision: this.precision,
|
|
213
270
|
M: this.M,
|
|
214
271
|
};
|
|
215
272
|
}
|
|
216
273
|
}
|
|
217
|
-
//# sourceMappingURL=
|
|
274
|
+
//# sourceMappingURL=index.class.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.class.js","sourceRoot":"","sources":["../src/index.class.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAOL,SAAS,GAEV,MAAM,kBAAkB,CAAC;AAE1B,MAAM,OAAO,KAAK;IACR,IAAI,CAAS;IACb,KAAK,CAAS;IACd,GAAG,CAAS;IACZ,KAAK,CAAS;IACd,SAAS,CAAY;IACrB,SAAS,CAAS;IAClB,SAAS,CAAY;IACrB,CAAC,CAAS;IACV,eAAe,CAAS;IAEhC,YACE,IAAY,EACZ,KAAa,EACb,GAAW,EACX,QAAQ,GAAG,CAAC,EACZ,SAA6B,EAAE;QAE/B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,KAAK,GAAI,MAAM,CAAC,cAAyB,IAAI,CAAC,CAAC;QACpD,IAAI,CAAC,SAAS,GAAI,MAAM,CAAC,SAAuB,IAAI,QAAQ,CAAC;QAC7D,IAAI,CAAC,SAAS,GAAI,MAAM,CAAC,SAAoB,IAAI,CAAC,CAAC;QACnD,IAAI,CAA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AAQ,EAAE;YACzB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,CAAC,EAAE,IAAI,CAAC,CAAC;SACV,CAAC;IACJ,CAAC;CACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Main export file for Endee-DB
|
|
3
3
|
*/
|
|
4
|
-
export { Endee } from './endee.js';
|
|
5
|
-
export { Index } from './
|
|
4
|
+
export { Endee } from './endee.class.js';
|
|
5
|
+
export { Index } from './index.class.js';
|
|
6
6
|
export * from './exceptions.js';
|
|
7
7
|
export * from './types/index.js';
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC"}
|