chromadb 1.7.2 → 1.7.3-beta2

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.
@@ -2,10 +2,10 @@
2
2
  // tslint:disable
3
3
  /**
4
4
  * FastAPI
5
- *
5
+ *
6
6
  *
7
7
  * OpenAPI spec version: 0.1.0
8
- *
8
+ *
9
9
  *
10
10
  * NOTE: This class is auto generated by OpenAPI Generator+.
11
11
  * https://github.com/karlvr/openapi-generator-plus
@@ -29,14 +29,14 @@ export class Configuration {
29
29
  apiKey?: string | ((name: string) => string | null);
30
30
  /**
31
31
  * parameter for basic security
32
- *
32
+ *
33
33
  * @type {string}
34
34
  * @memberof Configuration
35
35
  */
36
36
  username?: string;
37
37
  /**
38
38
  * parameter for basic security
39
- *
39
+ *
40
40
  * @type {string}
41
41
  * @memberof Configuration
42
42
  */
@@ -50,7 +50,7 @@ export class Configuration {
50
50
  authorization?: string | ((name: string, scopes?: string[]) => string | null);
51
51
  /**
52
52
  * override base path
53
- *
53
+ *
54
54
  * @type {string}
55
55
  * @memberof Configuration
56
56
  */
@@ -2,10 +2,10 @@
2
2
  // tslint:disable
3
3
  /**
4
4
  * FastAPI
5
- *
5
+ *
6
6
  *
7
7
  * OpenAPI spec version: 0.1.0
8
- *
8
+ *
9
9
  *
10
10
  * NOTE: This class is auto generated by OpenAPI Generator+.
11
11
  * https://github.com/karlvr/openapi-generator-plus
@@ -20,7 +20,6 @@ export namespace Api {
20
20
  embeddings?: Api.AddEmbedding.Embedding[];
21
21
  metadatas?: Api.AddEmbedding.Metadata[];
22
22
  documents?: string[];
23
- uris?: string[];
24
23
  ids: string[];
25
24
  }
26
25
 
@@ -31,10 +30,10 @@ export namespace Api {
31
30
  export namespace AddEmbedding {
32
31
  export interface Embedding {
33
32
  }
34
-
33
+
35
34
  export interface Metadata {
36
35
  }
37
-
36
+
38
37
  }
39
38
 
40
39
  export interface ADelete200Response {
@@ -46,15 +45,12 @@ export namespace Api {
46
45
  export interface Count200Response {
47
46
  }
48
47
 
49
- export interface CountCollections200Response {
50
- }
51
-
52
48
  export interface CreateCollection {
53
49
  name: string;
54
50
  metadata?: Api.CreateCollection.Metadata;
55
51
  'get_or_create'?: boolean;
56
52
  }
57
-
53
+
58
54
  /**
59
55
  * @export
60
56
  * @namespace CreateCollection
@@ -62,24 +58,10 @@ export namespace Api {
62
58
  export namespace CreateCollection {
63
59
  export interface Metadata {
64
60
  }
65
-
66
- }
67
-
68
- export interface CreateCollection200Response {
69
- }
70
61
 
71
- export interface CreateDatabase {
72
- name: string;
73
62
  }
74
63
 
75
- export interface CreateDatabase200Response {
76
- }
77
-
78
- export interface CreateTenant {
79
- name: string;
80
- }
81
-
82
- export interface CreateTenant200Response {
64
+ export interface CreateCollection200Response {
83
65
  }
84
66
 
85
67
  export interface DeleteCollection200Response {
@@ -90,7 +72,7 @@ export namespace Api {
90
72
  where?: Api.DeleteEmbedding.Where;
91
73
  'where_document'?: Api.DeleteEmbedding.WhereDocument;
92
74
  }
93
-
75
+
94
76
  /**
95
77
  * @export
96
78
  * @namespace DeleteEmbedding
@@ -98,16 +80,13 @@ export namespace Api {
98
80
  export namespace DeleteEmbedding {
99
81
  export interface Where {
100
82
  }
101
-
83
+
102
84
  export interface WhereDocument {
103
85
  }
104
-
105
- }
106
86
 
107
- export interface GetCollection200Response {
108
87
  }
109
88
 
110
- export interface GetDatabase200Response {
89
+ export interface GetCollection200Response {
111
90
  }
112
91
 
113
92
  export interface GetEmbedding {
@@ -125,9 +104,9 @@ export namespace Api {
125
104
  * @memberof GetEmbedding
126
105
  */
127
106
  offset?: number;
128
- include?: (Api.GetEmbedding.Include.EnumValueEnum | Api.GetEmbedding.Include.EnumValueEnum2 | Api.GetEmbedding.Include.EnumValueEnum3 | Api.GetEmbedding.Include.EnumValueEnum4 | Api.GetEmbedding.Include.EnumValueEnum5 | Api.GetEmbedding.Include.EnumValueEnum6)[];
107
+ include?: (Api.GetEmbedding.Include.EnumValueEnum | Api.GetEmbedding.Include.EnumValueEnum2 | Api.GetEmbedding.Include.EnumValueEnum3 | Api.GetEmbedding.Include.EnumValueEnum4)[];
129
108
  }
