@juspay/neurolink 9.89.0 → 9.90.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.
Files changed (47) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/adapters/tts/googleTTSHandler.d.ts +10 -0
  3. package/dist/adapters/tts/googleTTSHandler.js +27 -18
  4. package/dist/agent/directTools.js +1 -1
  5. package/dist/browser/neurolink.min.js +370 -356
  6. package/dist/index.d.ts +1 -1
  7. package/dist/index.js +1 -1
  8. package/dist/lib/adapters/tts/googleTTSHandler.d.ts +10 -0
  9. package/dist/lib/adapters/tts/googleTTSHandler.js +27 -18
  10. package/dist/lib/agent/directTools.js +1 -1
  11. package/dist/lib/index.d.ts +1 -1
  12. package/dist/lib/index.js +1 -1
  13. package/dist/lib/rag/index.d.ts +1 -0
  14. package/dist/lib/rag/index.js +2 -0
  15. package/dist/lib/rag/stores/chroma.d.ts +90 -0
  16. package/dist/lib/rag/stores/chroma.js +281 -0
  17. package/dist/lib/rag/stores/index.d.ts +21 -0
  18. package/dist/lib/rag/stores/index.js +22 -0
  19. package/dist/lib/rag/stores/pgvector.d.ts +95 -0
  20. package/dist/lib/rag/stores/pgvector.js +400 -0
  21. package/dist/lib/rag/stores/pinecone.d.ts +85 -0
  22. package/dist/lib/rag/stores/pinecone.js +159 -0
  23. package/dist/lib/types/index.d.ts +2 -0
  24. package/dist/lib/types/index.js +2 -0
  25. package/dist/lib/types/rag.d.ts +30 -0
  26. package/dist/lib/types/vectorStoreChroma.d.ts +67 -0
  27. package/dist/lib/types/vectorStoreChroma.js +12 -0
  28. package/dist/lib/types/vectorStorePinecone.d.ts +48 -0
  29. package/dist/lib/types/vectorStorePinecone.js +12 -0
  30. package/dist/rag/index.d.ts +1 -0
  31. package/dist/rag/index.js +2 -0
  32. package/dist/rag/stores/chroma.d.ts +90 -0
  33. package/dist/rag/stores/chroma.js +280 -0
  34. package/dist/rag/stores/index.d.ts +21 -0
  35. package/dist/rag/stores/index.js +21 -0
  36. package/dist/rag/stores/pgvector.d.ts +95 -0
  37. package/dist/rag/stores/pgvector.js +399 -0
  38. package/dist/rag/stores/pinecone.d.ts +85 -0
  39. package/dist/rag/stores/pinecone.js +158 -0
  40. package/dist/types/index.d.ts +2 -0
  41. package/dist/types/index.js +2 -0
  42. package/dist/types/rag.d.ts +30 -0
  43. package/dist/types/vectorStoreChroma.d.ts +67 -0
  44. package/dist/types/vectorStoreChroma.js +11 -0
  45. package/dist/types/vectorStorePinecone.d.ts +48 -0
  46. package/dist/types/vectorStorePinecone.js +11 -0
  47. package/package.json +11 -7
