@mastra/chroma 0.1.6 → 0.1.7

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.
@@ -1,23 +1,23 @@
1
1
 
2
- > @mastra/chroma@0.1.6-alpha.4 build /home/runner/work/mastra/mastra/stores/chroma
2
+ > @mastra/chroma@0.1.7-alpha.0 build /home/runner/work/mastra/mastra/stores/chroma
3
3
  > tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake
4
4
 
5
5
  CLI Building entry: src/index.ts
6
6
  CLI Using tsconfig: tsconfig.json
7
7
  CLI tsup v8.3.6
8
8
  TSC Build start
9
- TSC ⚡️ Build success in 8888ms
9
+ TSC ⚡️ Build success in 7433ms
10
10
  DTS Build start
11
11
  CLI Target: es2022
12
12
  Analysis will use the bundled TypeScript version 5.7.3
13
13
  Writing package typings: /home/runner/work/mastra/mastra/stores/chroma/dist/_tsup-dts-rollup.d.ts
14
14
  Analysis will use the bundled TypeScript version 5.7.3
15
15
  Writing package typings: /home/runner/work/mastra/mastra/stores/chroma/dist/_tsup-dts-rollup.d.cts
16
- DTS ⚡️ Build success in 9024ms
16
+ DTS ⚡️ Build success in 8668ms
17
17
  CLI Cleaning output folder
18
18
  ESM Build start
19
19
  CJS Build start
20
- ESM dist/index.js 7.28 KB
21
- ESM ⚡️ Build success in 741ms
22
20
  CJS dist/index.cjs 7.31 KB
23
- CJS ⚡️ Build success in 740ms
21
+ CJS ⚡️ Build success in 703ms
22
+ ESM dist/index.js 7.28 KB
23
+ ESM ⚡️ Build success in 703ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @mastra/chroma
2
2
 
3
+ ## 0.1.7
4
+
5
+ ### Patch Changes
6
+
7
+ - 1da20e7: Update typechecks for positional args
8
+ - Updated dependencies [1da20e7]
9
+ - @mastra/core@0.4.4
10
+
11
+ ## 0.1.7-alpha.0
12
+
13
+ ### Patch Changes
14
+
15
+ - 1da20e7: Update typechecks for positional args
16
+ - Updated dependencies [1da20e7]
17
+ - @mastra/core@0.4.4-alpha.0
18
+
3
19
  ## 0.1.6
4
20
 
5
21
  ### Patch Changes
@@ -5,7 +5,9 @@ import { MastraVector } from '@mastra/core/vector';
5
5
  import type { OperatorSupport } from '@mastra/core/vector/filter';
6
6
  import type { ParamsToArgs } from '@mastra/core/vector';
7
7
  import type { QueryResult } from '@mastra/core/vector';
8
+ import type { QueryVectorArgs } from '@mastra/core/vector';
8
9
  import type { QueryVectorParams } from '@mastra/core/vector';
10
+ import type { UpsertVectorArgs } from '@mastra/core/vector';
9
11
  import type { UpsertVectorParams } from '@mastra/core/vector';
10
12
  import type { VectorFilter } from '@mastra/core/vector/filter';
11
13
 
@@ -21,10 +23,14 @@ export declare class ChromaFilterTranslator extends BaseFilterTranslator {
21
23
  private translateOperator;
22
24
  }
23
25
 
26
+ declare type ChromaQueryArgs = [...QueryVectorArgs, VectorFilter?];
27
+
24
28
  declare interface ChromaQueryVectorParams extends QueryVectorParams {
25
29
  documentFilter?: VectorFilter;
26
30
  }
27
31
 
32
+ declare type ChromaUpsertArgs = [...UpsertVectorArgs, string[]?];
33
+
28
34
  declare interface ChromaUpsertVectorParams extends UpsertVectorParams {
29
35
  documents?: string[];
30
36
  }
@@ -41,11 +47,11 @@ declare class ChromaVector extends MastraVector {
41
47
  });
42
48
  getCollection(indexName: string, throwIfNotExists?: boolean): Promise<any>;
43
49
  private validateVectorDimensions;
44
- upsert(...args: ParamsToArgs<ChromaUpsertVectorParams>): Promise<string[]>;
50
+ upsert(...args: ParamsToArgs<ChromaUpsertVectorParams> | ChromaUpsertArgs): Promise<string[]>;
45
51
  private HnswSpaceMap;
46
52
  createIndex(...args: ParamsToArgs<CreateIndexParams>): Promise<void>;
47
53
  transformFilter(filter?: VectorFilter): VectorFilter;
48
- query(...args: ParamsToArgs<ChromaQueryVectorParams>): Promise<QueryResult[]>;
54
+ query(...args: ParamsToArgs<ChromaQueryVectorParams> | ChromaQueryArgs): Promise<QueryResult[]>;
49
55
  listIndexes(): Promise<string[]>;
50
56
  describeIndex(indexName: string): Promise<IndexStats>;
51
57
  deleteIndex(indexName: string): Promise<void>;
@@ -5,7 +5,9 @@ import { MastraVector } from '@mastra/core/vector';
5
5
  import type { OperatorSupport } from '@mastra/core/vector/filter';
6
6
  import type { ParamsToArgs } from '@mastra/core/vector';
7
7
  import type { QueryResult } from '@mastra/core/vector';