130
-
109
+
131
110
  /**
132
111
  * @export
133
112
  * @namespace GetEmbedding
@@ -135,12 +114,12 @@ export namespace Api {
135
114
  export namespace GetEmbedding {
136
115
  export interface Where {
137
116
  }
138
-
117
+
139
118
  export interface WhereDocument {
140
119
  }
141
-
142
- export type Include = Api.GetEmbedding.Include.EnumValueEnum | Api.GetEmbedding.Include.EnumValueEnum2 | Api.GetEmbedding.Include.EnumValueEnum3 | Api.GetEmbedding.Include.EnumValueEnum4 | Api.GetEmbedding.Include.EnumValueEnum5 | Api.GetEmbedding.Include.EnumValueEnum6;
143
-
120
+
121
+ export type Include = Api.GetEmbedding.Include.EnumValueEnum | Api.GetEmbedding.Include.EnumValueEnum2 | Api.GetEmbedding.Include.EnumValueEnum3 | Api.GetEmbedding.Include.EnumValueEnum4;
122
+
144
123
  /**
145
124
  * @export
146
125
  * @namespace Include
@@ -149,35 +128,24 @@ export namespace Api {
149
128
  export enum EnumValueEnum {
150
129
  Documents = 'documents'
151
130
  }
152
-
131
+
153
132
  export enum EnumValueEnum2 {
154
133
  Embeddings = 'embeddings'
155
134
  }
156
-
135
+
157
136
  export enum EnumValueEnum3 {
158
137
  Metadatas = 'metadatas'
159
138
  }
160
-
139
+
161
140
  export enum EnumValueEnum4 {
162
141
  Distances = 'distances'
163
142
  }
164
-
165
- export enum EnumValueEnum5 {
166
- Uris = 'uris'
167
- }
168
-
169
- export enum EnumValueEnum6 {
170
- Data = 'data'
171
- }
172
-
143
+
173
144
  }
174
-
175
- }
176
145
 
177
- export interface GetNearestNeighbors200Response {
178
146
  }
179
147
 
180
- export interface GetTenant200Response {
148
+ export interface GetNearestNeighbors200Response {
181
149
  }
182
150
 
183
151
  export interface HTTPValidationError {
@@ -187,9 +155,6 @@ export namespace Api {
187
155
  export interface ListCollections200Response {
188
156
  }
189
157
 
190
- export interface PreFlightChecks200Response {
191
- }
192
-
193
158
  export interface QueryEmbedding {
194
159
  where?: Api.QueryEmbedding.Where;
195
160
  'where_document'?: Api.QueryEmbedding.WhereDocument;
@@ -199,9 +164,9 @@ export namespace Api {
199
164
  * @memberof QueryEmbedding
200
165
  */
201
166
  'n_results'?: number;
