@lov3kaizen/agentsea-embeddings 1.0.1 → 1.1.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/dist/index.mjs CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  createSQLiteCache,
11
11
  createStandardTieredCache,
12
12
  createTieredCache
13
- } from "./chunk-VPSMDBHH.mjs";
13
+ } from "./chunk-MNJPAUDC.mjs";
14
14
  import {
15
15
  BaseChunker,
16
16
  CodeChunker,
@@ -29,18 +29,6 @@ import {
29
29
  mergeSmallChunks,
30
30
  splitLargeChunks
31
31
  } from "./chunk-DJAURHAS.mjs";
32
- import {
33
- BaseStore,
34
- ChromaStore,
35
- MemoryStore,
36
- PineconeStore,
37
- QdrantStore,
38
- createChromaStore,
39
- createMemoryStore,
40
- createPineconeStore,
41
- createQdrantStore,
42
- createStore
43
- } from "./chunk-TER262ST.mjs";
44
32
  import {
45
33
  BaseProvider,
46
34
  CohereProvider,
@@ -55,7 +43,20 @@ import {
55
43
  createOpenAIProvider,
56
44
  createRandomProvider,
57
45
  createVoyageProvider
58
- } from "./chunk-NBHIRTJT.mjs";
46
+ } from "./chunk-5GTQFVEI.mjs";
47
+ import {
48
+ BaseStore,
49
+ ChromaStore,
50
+ MemoryStore,
51
+ PineconeStore,
52
+ QdrantStore,
53
+ createChromaStore,
54
+ createMemoryStore,
55
+ createPineconeStore,
56
+ createQdrantStore,
57
+ createStore
58
+ } from "./chunk-JHWMXQ56.mjs";
59
+ import "./chunk-2TCNSTX3.mjs";
59
60
  import {
60
61
  batch,
61
62
  cacheKey,
@@ -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-DmEEUzJg.mjs';
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-G-KgyvZT.js';
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';
@@ -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
- "Either embedFn or modelPath is required for local provider"
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
  }
@@ -12,7 +12,8 @@ import {
12
12
  createOpenAIProvider,
13
13
  createRandomProvider,
14
14
  createVoyageProvider
15
- } from "../chunk-NBHIRTJT.mjs";
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 {
@@ -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 };
@@ -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 };