@mastra/chroma 1.1.3-alpha.0 → 1.1.3-alpha.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/README.md +15 -84
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -8,62 +8,21 @@ Vector store implementation for Chroma using the official `chromadb` client with
|
|
|
8
8
|
npm install @mastra/chroma
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
##
|
|
12
|
-
|
|
13
|
-
### Local or Self-Deployments
|
|
14
|
-
|
|
15
|
-
To run a Chroma server, use the [Chroma CLI](https://docs.trychroma.com/docs/cli/db). It is available to you when you install this package.
|
|
16
|
-
|
|
17
|
-
```shell
|
|
18
|
-
chroma run
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
You will now have a Chroma server running on `localhost:8000`.
|
|
22
|
-
|
|
23
|
-
```typescript
|
|
24
|
-
import { ChromaVector } from '@mastra/chroma';
|
|
25
|
-
|
|
26
|
-
const vectorStore = new ChromaVector();
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
If you run a Chroma server locally with a different configuration, or [deploy](https://docs.trychroma.com/guides/deploy/client-server-mode) a Chroma server yourself, you can configure your `ChromaVector` instantiation with specific connection details:
|
|
30
|
-
|
|
31
|
-
```typescript
|
|
32
|
-
import { ChromaVector } from '@mastra/chroma';
|
|
33
|
-
|
|
34
|
-
const vectorStore = new ChromaVector({
|
|
35
|
-
host: 'your-host-address',
|
|
36
|
-
port: 8000,
|
|
37
|
-
ssl: false,
|
|
38
|
-
headers: {}, // any HTTP headers to send,
|
|
39
|
-
});
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
### Chroma Cloud
|
|
43
|
-
|
|
44
|
-
Provide your Chroma Cloud API key, tenant, and database.
|
|
45
|
-
|
|
46
|
-
You can use the [Chroma CLI](https://docs.trychroma.com/docs/cli/db) to set these as environment variables: `chroma db connect [DB-NAME] --env-file`.
|
|
11
|
+
## Usage
|
|
47
12
|
|
|
48
13
|
```typescript
|
|
49
14
|
import { ChromaVector } from '@mastra/chroma';
|
|
50
15
|
|
|
51
|
-
const vectorStore = new ChromaVector({
|
|
52
|
-
apiKey: process.env.CHROMA_API_KEY,
|
|
53
|
-
tenant: process.env.CHROMA_TENANT,
|
|
54
|
-
database: process.env.CHROMA_DATABASE,
|
|
55
|
-
});
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
## Usage
|
|
59
|
-
|
|
60
|
-
```typescript
|
|
16
|
+
const vectorStore = new ChromaVector({ id: 'chroma-vectors' });
|
|
61
17
|
|
|
62
18
|
// Create a new collection
|
|
63
|
-
await vectorStore.createIndex({ indexName: 'myCollection', dimension:
|
|
19
|
+
await vectorStore.createIndex({ indexName: 'myCollection', dimension: 3, metric: 'cosine' });
|
|
64
20
|
|
|
65
21
|
// Add vectors with documents
|
|
66
|
-
const vectors = [
|
|
22
|
+
const vectors = [
|
|
23
|
+
[0.1, 0.2, 0.3],
|
|
24
|
+
[0.3, 0.4, 0.5],
|
|
25
|
+
];
|
|
67
26
|
const metadata = [{ text: 'doc1' }, { text: 'doc2' }];
|
|
68
27
|
const documents = ['full text 1', 'full text 2'];
|
|
69
28
|
const ids = await vectorStore.upsert({
|
|
@@ -76,50 +35,22 @@ const ids = await vectorStore.upsert({
|
|
|
76
35
|
// Query vectors with document filtering
|
|
77
36
|
const results = await vectorStore.query({
|
|
78
37
|
indexName: 'myCollection',
|
|
79
|
-
queryVector: [0.1, 0.2,
|
|
38
|
+
queryVector: [0.1, 0.2, 0.3],
|
|
80
39
|
topK: 10, // topK
|
|
81
40
|
filter: { text: { $eq: 'doc1' } }, // metadata filter
|
|
82
41
|
includeVector: false, // includeVector
|
|
83
|
-
documentFilter: { $contains: 'specific text' } // document content filter
|
|
42
|
+
documentFilter: { $contains: 'specific text' }, // document content filter
|
|
84
43
|
});
|
|
85
44
|
```
|
|
86
45
|
|
|
87
|
-
##
|
|
88
|
-
|
|
89
|
-
- Vector similarity search with cosine, euclidean, and dot product metrics
|
|
90
|
-
- Document storage and retrieval
|
|
91
|
-
- Document content filtering
|
|
92
|
-
- Strict vector dimension validation
|
|
93
|
-
- Collection-based organization
|
|
94
|
-
- Metadata filtering support
|
|
95
|
-
- Optional vector inclusion in query results
|
|
96
|
-
- Automatic UUID generation for vectors
|
|
97
|
-
- Built-in collection caching for performance
|
|
98
|
-
- Built on top of chromadb client
|
|
99
|
-
|
|
100
|
-
## Methods
|
|
101
|
-
|
|
102
|
-
- `createIndex({ indexName, dimension, metric? })`: Create a new collection
|
|
103
|
-
- `upsert({ indexName, vectors, metadata?, ids?, documents? })`: Add or update vectors with optional document storage
|
|
104
|
-
- `query({ indexName, queryVector, topK?, filter?, includeVector?, documentFilter? })`: Search for similar vectors with optional document filtering
|
|
105
|
-
- `updateVector({ indexName, id?, filter?, update })`: Update a single vector by ID or metadata filter
|
|
106
|
-
- `deleteVector({ indexName, id })`: Delete a single vector by ID
|
|
107
|
-
- `deleteVectors({ indexName, ids?, filter? })`: Delete multiple vectors by IDs or metadata filter
|
|
108
|
-
- `listIndexes()`: List all collections
|
|
109
|
-
- `describeIndex(indexName)`: Get collection statistics
|
|
110
|
-
- `deleteIndex(indexName)`: Delete a collection
|
|
46
|
+
## Documentation
|
|
111
47
|
|
|
112
|
-
|
|
48
|
+
- [@mastra/chroma documentation](https://mastra.ai/reference/vectors/chroma)
|
|
113
49
|
|
|
114
|
-
|
|
50
|
+
## Changelog
|
|
115
51
|
|
|
116
|
-
-
|
|
117
|
-
- `score`: Distance/similarity score
|
|
118
|
-
- `metadata`: Associated metadata
|
|
119
|
-
- `document`: Original document text (if stored)
|
|
120
|
-
- `vector`: Original vector (if includeVector is true)
|
|
52
|
+
See the [package changelog](https://github.com/mastra-ai/mastra/blob/main/stores/chroma/CHANGELOG.md) for version history and release notes.
|
|
121
53
|
|
|
122
|
-
##
|
|
54
|
+
## Support
|
|
123
55
|
|
|
124
|
-
|
|
125
|
-
- [Chroma API Reference](https://docs.trychroma.com/api/client)
|
|
56
|
+
We have an [open community Discord](https://discord.gg/mastra-ai). Come and say hello and let us know if you have any questions or need any help getting things running.
|
package/dist/docs/SKILL.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/chroma",
|
|
3
|
-
"version": "1.1.3-alpha.
|
|
3
|
+
"version": "1.1.3-alpha.1",
|
|
4
4
|
"description": "Chroma vector store provider for Mastra",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"tsx": "^4.23.1",
|
|
32
32
|
"typescript": "^7.0.2",
|
|
33
33
|
"vitest": "4.1.10",
|
|
34
|
-
"@internal/storage-test-utils": "0.0.125",
|
|
35
34
|
"@internal/lint": "0.0.129",
|
|
35
|
+
"@internal/storage-test-utils": "0.0.125",
|
|
36
36
|
"@internal/types-builder": "0.0.104",
|
|
37
|
-
"@mastra/core": "1.64.0-alpha.
|
|
37
|
+
"@mastra/core": "1.64.0-alpha.7"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"@mastra/core": ">=1.0.0-0 <2.0.0-0"
|