8
+ import type { QueryVectorArgs } from '@mastra/core/vector';
8
9
  import type { QueryVectorParams } from '@mastra/core/vector';
10
+ import type { UpsertVectorArgs } from '@mastra/core/vector';
9
11
  import type { UpsertVectorParams } from '@mastra/core/vector';
10
12
  import type { VectorFilter } from '@mastra/core/vector/filter';
11
13
 
@@ -21,10 +23,14 @@ export declare class ChromaFilterTranslator extends BaseFilterTranslator {
21
23
  private translateOperator;
22
24
  }
23
25
 
26
+ declare type ChromaQueryArgs = [...QueryVectorArgs, VectorFilter?];
27
+
24
28
  declare interface ChromaQueryVectorParams extends QueryVectorParams {
25
29
  documentFilter?: VectorFilter;
26
30
  }
27
31
 
32
+ declare type ChromaUpsertArgs = [...UpsertVectorArgs, string[]?];
33
+
28
34
  declare interface ChromaUpsertVectorParams extends UpsertVectorParams {
29
35
  documents?: string[];
30
36
  }
@@ -41,11 +47,11 @@ declare class ChromaVector extends MastraVector {
41
47
  });
42
48
  getCollection(indexName: string, throwIfNotExists?: boolean): Promise<any>;
43
49
  private validateVectorDimensions;
44
- upsert(...args: ParamsToArgs<ChromaUpsertVectorParams>): Promise<string[]>;
50
+ upsert(...args: ParamsToArgs<ChromaUpsertVectorParams> | ChromaUpsertArgs): Promise<string[]>;
45
51
  private HnswSpaceMap;
46
52
  createIndex(...args: ParamsToArgs<CreateIndexParams>): Promise<void>;
47
53
  transformFilter(filter?: VectorFilter): VectorFilter;
48
- query(...args: ParamsToArgs<ChromaQueryVectorParams>): Promise<QueryResult[]>;
54
+ query(...args: ParamsToArgs<ChromaQueryVectorParams> | ChromaQueryArgs): Promise<QueryResult[]>;
49
55
  listIndexes(): Promise<string[]>;
50
56
  describeIndex(indexName: string): Promise<IndexStats>;
51
57
  deleteIndex(indexName: string): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/chroma",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Chroma vector store provider for Mastra",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -20,7 +20,7 @@
20
20
  },
21
21
  "dependencies": {
22
22
  "chromadb": "^1.9.4",
23
- "@mastra/core": "^0.4.3"
23
+ "@mastra/core": "^0.4.4"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@microsoft/api-extractor": "^7.49.2",
@@ -6,6 +6,8 @@ import type {
6
6
  UpsertVectorParams,
7
7
  QueryVectorParams,
8
8
  ParamsToArgs,
9
+ QueryVectorArgs,
10
+ UpsertVectorArgs,
9
11
  } from '@mastra/core/vector';
10
12
  import type { VectorFilter } from '@mastra/core/vector/filter';
11
13
  import { ChromaClient } from 'chromadb';
@@ -16,10 +18,14 @@ interface ChromaUpsertVectorParams extends UpsertVectorParams {
16
18
  documents?: string[];
17
19
  }
18
20
 
21
+ type ChromaUpsertArgs = [...UpsertVectorArgs, string[]?];
22
+
19
23
  interface ChromaQueryVectorParams extends QueryVectorParams {
20
24
  documentFilter?: VectorFilter;
21
25
  }
22
26
 
27
+ type ChromaQueryArgs = [...QueryVectorArgs, VectorFilter?];
28
+
23
29
  export class ChromaVector extends MastraVector {
24
30
  private client: ChromaClient;
25
31
  private collections: Map<string, any>;
@@ -65,8 +71,8 @@ export class ChromaVector extends MastraVector {
65
71
  }
66
72
  }
67
73
 
68
- async upsert(...args: ParamsToArgs<ChromaUpsertVectorParams>): Promise<string[]> {
69
- const params = this.normalizeArgs<ChromaUpsertVectorParams>('upsert', args, ['documents']);
74
+ async upsert(...args: ParamsToArgs<ChromaUpsertVectorParams> | ChromaUpsertArgs): Promise<string[]> {
75
+ const params = this.normalizeArgs<ChromaUpsertVectorParams, ChromaUpsertArgs>('upsert', args, ['documents']);
70
76
 
71
77
  const { indexName, vectors, metadata, ids, documents } = params;
72
78
 
@@ -127,8 +133,8 @@ export class ChromaVector extends MastraVector {
127
133
  const translator = new ChromaFilterTranslator();
128
134
  return translator.translate(filter);
129
135
  }
130
- async query(...args: ParamsToArgs<ChromaQueryVectorParams>): Promise<QueryResult[]> {
131
- const params = this.normalizeArgs<ChromaQueryVectorParams>('query', args, ['documentFilter']);
136
+ async query(...args: ParamsToArgs<ChromaQueryVectorParams> | ChromaQueryArgs): Promise<QueryResult[]> {
137
+ const params = this.normalizeArgs<ChromaQueryVectorParams, ChromaQueryArgs>('query', args, ['documentFilter']);
132
138
 
133
139
  const { indexName, queryVector, topK = 10, filter, includeVector = false, documentFilter } = params;
134
140