@@ -0,0 +1,159 @@
1
+ /**
2
+ * Pinecone Vector Store Adapter
3
+ *
4
+ * Implements the `VectorStore` contract (see `src/lib/types/rag.ts`) against
5
+ * a Pinecone index, using client injection: callers construct their own
6
+ * `@pinecone-database/pinecone` client/index and pass it in. No Pinecone SDK
7
+ * is a runtime dependency of this package — `PineconeIndexLike` below is a
8
+ * minimal structural interface satisfied by the real `Index` object (and by
9
+ * hand-written mocks in tests).
10
+ *
11
+ * ## indexName -> namespace mapping
12
+ *
13
+ * The `VectorStore` contract's `indexName` parameter is mapped onto a
14
+ * Pinecone **namespace**, not a Pinecone index. Pinecone ties one client
15
+ * `Index` object to a single physical index (created ahead of time via
16
+ * Pinecone's control-plane API); namespaces are Pinecone's mechanism for
17
+ * partitioning data *within* that one index, and are the closest match to
18
+ * this SDK's per-call `indexName` concept.
19
+ *
20
+ * - If the injected client exposes `.namespace(name)` (as the real
21
+ * `@pinecone-database/pinecone` `Index.namespace()` does), every
22
+ * query/upsert/delete call routes through `client.namespace(indexName)`.
23
+ * - If the injected client does not expose `.namespace` (e.g. a caller
24
+ * already pre-scoped their client to a fixed namespace, or a minimal
25
+ * mock), calls go straight to the injected client and `indexName` has
26
+ * no further effect. Document this for your callers if you construct a
27
+ * `PineconeVectorStore` from a namespace-fixed client.
28
+ *
29
+ * ## Metadata filter translation
30
+ *
31
+ * `MetadataFilter` (Mongo/Sift-style) is translated to Pinecone's native
32
+ * filter DSL, which already shares the same `$op` shape for comparison
33
+ * operators. Supported operators: `$eq`, `$ne`, `$gt`, `$gte`, `$lt`,
34
+ * `$lte`, `$in`, `$nin` (field-level) and `$and` / `$or` (logical,
35
+ * recursively translated). Any other operator — `$not`, `$nor`, `$exists`,
36
+ * `$contains`, `$regex`, `$size` — has no Pinecone equivalent and throws a
37
+ * clear `Error` naming the offending operator/field rather than silently
38
+ * mis-filtering (Pinecone's filter DSL has no negation, existence, string
39
+ * containment, regex, or array-length operators).
40
+ */
41
+ /** Comparison operators Pinecone's filter DSL can express, verbatim. */
42
+ const SUPPORTED_COMPARISON_OPS = new Set([
43
+ "$eq",
44
+ "$ne",
45
+ "$gt",
46
+ "$gte",
47
+ "$lt",
48
+ "$lte",
49
+ "$in",
50
+ "$nin",
51
+ ]);
52
+ /** Logical operators Pinecone's filter DSL can express, verbatim. */
53
+ const SUPPORTED_LOGICAL_OPS = new Set(["$and", "$or"]);
54
+ /**
55
+ * Translate a `MetadataFilter` into Pinecone's native filter object.
56
+ *
57
+ * Throws a descriptive `Error` for any operator Pinecone cannot express
58
+ * ($not, $nor, $exists, $contains, $regex, $size) instead of silently
59
+ * dropping or mis-applying it.
60
+ */
61
+ export function translatePineconeFilter(filter) {
62
+ const result = {};
63
+ for (const [key, value] of Object.entries(filter)) {
64
+ if (key.startsWith("$")) {
65
+ if (!SUPPORTED_LOGICAL_OPS.has(key)) {
66
+ throw new Error(`PineconeVectorStore: MetadataFilter operator "${key}" cannot be translated to Pinecone's filter DSL ` +
67
+ `(supported logical operators: ${[...SUPPORTED_LOGICAL_OPS].join(", ")}). ` +
68
+ `Restructure the filter to avoid "${key}".`);
69
+ }
70
+ const subFilters = value;
71
+ result[key] = subFilters.map((sub) => translatePineconeFilter(sub));
72
+ continue;
73
+ }
74
+ if (typeof value === "object" && value !== null && !Array.isArray(value)) {
75
+ const ops = value;
76
+ const translatedOps = {};
77
+ for (const opKey of Object.keys(ops)) {
78
+ if (!SUPPORTED_COMPARISON_OPS.has(opKey)) {
79
+ throw new Error(`PineconeVectorStore: MetadataFilter operator "${opKey}" on field "${key}" cannot be translated to ` +
80
+ `Pinecone's filter DSL (supported: ${[...SUPPORTED_COMPARISON_OPS].join(", ")}). ` +
81
+ `Restructure the filter to avoid "${opKey}" on "${key}".`);
82
+ }
83
+ translatedOps[opKey] = ops[opKey];
84
+ }
85
+ result[key] = translatedOps;
86
+ }
87
+ else {
88
+ // Primitive/array/null value: Pinecone treats a bare value as
89
+ // implicit equality, matching InMemoryVectorStore's direct-equality
90
+ // fallback for non-object filter values.
91
+ result[key] = value;
92
+ }
93
+ }
94
+ return result;
95
+ }
96
+ /**
97
+ * Pinecone-backed implementation of the `VectorStore` contract.
98
+ *
99
+ * @example
100
+ * ```typescript
101
+ * import { Pinecone } from '@pinecone-database/pinecone';
102
+ * import { PineconeVectorStore } from '@juspay/neurolink/rag';
103
+ *
104
+ * const client = new Pinecone({ apiKey: process.env.PINECONE_API_KEY! });
105
+ * const store = new PineconeVectorStore(client.index('my-index'));
106
+ *
107
+ * await store.upsert('tenant-a', [{ id: '1', vector: [...], metadata: { text: 'hello' } }]);
108
+ * const results = await store.query({ indexName: 'tenant-a', queryVector: [...], topK: 5 });
109
+ * ```
110
+ */
111
+ export class PineconeVectorStore {
112
+ client;
113
+ constructor(client) {
114
+ this.client = client;
115
+ }
116
+ /** Resolve the Pinecone client scoped to `indexName` (see class docs re: namespace mapping). */
117
+ resolveClient(indexName) {
118
+ return this.client.namespace
119
+ ? this.client.namespace(indexName)
120
+ : this.client;
121
+ }
122
+ async query(params) {
123
+ const { indexName, queryVector, topK = 10, filter, includeVectors = false, } = params;
124
+ const target = this.resolveClient(indexName);
125
+ const response = await target.query({
126
+ vector: queryVector,
127
+ topK,
128
+ ...(filter ? { filter: translatePineconeFilter(filter) } : {}),
129
+ includeMetadata: true,
130
+ includeValues: includeVectors,
131
+ });
132
+ const matches = response.matches ?? [];
133
+ return matches.map((match) => {
134
+ const metadata = match.metadata ?? {};
135
+ return {
136
+ id: match.id,
137
+ score: match.score,
138
+ text: metadata.text,
139
+ metadata,
140
+ ...(includeVectors && match.values ? { vector: match.values } : {}),
141
+ };
142
+ });
143
+ }
144
+ /** Add or update vectors in the namespace mapped from `indexName`. */
145
+ async upsert(indexName, items) {
146
+ const target = this.resolveClient(indexName);
147
+ await target.upsert(items.map((item) => ({
148
+ id: item.id,
149
+ values: item.vector,
150
+ metadata: item.metadata ?? {},
151
+ })));
152
+ }
153
+ /** Delete vectors by id from the namespace mapped from `indexName`. */
154
+ async delete(indexName, ids) {
155
+ const target = this.resolveClient(indexName);
156
+ await target.deleteMany(ids);
157
+ }
158
+ }
159
+ //# sourceMappingURL=pinecone.js.map
@@ -54,6 +54,8 @@ export * from "./taskClassification.js";
54
54
  export * from "./toolDedup.js";
