@lov3kaizen/agentsea-embeddings 1.0.1 → 1.1.1
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/dist/caching/index.js +7 -1
- package/dist/caching/index.mjs +1 -1
- package/dist/chunk-2TCNSTX3.mjs +12 -0
- package/dist/{chunk-NBHIRTJT.mjs → chunk-5GTQFVEI.mjs} +41 -1
- package/dist/chunk-JHWMXQ56.mjs +1650 -0
- package/dist/{chunk-VPSMDBHH.mjs → chunk-MNJPAUDC.mjs} +7 -1
- package/dist/{chunk-DJAURHAS.mjs → chunk-U6EYWYUD.mjs} +31 -1
- package/dist/chunking/index.js +33 -4
- package/dist/chunking/index.mjs +1 -1
- package/dist/{index-DmEEUzJg.d.mts → index-DGzfvyHY.d.mts} +3 -0
- package/dist/{index-G-KgyvZT.d.ts → index-_uJcyK8e.d.ts} +3 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +848 -16
- package/dist/index.mjs +22 -22
- package/dist/providers/index.d.mts +1 -1
- package/dist/providers/index.d.ts +1 -1
- package/dist/providers/index.js +47 -1
- package/dist/providers/index.mjs +2 -1
- package/dist/stores/index.d.mts +255 -1
- package/dist/stores/index.d.ts +255 -1
- package/dist/stores/index.js +794 -7
- package/dist/stores/index.mjs +20 -3
- package/package.json +9 -6
- package/dist/chunk-TER262ST.mjs +0 -877
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BaseProvider,
|
|
3
|
+
CohereProvider,
|
|
4
|
+
HuggingFaceProvider,
|
|
5
|
+
LocalProvider,
|
|
6
|
+
OpenAIProvider,
|
|
7
|
+
VoyageProvider,
|
|
8
|
+
createCohereProvider,
|
|
9
|
+
createHuggingFaceProvider,
|
|
10
|
+
createLocalProvider,
|
|
11
|
+
createMockProvider,
|
|
12
|
+
createOpenAIProvider,
|
|
13
|
+
createRandomProvider,
|
|
14
|
+
createVoyageProvider
|
|
15
|
+
} from "./chunk-5GTQFVEI.mjs";
|
|
1
16
|
import {
|
|
2
17
|
BaseCache,
|
|
3
18
|
MemoryCache,
|
|
@@ -10,7 +25,7 @@ import {
|
|
|
10
25
|
createSQLiteCache,
|
|
11
26
|
createStandardTieredCache,
|
|
12
27
|
createTieredCache
|
|
13
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-MNJPAUDC.mjs";
|
|
14
29
|
import {
|
|
15
30
|
BaseChunker,
|
|
16
31
|
CodeChunker,
|
|
@@ -27,8 +42,9 @@ import {
|
|
|
27
42
|
createSemanticChunker,
|
|
28
43
|
defaultTokenCounter,
|
|
29
44
|
mergeSmallChunks,
|
|
45
|
+
nanoid,
|
|
30
46
|
splitLargeChunks
|
|
31
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-U6EYWYUD.mjs";
|
|
32
48
|
import {
|
|
33
49
|
BaseStore,
|
|
34
50
|
ChromaStore,
|
|
@@ -40,22 +56,8 @@ import {
|
|
|
40
56
|
createPineconeStore,
|
|
41
57
|
createQdrantStore,
|
|
42
58
|
createStore
|
|
43
|
-
} from "./chunk-
|
|
44
|
-
import
|
|
45
|
-
BaseProvider,
|
|
46
|
-
CohereProvider,
|
|
47
|
-
HuggingFaceProvider,
|
|
48
|
-
LocalProvider,
|
|
49
|
-
OpenAIProvider,
|
|
50
|
-
VoyageProvider,
|
|
51
|
-
createCohereProvider,
|
|
52
|
-
createHuggingFaceProvider,
|
|
53
|
-
createLocalProvider,
|
|
54
|
-
createMockProvider,
|
|
55
|
-
createOpenAIProvider,
|
|
56
|
-
createRandomProvider,
|
|
57
|
-
createVoyageProvider
|
|
58
|
-
} from "./chunk-NBHIRTJT.mjs";
|
|
59
|
+
} from "./chunk-JHWMXQ56.mjs";
|
|
60
|
+
import "./chunk-2TCNSTX3.mjs";
|
|
59
61
|
import {
|
|
60
62
|
batch,
|
|
61
63
|
cacheKey,
|
|
@@ -432,7 +434,6 @@ function createEmbeddingManager(config) {
|
|
|
432
434
|
}
|
|
433
435
|
|
|
434
436
|
// src/versioning/VersionRegistry.ts
|
|
435
|
-
import { nanoid } from "nanoid";
|
|
436
437
|
import EventEmitter2 from "eventemitter3";
|
|
437
438
|
var VersionRegistry = class extends EventEmitter2 {
|
|
438
439
|
versions = /* @__PURE__ */ new Map();
|
|
@@ -684,7 +685,6 @@ function createVersionRegistry(options) {
|
|
|
684
685
|
|
|
685
686
|
// src/quality/DriftDetector.ts
|
|
686
687
|
import EventEmitter3 from "eventemitter3";
|
|
687
|
-
import { nanoid as nanoid2 } from "nanoid";
|
|
688
688
|
var DriftDetector = class extends EventEmitter3 {
|
|
689
689
|
reference = null;
|
|
690
690
|
config;
|
|
@@ -719,7 +719,7 @@ var DriftDetector = class extends EventEmitter3 {
|
|
|
719
719
|
varianceVector.push(variance(values));
|
|
720
720
|
}
|
|
721
721
|
this.reference = {
|
|
722
|
-
id:
|
|
722
|
+
id: nanoid(),
|
|
723
723
|
model,
|
|
724
724
|
version,
|
|
725
725
|
sampleCount: embeddings.length,
|
|
@@ -894,7 +894,7 @@ var DriftDetector = class extends EventEmitter3 {
|
|
|
894
894
|
*/
|
|
895
895
|
emitAlert(result) {
|
|
896
896
|
const alert = {
|
|
897
|
-
id:
|
|
897
|
+
id: nanoid(),
|
|
898
898
|
type: "drift_detected",
|
|
899
899
|
severity: result.severity,
|
|
900
900
|
message: `Embedding drift detected with score ${result.driftScore.toFixed(3)}`,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { B as BaseProvider, C as CohereProvider, c as CohereProviderConfig, E as EmbeddingProviderType, H as HuggingFaceProvider, f as HuggingFaceProviderConfig, L as LocalEmbeddingFn, g as LocalProvider, h as LocalProviderConfig, i as LocalProviderOptions, O as OpenAIProvider, k as OpenAIProviderConfig, P as ProviderCapabilities, l as ProviderConfig, o as ProviderHealth, p as ProviderMetrics, V as VoyageProvider, r as VoyageProviderConfig, s as createCohereProvider, t as createHuggingFaceProvider, u as createLocalProvider, v as createMockProvider, w as createOpenAIProvider, x as createRandomProvider, y as createVoyageProvider } from '../index-
|
|
1
|
+
export { B as BaseProvider, C as CohereProvider, c as CohereProviderConfig, E as EmbeddingProviderType, H as HuggingFaceProvider, f as HuggingFaceProviderConfig, L as LocalEmbeddingFn, g as LocalProvider, h as LocalProviderConfig, i as LocalProviderOptions, O as OpenAIProvider, k as OpenAIProviderConfig, P as ProviderCapabilities, l as ProviderConfig, o as ProviderHealth, p as ProviderMetrics, V as VoyageProvider, r as VoyageProviderConfig, s as createCohereProvider, t as createHuggingFaceProvider, u as createLocalProvider, v as createMockProvider, w as createOpenAIProvider, x as createRandomProvider, y as createVoyageProvider } from '../index-DGzfvyHY.mjs';
|
|
2
2
|
import '../embedding.types-6Qr8Mgij.mjs';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { B as BaseProvider, C as CohereProvider, c as CohereProviderConfig, E as EmbeddingProviderType, H as HuggingFaceProvider, f as HuggingFaceProviderConfig, L as LocalEmbeddingFn, g as LocalProvider, h as LocalProviderConfig, i as LocalProviderOptions, O as OpenAIProvider, k as OpenAIProviderConfig, P as ProviderCapabilities, l as ProviderConfig, o as ProviderHealth, p as ProviderMetrics, V as VoyageProvider, r as VoyageProviderConfig, s as createCohereProvider, t as createHuggingFaceProvider, u as createLocalProvider, v as createMockProvider, w as createOpenAIProvider, x as createRandomProvider, y as createVoyageProvider } from '../index-
|
|
1
|
+
export { B as BaseProvider, C as CohereProvider, c as CohereProviderConfig, E as EmbeddingProviderType, H as HuggingFaceProvider, f as HuggingFaceProviderConfig, L as LocalEmbeddingFn, g as LocalProvider, h as LocalProviderConfig, i as LocalProviderOptions, O as OpenAIProvider, k as OpenAIProviderConfig, P as ProviderCapabilities, l as ProviderConfig, o as ProviderHealth, p as ProviderMetrics, V as VoyageProvider, r as VoyageProviderConfig, s as createCohereProvider, t as createHuggingFaceProvider, u as createLocalProvider, v as createMockProvider, w as createOpenAIProvider, x as createRandomProvider, y as createVoyageProvider } from '../index-_uJcyK8e.js';
|
|
2
2
|
import '../embedding.types-6Qr8Mgij.js';
|
package/dist/providers/index.js
CHANGED
|
@@ -950,20 +950,33 @@ function createVoyageProvider(config) {
|
|
|
950
950
|
return new VoyageProvider(config);
|
|
951
951
|
}
|
|
952
952
|
|
|
953
|
+
// src/core/optional-import.ts
|
|
954
|
+
function importOptional(name) {
|
|
955
|
+
return import(
|
|
956
|
+
/* @vite-ignore */
|
|
957
|
+
/* webpackIgnore: true */
|
|
958
|
+
name
|
|
959
|
+
);
|
|
960
|
+
}
|
|
961
|
+
|
|
953
962
|
// src/providers/LocalProvider.ts
|
|
954
963
|
var LocalProvider = class extends BaseProvider {
|
|
955
964
|
modelInfo;
|
|
956
965
|
embedFn = null;
|
|
957
966
|
normalize;
|
|
958
967
|
batchSize;
|
|
968
|
+
modelPath;
|
|
969
|
+
/** Lazily-built ONNX extractor (only when loading from `modelPath`). */
|
|
970
|
+
extractorPromise;
|
|
959
971
|
constructor(config) {
|
|
960
972
|
super({ ...config, type: "local" });
|
|
961
973
|
if (!config.embedFn && !config.modelPath) {
|
|
962
974
|
throw new Error(
|
|
963
|
-
"
|
|
975
|
+
"`embedFn` or `modelPath` (ONNX) is required for the local provider"
|
|
964
976
|
);
|
|
965
977
|
}
|
|
966
978
|
this.embedFn = config.embedFn ?? null;
|
|
979
|
+
this.modelPath = config.modelPath;
|
|
967
980
|
this.normalize = config.normalize ?? true;
|
|
968
981
|
this.batchSize = config.batchSize ?? 32;
|
|
969
982
|
this.modelInfo = {
|
|
@@ -977,10 +990,43 @@ var LocalProvider = class extends BaseProvider {
|
|
|
977
990
|
description: "Local embedding model"
|
|
978
991
|
};
|
|
979
992
|
}
|
|
993
|
+
/**
|
|
994
|
+
* Lazily load the ONNX feature-extraction pipeline from `modelPath` via
|
|
995
|
+
* Transformers.js and adapt it into a {@link LocalEmbeddingFn}.
|
|
996
|
+
*/
|
|
997
|
+
getOnnxEmbedFn() {
|
|
998
|
+
if (!this.extractorPromise) {
|
|
999
|
+
this.extractorPromise = (async () => {
|
|
1000
|
+
let mod;
|
|
1001
|
+
try {
|
|
1002
|
+
mod = await importOptional("@xenova/transformers");
|
|
1003
|
+
} catch {
|
|
1004
|
+
throw new Error(
|
|
1005
|
+
'Loading local ONNX models from `modelPath` requires the "@xenova/transformers" package. Install it, or pass an `embedFn`.'
|
|
1006
|
+
);
|
|
1007
|
+
}
|
|
1008
|
+
const transformers = mod;
|
|
1009
|
+
return transformers.pipeline("feature-extraction", this.modelPath);
|
|
1010
|
+
})();
|
|
1011
|
+
}
|
|
1012
|
+
return this.extractorPromise;
|
|
1013
|
+
}
|
|
980
1014
|
get info() {
|
|
981
1015
|
return this.modelInfo;
|
|
982
1016
|
}
|
|
983
1017
|
async doEmbed(texts, options) {
|
|
1018
|
+
if (!this.embedFn && this.modelPath) {
|
|
1019
|
+
const extractor = await this.getOnnxEmbedFn();
|
|
1020
|
+
this.embedFn = async (input) => {
|
|
1021
|
+
const output = await extractor(input, {
|
|
1022
|
+
pooling: "mean",
|
|
1023
|
+
normalize: false
|
|
1024
|
+
// we normalize below if configured
|
|
1025
|
+
});
|
|
1026
|
+
const list = output.tolist();
|
|
1027
|
+
return Array.isArray(list[0]) ? list : [list];
|
|
1028
|
+
};
|
|
1029
|
+
}
|
|
984
1030
|
if (!this.embedFn) {
|
|
985
1031
|
throw new Error("No embedding function configured");
|
|
986
1032
|
}
|
package/dist/providers/index.mjs
CHANGED
|
@@ -12,7 +12,8 @@ import {
|
|
|
12
12
|
createOpenAIProvider,
|
|
13
13
|
createRandomProvider,
|
|
14
14
|
createVoyageProvider
|
|
15
|
-
} from "../chunk-
|
|
15
|
+
} from "../chunk-5GTQFVEI.mjs";
|
|
16
|
+
import "../chunk-2TCNSTX3.mjs";
|
|
16
17
|
import "../chunk-3KM32UQK.mjs";
|
|
17
18
|
import "../chunk-QAITLJ2E.mjs";
|
|
18
19
|
export {
|
package/dist/stores/index.d.mts
CHANGED
|
@@ -138,6 +138,8 @@ interface DeleteOptions {
|
|
|
138
138
|
}
|
|
139
139
|
interface DeleteResult {
|
|
140
140
|
deletedCount: number;
|
|
141
|
+
countExact: boolean;
|
|
142
|
+
requestedCount?: number;
|
|
141
143
|
durationMs: number;
|
|
142
144
|
}
|
|
143
145
|
interface StoreQueryOptions extends SearchOptions {
|
|
@@ -293,6 +295,258 @@ declare class QdrantStore extends BaseStore {
|
|
|
293
295
|
}
|
|
294
296
|
declare function createQdrantStore(config: QdrantStoreConfig): QdrantStore;
|
|
295
297
|
|
|
298
|
+
interface PgPoolLike {
|
|
299
|
+
query(text: string, params?: unknown[]): Promise<{
|
|
300
|
+
rows: Array<Record<string, unknown>>;
|
|
301
|
+
rowCount: number | null;
|
|
302
|
+
}>;
|
|
303
|
+
end(): Promise<void>;
|
|
304
|
+
}
|
|
305
|
+
interface PgVectorStoreOptions extends PgVectorStoreConfig {
|
|
306
|
+
pool?: PgPoolLike;
|
|
307
|
+
}
|
|
308
|
+
declare class PgVectorStore extends BaseStore {
|
|
309
|
+
readonly storeType: VectorStoreType;
|
|
310
|
+
private pool?;
|
|
311
|
+
private readonly injectedPool?;
|
|
312
|
+
private readonly table;
|
|
313
|
+
private readonly vectorColumn;
|
|
314
|
+
private readonly contentColumn;
|
|
315
|
+
private readonly metadataColumn;
|
|
316
|
+
private readonly pgConfig;
|
|
317
|
+
private initialized;
|
|
318
|
+
constructor(config: PgVectorStoreOptions);
|
|
319
|
+
private get distanceOperator();
|
|
320
|
+
init(): Promise<void>;
|
|
321
|
+
private ensureInitialized;
|
|
322
|
+
private ident;
|
|
323
|
+
private toVectorLiteral;
|
|
324
|
+
upsert(records: VectorRecord[], options?: UpsertOptions): Promise<UpsertResult>;
|
|
325
|
+
query(vector: EmbeddingVector, options?: StoreQueryOptions): Promise<StoreQueryResult>;
|
|
326
|
+
delete(ids: string[], _options?: DeleteOptions): Promise<DeleteResult>;
|
|
327
|
+
deleteAll(_options?: DeleteOptions): Promise<DeleteResult>;
|
|
328
|
+
getStats(): Promise<StoreStats>;
|
|
329
|
+
checkHealth(): Promise<StoreHealth>;
|
|
330
|
+
close(): Promise<void>;
|
|
331
|
+
}
|
|
332
|
+
declare function createPgVectorStore(config: PgVectorStoreOptions): PgVectorStore;
|
|
333
|
+
|
|
334
|
+
interface WeaviateBackend {
|
|
335
|
+
ensureClass(className: string, dimensions?: number): Promise<void>;
|
|
336
|
+
upsert(className: string, objects: Array<{
|
|
337
|
+
id: string;
|
|
338
|
+
vector: number[];
|
|
339
|
+
properties: Record<string, unknown>;
|
|
340
|
+
}>): Promise<void>;
|
|
341
|
+
nearVector(className: string, vector: number[], limit: number, filter?: Record<string, unknown>): Promise<Array<{
|
|
342
|
+
id: string;
|
|
343
|
+
score: number;
|
|
344
|
+
properties: Record<string, unknown>;
|
|
345
|
+
}>>;
|
|
346
|
+
deleteByIds(className: string, ids: string[]): Promise<number>;
|
|
347
|
+
deleteAll(className: string): Promise<number>;
|
|
348
|
+
count(className: string): Promise<number>;
|
|
349
|
+
ping(): Promise<void>;
|
|
350
|
+
}
|
|
351
|
+
interface WeaviateStoreOptions extends WeaviateStoreConfig {
|
|
352
|
+
backend?: WeaviateBackend;
|
|
353
|
+
}
|
|
354
|
+
declare class WeaviateStore extends BaseStore {
|
|
355
|
+
readonly storeType: VectorStoreType;
|
|
356
|
+
private backend?;
|
|
357
|
+
private readonly injectedBackend?;
|
|
358
|
+
private readonly className;
|
|
359
|
+
private readonly url;
|
|
360
|
+
private readonly apiKey?;
|
|
361
|
+
private initialized;
|
|
362
|
+
constructor(config: WeaviateStoreOptions);
|
|
363
|
+
init(): Promise<void>;
|
|
364
|
+
private ensureInitialized;
|
|
365
|
+
private buildSdkBackend;
|
|
366
|
+
upsert(records: VectorRecord[], options?: UpsertOptions): Promise<UpsertResult>;
|
|
367
|
+
query(vector: EmbeddingVector, options?: StoreQueryOptions): Promise<StoreQueryResult>;
|
|
368
|
+
delete(ids: string[], _options?: DeleteOptions): Promise<DeleteResult>;
|
|
369
|
+
deleteAll(_options?: DeleteOptions): Promise<DeleteResult>;
|
|
370
|
+
getStats(): Promise<StoreStats>;
|
|
371
|
+
checkHealth(): Promise<StoreHealth>;
|
|
372
|
+
close(): Promise<void>;
|
|
373
|
+
}
|
|
374
|
+
interface WeaviateSdkClient {
|
|
375
|
+
schema: {
|
|
376
|
+
getter: () => {
|
|
377
|
+
do: () => Promise<{
|
|
378
|
+
classes?: Array<{
|
|
379
|
+
class: string;
|
|
380
|
+
}>;
|
|
381
|
+
}>;
|
|
382
|
+
};
|
|
383
|
+
classCreator: () => {
|
|
384
|
+
withClass: (c: unknown) => {
|
|
385
|
+
do: () => Promise<unknown>;
|
|
386
|
+
};
|
|
387
|
+
};
|
|
388
|
+
};
|
|
389
|
+
batch: {
|
|
390
|
+
objectsBatcher: () => WeaviateBatcher;
|
|
391
|
+
};
|
|
392
|
+
data: {
|
|
393
|
+
deleter: () => {
|
|
394
|
+
withClassName: (c: string) => {
|
|
395
|
+
withId: (id: string) => {
|
|
396
|
+
do: () => Promise<unknown>;
|
|
397
|
+
};
|
|
398
|
+
};
|
|
399
|
+
};
|
|
400
|
+
};
|
|
401
|
+
graphql: {
|
|
402
|
+
get: () => WeaviateGraphQLGet;
|
|
403
|
+
aggregate: () => WeaviateAggregate;
|
|
404
|
+
};
|
|
405
|
+
misc: {
|
|
406
|
+
liveChecker: () => {
|
|
407
|
+
do: () => Promise<unknown>;
|
|
408
|
+
};
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
interface WeaviateBatcher {
|
|
412
|
+
withObject: (o: unknown) => WeaviateBatcher;
|
|
413
|
+
do: () => Promise<unknown>;
|
|
414
|
+
}
|
|
415
|
+
interface WeaviateGraphQLGet {
|
|
416
|
+
withClassName: (c: string) => WeaviateGraphQLGet;
|
|
417
|
+
withFields: (f: string) => WeaviateGraphQLGet;
|
|
418
|
+
withNearVector: (v: unknown) => WeaviateGraphQLGet;
|
|
419
|
+
withWhere: (w: unknown) => WeaviateGraphQLGet;
|
|
420
|
+
withLimit: (n: number) => WeaviateGraphQLGet;
|
|
421
|
+
do: () => Promise<{
|
|
422
|
+
data?: Record<string, unknown>;
|
|
423
|
+
}>;
|
|
424
|
+
}
|
|
425
|
+
interface WeaviateAggregate {
|
|
426
|
+
withClassName: (c: string) => WeaviateAggregate;
|
|
427
|
+
withFields: (f: string) => WeaviateAggregate;
|
|
428
|
+
do: () => Promise<{
|
|
429
|
+
data?: Record<string, unknown>;
|
|
430
|
+
}>;
|
|
431
|
+
}
|
|
432
|
+
declare class WeaviateSdkBackend implements WeaviateBackend {
|
|
433
|
+
private readonly client;
|
|
434
|
+
constructor(client: WeaviateSdkClient);
|
|
435
|
+
ensureClass(className: string, _dimensions?: number): Promise<void>;
|
|
436
|
+
upsert(className: string, objects: Array<{
|
|
437
|
+
id: string;
|
|
438
|
+
vector: number[];
|
|
439
|
+
properties: Record<string, unknown>;
|
|
440
|
+
}>): Promise<void>;
|
|
441
|
+
nearVector(className: string, vector: number[], limit: number, filter?: Record<string, unknown>): Promise<Array<{
|
|
442
|
+
id: string;
|
|
443
|
+
score: number;
|
|
444
|
+
properties: Record<string, unknown>;
|
|
445
|
+
}>>;
|
|
446
|
+
deleteByIds(className: string, ids: string[]): Promise<number>;
|
|
447
|
+
deleteAll(className: string): Promise<number>;
|
|
448
|
+
count(className: string): Promise<number>;
|
|
449
|
+
ping(): Promise<void>;
|
|
450
|
+
private toWhere;
|
|
451
|
+
}
|
|
452
|
+
declare function createWeaviateStore(config: WeaviateStoreOptions): WeaviateStore;
|
|
453
|
+
|
|
454
|
+
interface MilvusBackend {
|
|
455
|
+
ensureCollection(collection: string, dimensions: number, metric: string): Promise<void>;
|
|
456
|
+
upsert(collection: string, rows: Array<{
|
|
457
|
+
id: string;
|
|
458
|
+
vector: number[];
|
|
459
|
+
text: string;
|
|
460
|
+
metadata: Record<string, unknown>;
|
|
461
|
+
}>): Promise<void>;
|
|
462
|
+
search(collection: string, vector: number[], limit: number, filter?: string): Promise<Array<{
|
|
463
|
+
id: string;
|
|
464
|
+
score: number;
|
|
465
|
+
text: string;
|
|
466
|
+
metadata: Record<string, unknown>;
|
|
467
|
+
}>>;
|
|
468
|
+
deleteByIds(collection: string, ids: string[]): Promise<number>;
|
|
469
|
+
deleteAll(collection: string): Promise<number>;
|
|
470
|
+
count(collection: string): Promise<number>;
|
|
471
|
+
ping(): Promise<void>;
|
|
472
|
+
}
|
|
473
|
+
interface MilvusStoreOptions extends MilvusStoreConfig {
|
|
474
|
+
backend?: MilvusBackend;
|
|
475
|
+
}
|
|
476
|
+
declare class MilvusStore extends BaseStore {
|
|
477
|
+
readonly storeType: VectorStoreType;
|
|
478
|
+
private backend?;
|
|
479
|
+
private readonly injectedBackend?;
|
|
480
|
+
private readonly collection;
|
|
481
|
+
private readonly milvusConfig;
|
|
482
|
+
private initialized;
|
|
483
|
+
constructor(config: MilvusStoreOptions);
|
|
484
|
+
private get metricType();
|
|
485
|
+
init(): Promise<void>;
|
|
486
|
+
private ensureInitialized;
|
|
487
|
+
private buildSdkBackend;
|
|
488
|
+
upsert(records: VectorRecord[], options?: UpsertOptions): Promise<UpsertResult>;
|
|
489
|
+
query(vector: EmbeddingVector, options?: StoreQueryOptions): Promise<StoreQueryResult>;
|
|
490
|
+
delete(ids: string[], _options?: DeleteOptions): Promise<DeleteResult>;
|
|
491
|
+
deleteAll(_options?: DeleteOptions): Promise<DeleteResult>;
|
|
492
|
+
getStats(): Promise<StoreStats>;
|
|
493
|
+
checkHealth(): Promise<StoreHealth>;
|
|
494
|
+
close(): Promise<void>;
|
|
495
|
+
private toExpr;
|
|
496
|
+
}
|
|
497
|
+
interface MilvusSdkClient {
|
|
498
|
+
hasCollection(p: {
|
|
499
|
+
collection_name: string;
|
|
500
|
+
}): Promise<{
|
|
501
|
+
value: boolean;
|
|
502
|
+
}>;
|
|
503
|
+
createCollection(p: unknown): Promise<unknown>;
|
|
504
|
+
createIndex(p: unknown): Promise<unknown>;
|
|
505
|
+
loadCollectionSync(p: {
|
|
506
|
+
collection_name: string;
|
|
507
|
+
}): Promise<unknown>;
|
|
508
|
+
insert(p: {
|
|
509
|
+
collection_name: string;
|
|
510
|
+
data: unknown[];
|
|
511
|
+
}): Promise<unknown>;
|
|
512
|
+
search(p: unknown): Promise<{
|
|
513
|
+
results: Array<Record<string, unknown>>;
|
|
514
|
+
}>;
|
|
515
|
+
deleteEntities(p: {
|
|
516
|
+
collection_name: string;
|
|
517
|
+
expr: string;
|
|
518
|
+
}): Promise<unknown>;
|
|
519
|
+
getCollectionStatistics(p: {
|
|
520
|
+
collection_name: string;
|
|
521
|
+
}): Promise<{
|
|
522
|
+
data?: {
|
|
523
|
+
row_count?: string | number;
|
|
524
|
+
};
|
|
525
|
+
}>;
|
|
526
|
+
}
|
|
527
|
+
declare class MilvusSdkBackend implements MilvusBackend {
|
|
528
|
+
private readonly client;
|
|
529
|
+
constructor(client: MilvusSdkClient);
|
|
530
|
+
ensureCollection(collection: string, dimensions: number, metric: string): Promise<void>;
|
|
531
|
+
upsert(collection: string, rows: Array<{
|
|
532
|
+
id: string;
|
|
533
|
+
vector: number[];
|
|
534
|
+
text: string;
|
|
535
|
+
metadata: Record<string, unknown>;
|
|
536
|
+
}>): Promise<void>;
|
|
537
|
+
search(collection: string, vector: number[], limit: number, filter?: string): Promise<Array<{
|
|
538
|
+
id: string;
|
|
539
|
+
score: number;
|
|
540
|
+
text: string;
|
|
541
|
+
metadata: Record<string, unknown>;
|
|
542
|
+
}>>;
|
|
543
|
+
deleteByIds(collection: string, ids: string[]): Promise<number>;
|
|
544
|
+
deleteAll(collection: string): Promise<number>;
|
|
545
|
+
count(collection: string): Promise<number>;
|
|
546
|
+
ping(): Promise<void>;
|
|
547
|
+
}
|
|
548
|
+
declare function createMilvusStore(config: MilvusStoreOptions): MilvusStore;
|
|
549
|
+
|
|
296
550
|
declare function createStore(type: VectorStoreType, config: StoreConfig): BaseStore;
|
|
297
551
|
|
|
298
|
-
export { BaseStore, ChromaStore, type ChromaStoreConfig, type CollectionInfo, type DeleteOptions, type DeleteResult, type DistanceMetric, type IndexInfo, MemoryStore, type MemoryStoreConfig, type MilvusStoreConfig, type PgVectorStoreConfig, PineconeStore, type PineconeStoreConfig, QdrantStore, type QdrantStoreConfig, type StoreConfig, type StoreFactoryOptions, type StoreHealth, type StoreQueryOptions, type StoreQueryResult, type StoreStats, type StoredVector, type UpsertOptions, type UpsertResult, type VectorRecord, type VectorStoreType, type WeaviateStoreConfig, createChromaStore, createMemoryStore, createPineconeStore, createQdrantStore, createStore };
|
|
552
|
+
export { BaseStore, ChromaStore, type ChromaStoreConfig, type CollectionInfo, type DeleteOptions, type DeleteResult, type DistanceMetric, type IndexInfo, MemoryStore, type MemoryStoreConfig, type MilvusBackend, MilvusSdkBackend, MilvusStore, type MilvusStoreConfig, type MilvusStoreOptions, type PgPoolLike, PgVectorStore, type PgVectorStoreConfig, type PgVectorStoreOptions, PineconeStore, type PineconeStoreConfig, QdrantStore, type QdrantStoreConfig, type StoreConfig, type StoreFactoryOptions, type StoreHealth, type StoreQueryOptions, type StoreQueryResult, type StoreStats, type StoredVector, type UpsertOptions, type UpsertResult, type VectorRecord, type VectorStoreType, type WeaviateBackend, WeaviateSdkBackend, WeaviateStore, type WeaviateStoreConfig, type WeaviateStoreOptions, createChromaStore, createMemoryStore, createMilvusStore, createPgVectorStore, createPineconeStore, createQdrantStore, createStore, createWeaviateStore };
|