202
- include?: (Api.QueryEmbedding.Include.EnumValueEnum | Api.QueryEmbedding.Include.EnumValueEnum2 | Api.QueryEmbedding.Include.EnumValueEnum3 | Api.QueryEmbedding.Include.EnumValueEnum4 | Api.QueryEmbedding.Include.EnumValueEnum5 | Api.QueryEmbedding.Include.EnumValueEnum6)[];
167
+ include?: (Api.QueryEmbedding.Include.EnumValueEnum | Api.QueryEmbedding.Include.EnumValueEnum2 | Api.QueryEmbedding.Include.EnumValueEnum3 | Api.QueryEmbedding.Include.EnumValueEnum4)[];
203
168
  }
204
-
169
+
205
170
  /**
206
171
  * @export
207
172
  * @namespace QueryEmbedding
@@ -209,15 +174,15 @@ export namespace Api {
209
174
  export namespace QueryEmbedding {
210
175
  export interface Where {
211
176
  }
212
-
177
+
213
178
  export interface WhereDocument {
214
179
  }
215
-
180
+
216
181
  export interface QueryEmbedding2 {
217
182
  }
218
-
219
- export type Include = Api.QueryEmbedding.Include.EnumValueEnum | Api.QueryEmbedding.Include.EnumValueEnum2 | Api.QueryEmbedding.Include.EnumValueEnum3 | Api.QueryEmbedding.Include.EnumValueEnum4 | Api.QueryEmbedding.Include.EnumValueEnum5 | Api.QueryEmbedding.Include.EnumValueEnum6;
220
-
183
+
184
+ export type Include = Api.QueryEmbedding.Include.EnumValueEnum | Api.QueryEmbedding.Include.EnumValueEnum2 | Api.QueryEmbedding.Include.EnumValueEnum3 | Api.QueryEmbedding.Include.EnumValueEnum4;
185
+
221
186
  /**
222
187
  * @export
223
188
  * @namespace Include
@@ -226,29 +191,21 @@ export namespace Api {
226
191
  export enum EnumValueEnum {
227
192
  Documents = 'documents'
228
193
  }
229
-
194
+
230
195
  export enum EnumValueEnum2 {
231
196
  Embeddings = 'embeddings'
232
197
  }
233
-
198
+
234
199
  export enum EnumValueEnum3 {
235
200
  Metadatas = 'metadatas'
236
201
  }
237
-
202
+
238
203
  export enum EnumValueEnum4 {
239
204
  Distances = 'distances'
240
205
  }
241
-
242
- export enum EnumValueEnum5 {
243
- Uris = 'uris'
244
- }
245
-
246
- export enum EnumValueEnum6 {
247
- Data = 'data'
248
- }
249
-
206
+
250
207
  }
251
-
208
+
252
209
  }
253
210
 
254
211
  export interface Update200Response {
@@ -258,7 +215,7 @@ export namespace Api {
258
215
  'new_name'?: string;
259
216
  'new_metadata'?: Api.UpdateCollection.NewMetadata;
260
217
  }
261
-
218
+
262
219
  /**
263
220
  * @export
264
221
  * @namespace UpdateCollection
@@ -266,7 +223,7 @@ export namespace Api {
266
223
  export namespace UpdateCollection {
267
224
  export interface NewMetadata {
268
225
  }
269
-
226
+
270
227
  }
271
228
 
272
229
  export interface UpdateCollection200Response {
@@ -276,10 +233,9 @@ export namespace Api {
276
233
  embeddings?: Api.UpdateEmbedding.Embedding[];
277
234
  metadatas?: Api.UpdateEmbedding.Metadata[];
278
235
  documents?: string[];
279
- uris?: string[];
280
236
  ids: string[];
281
237
  }
282
-
238
+
283
239
  /**
284
240
  * @export
285
241
  * @namespace UpdateEmbedding
@@ -287,10 +243,10 @@ export namespace Api {
287
243
  export namespace UpdateEmbedding {
288
244
  export interface Embedding {
289
245
  }
290
-
246
+
291
247
  export interface Metadata {
292
248
  }
293
-
249
+
294
250
  }
295
251
 
296
252
  export interface Upsert200Response {
@@ -3,10 +3,10 @@ import 'isomorphic-fetch';
3
3
  // tslint:disable
4
4
  /**
5
5
  * FastAPI
6
- *
6
+ *
7
7
  *
8
8
  * OpenAPI spec version: 0.1.0
9
- *
9
+ *
10
10
  *
11
11
  * NOTE: This class is auto generated by OpenAPI Generator+.
12
12
  * https://github.com/karlvr/openapi-generator-plus
@@ -37,7 +37,7 @@ export const COLLECTION_FORMATS = {
37
37
  export type FetchAPI = typeof defaultFetch;
38
38
 
39
39
  /**
40
- *
40
+ *
41
41
  * @export
42
42
  * @interface FetchArgs
43
43
  */