55
55
  export * from "./toolRouting.js";
56
56
  export * from "./tools.js";
57
+ export * from "./vectorStoreChroma.js";
58
+ export * from "./vectorStorePinecone.js";
57
59
  export * from "./voice.js";
58
60
  export * from "./universalProviderOptions.js";
59
61
  export * from "./utilities.js";
@@ -55,6 +55,8 @@ export * from "./taskClassification.js";
55
55
  export * from "./toolDedup.js";
56
56
  export * from "./toolRouting.js";
57
57
  export * from "./tools.js";
58
+ export * from "./vectorStoreChroma.js";
59
+ export * from "./vectorStorePinecone.js";
58
60
  export * from "./voice.js";
59
61
  export * from "./universalProviderOptions.js";
60
62
  export * from "./utilities.js";
@@ -419,6 +419,36 @@ export type VectorStore = {
419
419
  includeVectors?: boolean;
420
420
  }): Promise<VectorQueryResult[]>;
421
421
  };
422
+ /** Minimal shape of a query result, satisfied by both `pg` and `pglite`. */
423
+ export type PgQueryResult<T = unknown> = {
424
+ rows: T[];
425
+ };
426
+ /**
427
+ * Minimal structural interface a caller-supplied Postgres client must
428
+ * satisfy. Both `pg.Pool` (`node-postgres`) and `@electric-sql/pglite`
429
+ * instances already expose a compatible `query(text, values?)` method —
430
+ * neither is a dependency of this package. Callers construct and own the
431
+ * client; `PgVectorStore` only ever calls `query()` on it.
432
+ */
433
+ export type PgClientLike = {
434
+ query(text: string, values?: unknown[]): Promise<PgQueryResult>;
435
+ };
436
+ /** Construction options for `PgVectorStore`. */
437
+ export type PgVectorStoreOptions = {
438
+ /**
439
+ * Prefix prepended to `indexName` to derive the backing table name.
440
+ * Must itself be a valid, unquoted Postgres identifier.
441
+ * @default "neurolink_vs_"
442
+ */
443
+ tablePrefix?: string;
444
+ };
445
+ /** Row shape returned by `PgVectorStore`'s SELECT queries. */
446
+ export type PgVectorStoreRow = {
447
+ id: string;
448
+ metadata: unknown;
449
+ score: unknown;
450
+ embedding?: unknown;
451
+ };
422
452
  /**
423
453
  * Document loader options
424
454
  */
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Structural types for the Chroma vector store adapter
3
+ * (`src/lib/rag/stores/chroma.ts`).
4
+ *
5
+ * These mirror the subset of the `chromadb` package's API the adapter
6
+ * calls (`ChromaClient.getOrCreateCollection`, `Collection.upsert/query/
7
+ * delete`). NeuroLink has zero runtime dependency on `chromadb` — callers
8
+ * construct their own client and inject an object satisfying
9
+ * `ChromaClientLike`.
10
+ */
11
+ export type ChromaMetadataValue = string | number | boolean;
12
+ export type ChromaMetadata = Record<string, ChromaMetadataValue>;
13
+ /** Chroma's metadata `where` filter payload shape. */
14
+ export type ChromaWhere = Record<string, unknown>;
15
+ export type ChromaIncludeField = "embeddings" | "metadatas" | "documents" | "distances";
16
+ export type ChromaUpsertParams = {
17
+ ids: string[];
18
+ embeddings?: number[][];
19
+ metadatas?: Array<ChromaMetadata | null>;
20
+ documents?: Array<string | null>;
21
+ };
22
+ export type ChromaQueryParams = {
23
+ queryEmbeddings: number[][];
24
+ nResults?: number;
25
+ where?: ChromaWhere;
26
+ include?: ChromaIncludeField[];
27
+ };
28
+ export type ChromaQueryResponse = {
29
+ ids: string[][];
30
+ embeddings?: Array<Array<number[] | null>> | null;
31
+ metadatas?: Array<Array<ChromaMetadata | null>> | null;
32
+ documents?: Array<Array<string | null>> | null;
33
+ distances?: Array<Array<number | null>> | null;
34
+ };
35
+ export type ChromaDeleteParams = {
36
+ ids?: string[];
37
+ where?: ChromaWhere;
38
+ };
39
+ /**
40
+ * Minimal structural interface for a Chroma collection handle, matching the
41
+ * subset of `Collection` (from `chromadb`) the adapter calls.
42
+ */
43
+ export type ChromaCollectionLike = {
44
+ upsert(params: ChromaUpsertParams): Promise<unknown>;
45
+ query(params: ChromaQueryParams): Promise<ChromaQueryResponse>;
46
+ delete(params: ChromaDeleteParams): Promise<unknown>;
47
+ };
48
+ /**
49
+ * Minimal structural interface for a Chroma client, matching the subset of
50
+ * `ChromaClient` (from `chromadb`) the adapter calls.
51
+ */
52
+ export type ChromaClientLike = {
53
+ getOrCreateCollection(params: {
54
+ name: string;
55
+ metadata?: Record<string, unknown>;
56
+ }): Promise<ChromaCollectionLike>;
57
+ };
58
+ export type ChromaDistanceMetric = "cosine" | "l2" | "ip";
59
+ export type ChromaVectorStoreOptions = {
60
+ /**
61
+ * The distance metric configured on the underlying Chroma collection(s)
62
+ * (Chroma's `hnsw:space`). Used only to convert returned distances into a
63
+ * `score`; see `src/lib/rag/stores/chroma.ts` module doc comment.
64
+ * Defaults to `"cosine"`.
65
+ */
66
+ distanceMetric?: ChromaDistanceMetric;
67
+ };
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Structural types for the Chroma vector store adapter
3
+ * (`src/lib/rag/stores/chroma.ts`).
4
+ *
5
+ * These mirror the subset of the `chromadb` package's API the adapter
6
+ * calls (`ChromaClient.getOrCreateCollection`, `Collection.upsert/query/
7
+ * delete`). NeuroLink has zero runtime dependency on `chromadb` — callers
8
+ * construct their own client and inject an object satisfying
9
+ * `ChromaClientLike`.
10
+ */
11
+ export {};
12
+ //# sourceMappingURL=vectorStoreChroma.js.map
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Structural types for the Pinecone vector store adapter
3
+ * (`src/lib/rag/stores/pinecone.ts`).
4
+ *
5
+ * These mirror the subset of the `@pinecone-database/pinecone` package's API
6
+ * the adapter calls (`Index.query/upsert/deleteMany`, optional
7
+ * `Index.namespace`). NeuroLink has zero runtime dependency on the Pinecone
8
+ * SDK — callers construct their own client/index and inject an object
9
+ * satisfying `PineconeIndexLike`.
10
+ */
11
+ /** A single scored match as returned by Pinecone's query API. */
12
+ export type PineconeMatch = {
13
+ id: string;
14
+ score?: number;
15
+ values?: number[];
16
+ metadata?: Record<string, unknown>;
17
+ };
18
+ /** Shape of the response returned by `PineconeIndexLike.query()`. */
19
+ export type PineconeQueryResponse = {
20
+ matches?: PineconeMatch[];
21
+ };
22
+ /** Request payload accepted by `PineconeIndexLike.query()`. */
23
+ export type PineconeQueryRequest = {
24
+ vector: number[];
25
+ topK: number;
26
+ filter?: Record<string, unknown>;
27
+ includeMetadata?: boolean;
28
+ includeValues?: boolean;
29
+ };
30
+ /** A single record accepted by `PineconeIndexLike.upsert()`. */
31
+ export type PineconeUpsertRecord = {
32
+ id: string;
33
+ values: number[];
34
+ metadata?: Record<string, unknown>;
35
+ };
36
+ /**
37
+ * Minimal structural interface modeled on the `@pinecone-database/pinecone`
38
+ * `Index` object. Satisfied by the real SDK's `Index` without modification;
39
+ * callers never need to install the Pinecone SDK as a dependency of this
40
+ * package — they bring their own already-constructed client instance.
41
+ */
42
+ export type PineconeIndexLike = {
43
+ /** Returns a client scoped to the given namespace, if the client supports namespacing. */
44
+ namespace?(ns: string): PineconeIndexLike;
45
+ query(request: PineconeQueryRequest): Promise<PineconeQueryResponse>;
46
+ upsert(records: PineconeUpsertRecord[]): Promise<unknown>;
47
+ deleteMany(ids: string[]): Promise<unknown>;
48
+ };
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Structural types for the Pinecone vector store adapter
3
+ * (`src/lib/rag/stores/pinecone.ts`).
4
+ *
5
+ * These mirror the subset of the `@pinecone-database/pinecone` package's API
6
+ * the adapter calls (`Index.query/upsert/deleteMany`, optional
7
+ * `Index.namespace`). NeuroLink has zero runtime dependency on the Pinecone
8
+ * SDK — callers construct their own client/index and inject an object
9
+ * satisfying `PineconeIndexLike`.
10
+ */
11
+ export {};
12
+ //# sourceMappingURL=vectorStorePinecone.js.map
@@ -56,6 +56,7 @@ export { prepareRAGTool } from "./ragIntegration.js";
56
56
  export { batchRerank, CohereRelevanceScorer, CrossEncoderReranker, createReranker, getAvailableRerankers, getAvailableRerankerTypes, getRegisteredRerankerMetadata, getReranker, getRerankerDefaultConfig, getRerankerMetadata, RerankerFactory, RerankerRegistry, rerank, rerankerFactory, rerankerRegistry, simpleRerank, } from "./reranker/index.js";
