@anvia/chroma 0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Indra Zulfi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,100 @@
1
+ # @anvia/chroma
2
+
3
+ ChromaDB vector store adapter for Anvia.
4
+
5
+ Use this package when you want to store Anvia embedded documents in ChromaDB and query them through Anvia's vector search interfaces.
6
+
7
+ ## Installation
8
+
9
+ ```sh
10
+ pnpm add @anvia/chroma @anvia/core chromadb
11
+ ```
12
+
13
+ In this monorepo, the package is available through the workspace:
14
+
15
+ ```sh
16
+ pnpm --filter @anvia/chroma build
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ ```ts
22
+ import { embedDocuments } from "@anvia/core";
23
+ import { OpenAIClient } from "@anvia/openai";
24
+ import { ChromaVectorStore } from "@anvia/chroma";
25
+
26
+ const openai = new OpenAIClient({
27
+ apiKey,
28
+ });
29
+
30
+ const embeddings = openai.embeddingModel("text-embedding-3-small");
31
+
32
+ const documents = await embedDocuments(
33
+ embeddings,
34
+ [
35
+ {
36
+ id: "password-reset",
37
+ title: "Password reset policy",
38
+ body: "Password reset links expire after 30 minutes.",
39
+ product: "support",
40
+ },
41
+ {
42
+ id: "priority-support",
43
+ title: "Priority support",
44
+ body: "Enterprise customers receive priority support.",
45
+ product: "support",
46
+ },
47
+ ],
48
+ {
49
+ id: (document) => document.id,
50
+ content: (document) => `${document.title}\n${document.body}`,
51
+ metadata: (document) => ({
52
+ product: document.product,
53
+ title: document.title,
54
+ }),
55
+ },
56
+ );
57
+
58
+ const store = await ChromaVectorStore.connect({
59
+ collectionName: "support_docs",
60
+ });
61
+
62
+ await store.upsertDocuments(documents);
63
+
64
+ const index = store.index(embeddings);
65
+ const results = await index.search({
66
+ query: "How long does a password reset link last?",
67
+ topK: 3,
68
+ });
69
+
70
+ console.log(results);
71
+ ```
72
+
73
+ ## ChromaDB
74
+
75
+ By default, `ChromaVectorStore.connect` creates a `ChromaClient` from the `chromadb` package. You can also pass a custom client:
76
+
77
+ ```ts
78
+ const store = await ChromaVectorStore.connect({
79
+ client,
80
+ collectionName: "support_docs",
81
+ createIfMissing: true,
82
+ });
83
+ ```
84
+
85
+ `connect(...)` is async by design. It verifies or creates the Chroma collection before returning a store, so configuration and connection errors fail early instead of surfacing later from `upsertDocuments(...)` or `search(...)`. Constructors stay synchronous and side-effect free.
86
+
87
+ ## Exports
88
+
89
+ - `ChromaVectorStore`
90
+ - `ChromaVectorIndex`
91
+ - `filterToChromaWhere`
92
+ - `ChromaVectorStoreConnectOptions`
93
+
94
+ ## Development
95
+
96
+ ```sh
97
+ pnpm --filter @anvia/chroma typecheck
98
+ pnpm --filter @anvia/chroma test
99
+ pnpm --filter @anvia/chroma build
100
+ ```
@@ -0,0 +1,42 @@
1
+ import { VectorMetadata, VectorSearchIndex, EmbeddingModel, VectorSearchRequest, VectorSearchResult, VectorSearchToolOptions, Tool, EmbeddedDocument, VectorFilter } from '@anvia/core';
2
+
3
+ type ChromaClientLike = {
4
+ getCollection(options: Record<string, unknown>): Promise<ChromaCollectionLike>;
5
+ createCollection(options: Record<string, unknown>): Promise<ChromaCollectionLike>;
6
+ getOrCreateCollection?(options: Record<string, unknown>): Promise<ChromaCollectionLike>;
7
+ };
8
+ type ChromaCollectionLike = {
9
+ upsert(options: Record<string, unknown>): Promise<unknown>;
10
+ query(options: Record<string, unknown>): Promise<unknown>;
11
+ };
12
+ type ChromaVectorStoreConnectOptions = {
13
+ client?: ChromaClientLike | undefined;
14
+ collectionName: string;
15
+ createIfMissing?: boolean | undefined;
16
+ metadata?: Record<string, unknown> | undefined;
17
+ configuration?: Record<string, unknown> | undefined;
18
+ };
19
+ declare class ChromaVectorStore<T, Metadata extends VectorMetadata = VectorMetadata> {
20
+ private readonly collection;
21
+ private constructor();
22
+ static connect<T, Metadata extends VectorMetadata = VectorMetadata>(options: ChromaVectorStoreConnectOptions): Promise<ChromaVectorStore<T, Metadata>>;
23
+ upsertDocuments(documents: Array<EmbeddedDocument<T, Metadata>>): Promise<void>;
24
+ index(model: EmbeddingModel): ChromaVectorIndex<T, Metadata>;
25
+ }
26
+ declare class ChromaVectorIndex<T, Metadata extends VectorMetadata = VectorMetadata> implements VectorSearchIndex<T, Metadata> {
27
+ private readonly model;
28
+ private readonly collection;
29
+ constructor(model: EmbeddingModel, collection: ChromaCollectionLike);
30
+ search(request: VectorSearchRequest): Promise<Array<VectorSearchResult<T, Metadata>>>;
31
+ searchIds(request: VectorSearchRequest): Promise<Array<{
32
+ score: number;
33
+ id: string;
34
+ }>>;
35
+ asTool(options: VectorSearchToolOptions): Tool<{
36
+ query: string;
37
+ topK?: number;
38
+ }, unknown>;
39
+ }
40
+ declare function filterToChromaWhere(filter: VectorFilter | undefined): unknown;
41
+
42
+ export { ChromaVectorIndex, ChromaVectorStore, type ChromaVectorStoreConnectOptions, filterToChromaWhere };
package/dist/index.js ADDED
@@ -0,0 +1,150 @@
1
+ // src/index.ts
2
+ import {
3
+ createVectorSearchTool,
4
+ embedText
5
+ } from "@anvia/core";
6
+ var ChromaVectorStore = class _ChromaVectorStore {
7
+ constructor(collection) {
8
+ this.collection = collection;
9
+ }
10
+ collection;
11
+ static async connect(options) {
12
+ const client = options.client ?? await defaultChromaClient();
13
+ const collectionOptions = {
14
+ name: options.collectionName,
15
+ metadata: options.metadata ?? { "hnsw:space": "cosine" },
16
+ configuration: options.configuration,
17
+ embeddingFunction: null
18
+ };
19
+ const collection = options.createIfMissing === false ? await client.getCollection(collectionOptions) : client.getOrCreateCollection !== void 0 ? await client.getOrCreateCollection(collectionOptions) : await getOrCreateCollection(client, collectionOptions);
20
+ return new _ChromaVectorStore(collection);
21
+ }
22
+ async upsertDocuments(documents) {
23
+ const records = documents.flatMap((document) => chromaRecords(document));
24
+ await this.collection.upsert({
25
+ ids: records.map((record) => record.id),
26
+ documents: records.map((record) => record.document),
27
+ embeddings: records.map((record) => record.embedding),
28
+ ...records.some((record) => record.metadata !== void 0) ? { metadatas: records.map((record) => record.metadata ?? null) } : {}
29
+ });
30
+ }
31
+ index(model) {
32
+ return new ChromaVectorIndex(model, this.collection);
33
+ }
34
+ };
35
+ var ChromaVectorIndex = class {
36
+ constructor(model, collection) {
37
+ this.model = model;
38
+ this.collection = collection;
39
+ }
40
+ model;
41
+ collection;
42
+ async search(request) {
43
+ const queryEmbedding = await embedText(this.model, request.query);
44
+ const response = await this.collection.query({
45
+ queryEmbeddings: [queryEmbedding.vector],
46
+ nResults: request.topK,
47
+ where: filterToChromaWhere(request.filter),
48
+ include: ["documents", "metadatas", "distances"]
49
+ });
50
+ return parseQueryResults(response, request.threshold);
51
+ }
52
+ async searchIds(request) {
53
+ return (await this.search(request)).map(({ score, id }) => ({ score, id }));
54
+ }
55
+ asTool(options) {
56
+ return createVectorSearchTool(this, options);
57
+ }
58
+ };
59
+ function filterToChromaWhere(filter) {
60
+ if (filter === void 0) {
61
+ return void 0;
62
+ }
63
+ switch (filter.type) {
64
+ case "eq":
65
+ return { [filter.key]: { $eq: filter.value } };
66
+ case "gt":
67
+ return { [filter.key]: { $gt: filter.value } };
68
+ case "lt":
69
+ return { [filter.key]: { $lt: filter.value } };
70
+ case "and":
71
+ return { $and: filter.filters.map(filterToChromaWhere) };
72
+ case "or":
73
+ return { $or: filter.filters.map(filterToChromaWhere) };
74
+ }
75
+ }
76
+ async function defaultChromaClient() {
77
+ const chroma = await import("chromadb");
78
+ return new chroma.ChromaClient();
79
+ }
80
+ async function getOrCreateCollection(client, options) {
81
+ try {
82
+ return await client.getCollection(options);
83
+ } catch {
84
+ return await client.createCollection(options);
85
+ }
86
+ }
87
+ function serializeDocument(document) {
88
+ return typeof document === "string" ? document : JSON.stringify(document);
89
+ }
90
+ function parseQueryResults(response, threshold) {
91
+ const raw = response;
92
+ const ids = raw.ids?.[0] ?? [];
93
+ const documents = raw.documents?.[0] ?? [];
94
+ const metadatas = raw.metadatas?.[0] ?? [];
95
+ const distances = raw.distances?.[0] ?? [];
96
+ const results = ids.flatMap((id, index) => {
97
+ const score = distanceToCosineScore(distances[index] ?? 0);
98
+ if (threshold !== void 0 && score < threshold) {
99
+ return [];
100
+ }
101
+ return [
102
+ {
103
+ id: logicalDocumentId(id),
104
+ score,
105
+ document: parseDocument(documents[index]),
106
+ ...metadatas[index] === null || metadatas[index] === void 0 ? {} : { metadata: metadatas[index] }
107
+ }
108
+ ];
109
+ });
110
+ const byId = /* @__PURE__ */ new Map();
111
+ for (const result of results) {
112
+ if (!byId.has(result.id)) {
113
+ byId.set(result.id, result);
114
+ }
115
+ }
116
+ return [...byId.values()];
117
+ }
118
+ function distanceToCosineScore(distance) {
119
+ return 1 - distance;
120
+ }
121
+ function parseDocument(document) {
122
+ if (document === null || document === void 0) {
123
+ return "";
124
+ }
125
+ try {
126
+ return JSON.parse(document);
127
+ } catch {
128
+ return document;
129
+ }
130
+ }
131
+ function chromaRecords(document) {
132
+ if (document.embeddings.length === 0) {
133
+ throw new Error(`Document ${document.id} has no embeddings`);
134
+ }
135
+ return document.embeddings.map((embedding, index) => ({
136
+ id: document.embeddings.length === 1 ? document.id : `${document.id}#embedding:${index}`,
137
+ document: serializeDocument(document.document),
138
+ metadata: document.metadata,
139
+ embedding: embedding.vector
140
+ }));
141
+ }
142
+ function logicalDocumentId(id) {
143
+ return id.replace(/#embedding:\d+$/, "");
144
+ }
145
+ export {
146
+ ChromaVectorIndex,
147
+ ChromaVectorStore,
148
+ filterToChromaWhere
149
+ };
150
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import {\n createVectorSearchTool,\n type EmbeddedDocument,\n type EmbeddingModel,\n embedText,\n type Tool,\n type VectorFilter,\n type VectorMetadata,\n type VectorSearchIndex,\n type VectorSearchRequest,\n type VectorSearchResult,\n type VectorSearchToolOptions,\n} from \"@anvia/core\";\n\ntype ChromaClientLike = {\n getCollection(options: Record<string, unknown>): Promise<ChromaCollectionLike>;\n createCollection(options: Record<string, unknown>): Promise<ChromaCollectionLike>;\n getOrCreateCollection?(options: Record<string, unknown>): Promise<ChromaCollectionLike>;\n};\n\ntype ChromaCollectionLike = {\n upsert(options: Record<string, unknown>): Promise<unknown>;\n query(options: Record<string, unknown>): Promise<unknown>;\n};\n\nexport type ChromaVectorStoreConnectOptions = {\n client?: ChromaClientLike | undefined;\n collectionName: string;\n createIfMissing?: boolean | undefined;\n metadata?: Record<string, unknown> | undefined;\n configuration?: Record<string, unknown> | undefined;\n};\n\nexport class ChromaVectorStore<T, Metadata extends VectorMetadata = VectorMetadata> {\n private constructor(private readonly collection: ChromaCollectionLike) {}\n\n static async connect<T, Metadata extends VectorMetadata = VectorMetadata>(\n options: ChromaVectorStoreConnectOptions,\n ): Promise<ChromaVectorStore<T, Metadata>> {\n const client = options.client ?? (await defaultChromaClient());\n const collectionOptions = {\n name: options.collectionName,\n metadata: options.metadata ?? { \"hnsw:space\": \"cosine\" },\n configuration: options.configuration,\n embeddingFunction: null,\n };\n const collection =\n options.createIfMissing === false\n ? await client.getCollection(collectionOptions)\n : client.getOrCreateCollection !== undefined\n ? await client.getOrCreateCollection(collectionOptions)\n : await getOrCreateCollection(client, collectionOptions);\n return new ChromaVectorStore<T, Metadata>(collection);\n }\n\n async upsertDocuments(documents: Array<EmbeddedDocument<T, Metadata>>): Promise<void> {\n const records = documents.flatMap((document) => chromaRecords(document));\n await this.collection.upsert({\n ids: records.map((record) => record.id),\n documents: records.map((record) => record.document),\n embeddings: records.map((record) => record.embedding),\n ...(records.some((record) => record.metadata !== undefined)\n ? { metadatas: records.map((record) => record.metadata ?? null) }\n : {}),\n });\n }\n\n index(model: EmbeddingModel): ChromaVectorIndex<T, Metadata> {\n return new ChromaVectorIndex(model, this.collection);\n }\n}\n\nexport class ChromaVectorIndex<T, Metadata extends VectorMetadata = VectorMetadata>\n implements VectorSearchIndex<T, Metadata>\n{\n constructor(\n private readonly model: EmbeddingModel,\n private readonly collection: ChromaCollectionLike,\n ) {}\n\n async search(request: VectorSearchRequest): Promise<Array<VectorSearchResult<T, Metadata>>> {\n const queryEmbedding = await embedText(this.model, request.query);\n const response = await this.collection.query({\n queryEmbeddings: [queryEmbedding.vector],\n nResults: request.topK,\n where: filterToChromaWhere(request.filter),\n include: [\"documents\", \"metadatas\", \"distances\"],\n });\n return parseQueryResults<T, Metadata>(response, request.threshold);\n }\n\n async searchIds(request: VectorSearchRequest): Promise<Array<{ score: number; id: string }>> {\n return (await this.search(request)).map(({ score, id }) => ({ score, id }));\n }\n\n asTool(options: VectorSearchToolOptions): Tool<{ query: string; topK?: number }, unknown> {\n return createVectorSearchTool(this, options);\n }\n}\n\nexport function filterToChromaWhere(filter: VectorFilter | undefined): unknown {\n if (filter === undefined) {\n return undefined;\n }\n\n switch (filter.type) {\n case \"eq\":\n return { [filter.key]: { $eq: filter.value } };\n case \"gt\":\n return { [filter.key]: { $gt: filter.value } };\n case \"lt\":\n return { [filter.key]: { $lt: filter.value } };\n case \"and\":\n return { $and: filter.filters.map(filterToChromaWhere) };\n case \"or\":\n return { $or: filter.filters.map(filterToChromaWhere) };\n }\n}\n\nasync function defaultChromaClient(): Promise<ChromaClientLike> {\n const chroma = await import(\"chromadb\");\n return new chroma.ChromaClient() as ChromaClientLike;\n}\n\nasync function getOrCreateCollection(\n client: ChromaClientLike,\n options: Record<string, unknown>,\n): Promise<ChromaCollectionLike> {\n try {\n return await client.getCollection(options);\n } catch {\n return await client.createCollection(options);\n }\n}\n\nfunction serializeDocument(document: unknown): string {\n return typeof document === \"string\" ? document : JSON.stringify(document);\n}\n\nfunction parseQueryResults<T, Metadata extends VectorMetadata>(\n response: unknown,\n threshold: number | undefined,\n): Array<VectorSearchResult<T, Metadata>> {\n const raw = response as {\n ids?: string[][];\n documents?: Array<Array<string | null>>;\n metadatas?: Array<Array<Metadata | null>>;\n distances?: number[][];\n };\n const ids = raw.ids?.[0] ?? [];\n const documents = raw.documents?.[0] ?? [];\n const metadatas = raw.metadatas?.[0] ?? [];\n const distances = raw.distances?.[0] ?? [];\n\n const results = ids.flatMap((id, index) => {\n const score = distanceToCosineScore(distances[index] ?? 0);\n if (threshold !== undefined && score < threshold) {\n return [];\n }\n return [\n {\n id: logicalDocumentId(id),\n score,\n document: parseDocument(documents[index]),\n ...(metadatas[index] === null || metadatas[index] === undefined\n ? {}\n : { metadata: metadatas[index] }),\n } as VectorSearchResult<T, Metadata>,\n ];\n });\n\n const byId = new Map<string, VectorSearchResult<T, Metadata>>();\n for (const result of results) {\n if (!byId.has(result.id)) {\n byId.set(result.id, result);\n }\n }\n return [...byId.values()];\n}\n\nfunction distanceToCosineScore(distance: number): number {\n return 1 - distance;\n}\n\nfunction parseDocument<T>(document: string | null | undefined): T {\n if (document === null || document === undefined) {\n return \"\" as T;\n }\n try {\n return JSON.parse(document) as T;\n } catch {\n return document as T;\n }\n}\n\nfunction chromaRecords<T, Metadata extends VectorMetadata>(\n document: EmbeddedDocument<T, Metadata>,\n): Array<{\n id: string;\n document: string;\n metadata: VectorMetadata | undefined;\n embedding: number[];\n}> {\n if (document.embeddings.length === 0) {\n throw new Error(`Document ${document.id} has no embeddings`);\n }\n\n return document.embeddings.map((embedding, index) => ({\n id: document.embeddings.length === 1 ? document.id : `${document.id}#embedding:${index}`,\n document: serializeDocument(document.document),\n metadata: document.metadata,\n embedding: embedding.vector,\n }));\n}\n\nfunction logicalDocumentId(id: string): string {\n return id.replace(/#embedding:\\d+$/, \"\");\n}\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EAGA;AAAA,OAQK;AAqBA,IAAM,oBAAN,MAAM,mBAAuE;AAAA,EAC1E,YAA6B,YAAkC;AAAlC;AAAA,EAAmC;AAAA,EAAnC;AAAA,EAErC,aAAa,QACX,SACyC;AACzC,UAAM,SAAS,QAAQ,UAAW,MAAM,oBAAoB;AAC5D,UAAM,oBAAoB;AAAA,MACxB,MAAM,QAAQ;AAAA,MACd,UAAU,QAAQ,YAAY,EAAE,cAAc,SAAS;AAAA,MACvD,eAAe,QAAQ;AAAA,MACvB,mBAAmB;AAAA,IACrB;AACA,UAAM,aACJ,QAAQ,oBAAoB,QACxB,MAAM,OAAO,cAAc,iBAAiB,IAC5C,OAAO,0BAA0B,SAC/B,MAAM,OAAO,sBAAsB,iBAAiB,IACpD,MAAM,sBAAsB,QAAQ,iBAAiB;AAC7D,WAAO,IAAI,mBAA+B,UAAU;AAAA,EACtD;AAAA,EAEA,MAAM,gBAAgB,WAAgE;AACpF,UAAM,UAAU,UAAU,QAAQ,CAAC,aAAa,cAAc,QAAQ,CAAC;AACvE,UAAM,KAAK,WAAW,OAAO;AAAA,MAC3B,KAAK,QAAQ,IAAI,CAAC,WAAW,OAAO,EAAE;AAAA,MACtC,WAAW,QAAQ,IAAI,CAAC,WAAW,OAAO,QAAQ;AAAA,MAClD,YAAY,QAAQ,IAAI,CAAC,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AAAA,IACF;AAAA,EACF,CAAC;AAED,QAAM,OAAO,oBAAI,IAA6C;AAC9D,aAAW,UAAU,SAAS;AAC5B,QAAI,CAAC,KAAK,IAAI,OAAO,EAAE,GAAG;AACxB,WAAK,IAAI,OAAO,IAAI,MAAM;AAAA,IAC5B;AAAA,EACF;AACA,SAAO,CAAC,GAAG,KAAK,OAAO,CAAC;AAC1B;AAEA,SAAS,sBAAsB,UAA0B;AACvD,SAAO,IAAI;AACb;AAEA,SAAS,cAAiB,UAAwC;AAChE,MAAI,aAAa,QAAQ,aAAa,QAAW;AAC/C,WAAO;AAAA,EACT;AACA,MAAI;AACF,WAAO,KAAK,MAAM,QAAQ;AAAA,EAC5B,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,SAAS,cACP,UAMC;AACD,MAAI,SAAS,WAAW,WAAW,GAAG;AACpC,UAAM,IAAI,MAAM,YAAY,SAAS,EAAE,oBAAoB;AAAA,EAC7D;AAEA,SAAO,SAAS,WAAW,IAAI,CAAC,WAAW,WAAW;AAAA,IACpD,IAAI,SAAS,WAAW,WAAW,IAAI,SAAS,KAAK,GAAG,SAAS,EAAE,cAAc,KAAK;AAAA,IACtF,UAAU,kBAAkB,SAAS,QAAQ;AAAA,IAC7C,UAAU,SAAS;AAAA,IACnB,WAAW,UAAU;AAAA,EACvB,EAAE;AACJ;AAEA,SAAS,kBAAkB,IAAoB;AAC7C,SAAO,GAAG,QAAQ,mBAAmB,EAAE;AACzC;","names":[]}
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@anvia/chroma",
3
+ "version": "0.1.0",
4
+ "description": "ChromaDB vector store adapter for Anvia.",
5
+ "author": "anvia",
6
+ "maintainer": "Indra Zulfi",
7
+ "license": "MIT",
8
+ "files": [
9
+ "dist"
10
+ ],
11
+ "type": "module",
12
+ "main": "./dist/index.js",
13
+ "types": "./dist/index.d.ts",
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/index.d.ts",
17
+ "import": "./dist/index.js"
18
+ }
19
+ },
20
+ "dependencies": {
21
+ "chromadb": "^3.4.3",
22
+ "@anvia/core": "0.1.0"
23
+ },
24
+ "devDependencies": {
25
+ "@types/node": "^24.9.1",
26
+ "tsup": "^8.5.0",
27
+ "typescript": "^5.9.3",
28
+ "vitest": "^4.0.8"
29
+ },
30
+ "scripts": {
31
+ "build": "tsup src/index.ts --format esm --dts --sourcemap --clean",
32
+ "test": "vitest run",
33
+ "typecheck": "tsc --noEmit"
34
+ }
35
+ }