@@ -47,7 +47,7 @@ export interface FetchArgs {
47
47
  }
48
48
 
49
49
  /**
50
- *
50
+ *
51
51
  * @export
52
52
  * @class BaseAPI
53
53
  */
@@ -63,7 +63,7 @@ export class BaseAPI {
63
63
  };
64
64
 
65
65
  /**
66
- *
66
+ *
67
67
  * @export
68
68
  * @class RequiredError
69
69
  * @extends {Error}
package/src/index.ts CHANGED
@@ -1,41 +1,8 @@
1
1
  export { ChromaClient } from './ChromaClient';
2
- export { AdminClient } from './AdminClient';
3
- export { CloudClient } from './CloudClient';
4
2
  export { Collection } from './Collection';
5
3
  export { IEmbeddingFunction } from './embeddings/IEmbeddingFunction';
6
4
  export { OpenAIEmbeddingFunction } from './embeddings/OpenAIEmbeddingFunction';
7
5
  export { CohereEmbeddingFunction } from './embeddings/CohereEmbeddingFunction';
8
- export { GoogleGenerativeAiEmbeddingFunction } from './embeddings/GoogleGeminiEmbeddingFunction';
9
- export {
10
- IncludeEnum,
11
- GetParams,
12
- CollectionType,
13
- CollectionMetadata,
14
- Embedding,
15
- Embeddings,
16
- Metadata,
17
- Metadatas,
18
- Document,
19
- Documents,
20
- ID,
21
- IDs,
22
- Where,
23
- WhereDocument,
24
- GetResponse,
25
- QueryResponse,
26
- ListCollectionsParams,
27
- ChromaClientParams,
28
- CreateCollectionParams,
29
- GetOrCreateCollectionParams,
30
- GetCollectionParams,
31
- DeleteCollectionParams,
32
- AddParams,
33
- UpsertParams,
34
- UpdateParams,
35
- ModifyCollectionParams,
36
- QueryParams,
37
- PeekParams,
38
- DeleteParams
39
- } from './types';
40
- export { HuggingFaceEmbeddingServerFunction } from './embeddings/HuggingFaceEmbeddingServerFunction';
41
- export { JinaEmbeddingFunction } from './embeddings/JinaEmbeddingFunction';
6
+ export { TransformersEmbeddingFunction } from './embeddings/TransformersEmbeddingFunction';
7
+ export { DefaultEmbeddingFunction } from './embeddings/DefaultEmbeddingFunction';
8
+ export { IncludeEnum } from './types';
package/src/types.ts CHANGED
@@ -1,6 +1,3 @@
1
- import { AuthOptions } from "./auth";
2
- import { IEmbeddingFunction } from "./embeddings/IEmbeddingFunction";
3
-
4
1
  export enum IncludeEnum {
5
2
  Documents = 'documents',
6
3
  Embeddings = 'embeddings',
@@ -83,75 +80,3 @@ export type CollectionMetadata = Record<string, unknown>;
83
80
  export type ConfigOptions = {
84
81
  options?: RequestInit;
85
82
  };
86
-
87
- export type GetParams = {
88
- ids?: ID | IDs,
89
- where?: Where,
90
- limit?: PositiveInteger,
91
- offset?: PositiveInteger,
92
- include?: IncludeEnum[],
93
- whereDocument?: WhereDocument
94
- }
95
-
96
- export type ListCollectionsParams = {
97
- limit?: PositiveInteger,
98
- offset?: PositiveInteger,
99
- }
100
-
101
- export type ChromaClientParams = {
102
- path?: string,
103
- fetchOptions?: RequestInit,
104
- auth?: AuthOptions,
105
- tenant?: string,
106
- database?: string,
107
- }
108
-
109
- export type CreateCollectionParams = {
110
- name: string,
111
- metadata?: CollectionMetadata,
112
- embeddingFunction?: IEmbeddingFunction
113
- }
114
-
115
- export type GetOrCreateCollectionParams = CreateCollectionParams
116
-
117
- export type GetCollectionParams = {
118
- name: string;
119
- embeddingFunction?: IEmbeddingFunction
120
- }
121
-
122
- export type DeleteCollectionParams = {
123
- name: string
124
- }
125
-
126
- export type AddParams = {
127
- ids: ID | IDs,
128
- embeddings?: Embedding | Embeddings,
129
- metadatas?: Metadata | Metadatas,
130
- documents?: Document | Documents,
131
- }
132
-
133
- export type UpsertParams = AddParams;
134
- export type UpdateParams = AddParams;
135
-
136
- export type ModifyCollectionParams = {
137
- name?: string,
138
- metadata?: CollectionMetadata
139
- }
140
-
141
- export type QueryParams = {
142
- queryEmbeddings?: Embedding | Embeddings,
143
- nResults?: PositiveInteger,
144
- where?: Where,
145
- queryTexts?: string | string[],
146
- whereDocument?: WhereDocument, // {"$contains":"search_string"}
147
- include?: IncludeEnum[] // ["metadata", "document"]
148
- }
149
-
150
- export type PeekParams = { limit?: PositiveInteger }
151
-
152
- export type DeleteParams = {
153
- ids?: ID | IDs,
154
- where?: Where,
155
- whereDocument?: WhereDocument
156
- }
157
-
package/src/utils.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { Api } from "./generated";
2
2
  import Count200Response = Api.Count200Response;
3
- import { AdminClient } from "./AdminClient";
4
3
 
5
4
  // a function to convert a non-Array object to an Array
6
5
  export function toArray<T>(obj: T | Array<T>): Array<T> {
@@ -39,12 +38,14 @@ export function repack(value: unknown): any {
39
38
  export async function handleError(error: unknown) {
40
39
  if (error instanceof Response) {
41
40
  try {
42
- const res = await (error as Response).json();
41
+ // @ts-ignore
42
+ const res = await error.json();
43
43
  if ("error" in res) {
44
44
  return { error: res.error };
45
45
  }
46
46
  } catch (e: unknown) {
47
47
  return {
48
+ //@ts-ignore
48
49
  error:
49
50
  e && typeof e === "object" && "message" in e
50
51
  ? e.message
@@ -82,18 +83,3 @@ export async function handleSuccess(
82
83
  export async function importOptionalModule(moduleName: string) {
83
84
  return Function(`return import("${moduleName}")`)();
84
85
  }
85
-
86
-
87
- export async function validateTenantDatabase(adminClient: AdminClient, tenant: string, database: string): Promise<void> {
88
- try {
89
- await adminClient.getTenant({name: tenant});
90
- } catch (error) {
91
- throw new Error(`Error: ${error}, Could not connect to tenant ${tenant}. Are you sure it exists?`);
92
- }
93
-
94
- try {
95
- await adminClient.getDatabase({name: database, tenantName: tenant});
96
- } catch (error) {
97
- throw new Error(`Error: ${error}, Could not connect to database ${database} for tenant ${tenant}. Are you sure it exists?`);
98
- }
99
- }