57
57
  export * from "./resilience/index.js";
58
58
  export { createHybridSearch, createVectorQueryTool, InMemoryBM25Index, InMemoryVectorStore, linearCombination, reciprocalRankFusion, } from "./retrieval/index.js";
59
+ export * from "./stores/index.js";
59
60
  export * from "../types/index.js";
60
61
  import type { Chunk, ChunkingStrategy, ExtractParams } from "../types/index.js";
61
62
  /**
package/dist/rag/index.js CHANGED
@@ -76,6 +76,8 @@ RerankerRegistry, rerank, rerankerFactory, rerankerRegistry, simpleRerank, } fro
76
76
  export * from "./resilience/index.js";
77
77
  // Retrieval
78
78
  export { createHybridSearch, createVectorQueryTool, InMemoryBM25Index, InMemoryVectorStore, linearCombination, reciprocalRankFusion, } from "./retrieval/index.js";
79
+ // Vector store adapters (Pinecone, pgvector, Chroma — client-injection)
80
+ export * from "./stores/index.js";
79
81
  // Types
80
82
  export * from "../types/index.js";
81
83
  // Convenience functions
@@ -0,0 +1,90 @@
1
+ /**
2
+ * Chroma vector store adapter
3
+ *
4
+ * Implements the `VectorStore` contract (see `src/lib/types/rag.ts`) against
5
+ * a Chroma collection. This module has zero runtime dependency on the
6
+ * `chromadb` package: callers construct their own `ChromaClient` (or any
7
+ * compatible object) and inject it here. The structural interfaces below
8
+ * mirror the subset of the `chromadb` API this adapter relies on
9
+ * (`getOrCreateCollection`, `collection.upsert/query/delete`).
10
+ *
11
+ * ## Distance -> similarity scoring
12
+ *
13
+ * Chroma returns *distances*, not similarities, and the meaning of that
14
+ * distance depends entirely on the collection's configured `hnsw:space`
15
+ * (this adapter does not — and cannot — set that; it is chosen when the
16
+ * collection is created on the Chroma side). `distanceMetric` tells this
17
+ * adapter which space the collection uses so it can invert the distance
18
+ * into a `score` consistent with `InMemoryVectorStore` (higher = more
19
+ * similar):
20
+ *
21
+ * - `"cosine"` (default): Chroma returns `distance = 1 - cosineSimilarity`,
22
+ * so `score = 1 - distance` reproduces `InMemoryVectorStore`'s cosine
23
+ * score exactly.
24
+ * - `"ip"`: Chroma returns `distance = 1 - dot(a, b)`, so
25
+ * `score = 1 - distance` yields the raw dot product — only equal to
26
+ * cosine similarity if both vectors are unit-normalized.
27
+ * - `"l2"`: Chroma returns squared Euclidean distance, range
28
+ * `[0, Infinity)`, which has no exact inverse into a cosine-similarity
29
+ * scale. It is converted via `score = 1 / (1 + distance)`, a
30
+ * monotonically decreasing-in-distance map into `(0, 1]`. This preserves
31
+ * result ordering but is NOT numerically comparable to cosine scores.
32
+ *
33
+ * Passing a `distanceMetric` that does not match the collection's actual
34
+ * `hnsw:space` will silently produce meaningless scores (Chroma has no way
35
+ * to report its configured space back to the client), so callers must keep
36
+ * the two in sync.
37
+ *
38
+ * ## Metadata round-tripping
39
+ *
40
+ * Chroma metadata values must be strings, numbers, or booleans. Values that
41
+ * are `undefined` are dropped (Chroma rejects `undefined`); any other
42
+ * non-primitive value (object, array, `null`) is `JSON.stringify`-ed on
43
+ * write. This is lossy: such values come back as JSON-encoded strings on
44
+ * read, not their original type. Store only primitive metadata values if
45
+ * you need exact round-tripping.
46
+ *
47
+ * ## indexName -> collection mapping
48
+ *
49
+ * `indexName` is used verbatim as the Chroma collection name (1:1,
50
+ * lazily created via `getOrCreateCollection` and cached for the lifetime of
51
+ * this adapter instance).
52
+ */
53
+ import type { ChromaClientLike, ChromaVectorStoreOptions, ChromaWhere, MetadataFilter, VectorQueryResult, VectorStore } from "../../types/index.js";
54
+ /**
55
+ * Translates a `MetadataFilter` into a Chroma `where` clause.
56
+ *
57
+ * Throws a clear error for any operator Chroma's metadata `where` clause
58
+ * cannot express ($not, $nor, $exists, $contains, $regex, $size) rather than
59
+ * silently dropping the constraint and mis-filtering results.
60
+ */
61
+ export declare function translateMetadataFilter(filter: MetadataFilter): ChromaWhere;
62
+ export declare class ChromaVectorStore implements VectorStore {
63
+ private readonly client;
64
+ private readonly collections;
65
+ private readonly distanceMetric;
66
+ constructor(client: ChromaClientLike, options?: ChromaVectorStoreOptions);
67
+ private getCollection;
68
+ /**
69
+ * Add or update vectors in an index (Chroma collection).
70
+ */
71
+ upsert(indexName: string, items: Array<{
72
+ id: string;
73
+ vector: number[];
74
+ metadata?: Record<string, unknown>;
75
+ }>): Promise<void>;
76
+ /**
77
+ * Query vectors by similarity.
78
+ */
79
+ query(params: {
80
+ indexName: string;
81
+ queryVector: number[];
82
+ topK?: number;
83
+ filter?: MetadataFilter;
84
+ includeVectors?: boolean;
85
+ }): Promise<VectorQueryResult[]>;
86
+ /**
87
+ * Delete vectors from an index (Chroma collection) by id.
88
+ */
89
+ delete(indexName: string, ids: string[]): Promise<void>;
90
+ }