Comparing version 1.5.2 to 1.5.3
@@ -23,4 +23,5 @@ import { IEmbeddingFunction } from './embeddings/IEmbeddingFunction'; | ||
*/ | ||
constructor({ path }?: { | ||
constructor({ path, fetchOptions }?: { | ||
path?: string; | ||
fetchOptions?: RequestInit; | ||
}); | ||
@@ -27,0 +28,0 @@ /** |
@@ -21,3 +21,3 @@ "use strict"; | ||
*/ | ||
constructor({ path } = {}) { | ||
constructor({ path, fetchOptions } = {}) { | ||
if (path === undefined) | ||
@@ -29,2 +29,3 @@ path = "http://localhost:8000"; | ||
this.api = new generated_1.ApiApi(apiConfig); | ||
this.api.options = fetchOptions !== null && fetchOptions !== void 0 ? fetchOptions : {}; | ||
} | ||
@@ -43,3 +44,3 @@ /** | ||
async reset() { | ||
return await this.api.reset(); | ||
return await this.api.reset(this.api.options); | ||
} | ||
@@ -56,3 +57,3 @@ /** | ||
async version() { | ||
const response = await this.api.version(); | ||
const response = await this.api.version(this.api.options); | ||
return await (0, utils_1.handleSuccess)(response); | ||
@@ -70,3 +71,3 @@ } | ||
async heartbeat() { | ||
const response = await this.api.heartbeat(); | ||
const response = await this.api.heartbeat(this.api.options); | ||
let ret = await (0, utils_1.handleSuccess)(response); | ||
@@ -107,3 +108,3 @@ return ret["nanosecond heartbeat"]; | ||
metadata, | ||
}) | ||
}, this.api.options) | ||
.then(utils_1.handleSuccess) | ||
@@ -143,3 +144,3 @@ .catch(utils_1.handleError); | ||
'get_or_create': true | ||
}) | ||
}, this.api.options) | ||
.then(utils_1.handleSuccess) | ||
@@ -164,3 +165,3 @@ .catch(utils_1.handleError); | ||
async listCollections() { | ||
const response = await this.api.listCollections(); | ||
const response = await this.api.listCollections(this.api.options); | ||
return (0, utils_1.handleSuccess)(response); | ||
@@ -185,3 +186,3 @@ } | ||
const response = await this.api | ||
.getCollection(name) | ||
.getCollection(name, this.api.options) | ||
.then(utils_1.handleSuccess) | ||
@@ -210,3 +211,3 @@ .catch(utils_1.handleError); | ||
return await this.api | ||
.deleteCollection(name) | ||
.deleteCollection(name, this.api.options) | ||
.then(utils_1.handleSuccess) | ||
@@ -213,0 +214,0 @@ .catch(utils_1.handleError); |
@@ -116,3 +116,3 @@ "use strict"; | ||
metadatas: metadatasArray, | ||
}) | ||
}, this.api.options) | ||
.then(utils_1.handleSuccess) | ||
@@ -150,3 +150,3 @@ .catch(utils_1.handleError); | ||
metadatas: metadatasArray, | ||
}) | ||
}, this.api.options) | ||
.then(utils_1.handleSuccess) | ||
@@ -166,3 +166,3 @@ .catch(utils_1.handleError); | ||
async count() { | ||
const response = await this.api.count(this.id); | ||
const response = await this.api.count(this.id, this.api.options); | ||
return (0, utils_1.handleSuccess)(response); | ||
@@ -190,3 +190,3 @@ } | ||
new_metadata: metadata, | ||
}) | ||
}, this.api.options) | ||
.then(utils_1.handleSuccess) | ||
@@ -233,3 +233,3 @@ .catch(utils_1.handleError); | ||
where_document: whereDocument, | ||
}) | ||
}, this.api.options) | ||
.then(utils_1.handleSuccess) | ||
@@ -283,3 +283,3 @@ .catch(utils_1.handleError); | ||
metadatas: metadatas | ||
}) | ||
}, this.api.options) | ||
.then(utils_1.handleSuccess) | ||
@@ -347,3 +347,3 @@ .catch(utils_1.handleError); | ||
include: include, | ||
}) | ||
}, this.api.options) | ||
.then(utils_1.handleSuccess) | ||
@@ -371,3 +371,3 @@ .catch(utils_1.handleError); | ||
limit: limit, | ||
}); | ||
}, this.api.options); | ||
return (0, utils_1.handleSuccess)(response); | ||
@@ -398,3 +398,3 @@ } | ||
return await this.api | ||
.aDelete(this.id, { ids: idsArray, where: where, where_document: whereDocument }) | ||
.aDelete(this.id, { ids: idsArray, where: where, where_document: whereDocument }, this.api.options) | ||
.then(utils_1.handleSuccess) | ||
@@ -401,0 +401,0 @@ .catch(utils_1.handleError); |
@@ -10,2 +10,3 @@ "use strict"; | ||
CohereAiApi = require("cohere-ai"); | ||
CohereAiApi.init(cohere_api_key); | ||
} | ||
@@ -12,0 +13,0 @@ catch (_a) { |
@@ -47,3 +47,3 @@ "use strict"; | ||
})(QueryEmbedding = Api.QueryEmbedding || (Api.QueryEmbedding = {})); | ||
})(Api = exports.Api || (exports.Api = {})); | ||
})(Api || (exports.Api = Api = {})); | ||
//# sourceMappingURL=models.js.map |
@@ -6,2 +6,4 @@ export { ChromaClient } from './ChromaClient'; | ||
export { CohereEmbeddingFunction } from './embeddings/CohereEmbeddingFunction'; | ||
export { WebAIEmbeddingFunction } from './embeddings/WebAIEmbeddingFunction'; | ||
export { TransformersEmbeddingFunction } from './embeddings/TransformersEmbeddingFunction'; | ||
//# sourceMappingURL=index.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.CohereEmbeddingFunction = exports.OpenAIEmbeddingFunction = exports.Collection = exports.ChromaClient = void 0; | ||
exports.TransformersEmbeddingFunction = exports.WebAIEmbeddingFunction = exports.CohereEmbeddingFunction = exports.OpenAIEmbeddingFunction = exports.Collection = exports.ChromaClient = void 0; | ||
var ChromaClient_1 = require("./ChromaClient"); | ||
@@ -12,2 +12,6 @@ Object.defineProperty(exports, "ChromaClient", { enumerable: true, get: function () { return ChromaClient_1.ChromaClient; } }); | ||
Object.defineProperty(exports, "CohereEmbeddingFunction", { enumerable: true, get: function () { return CohereEmbeddingFunction_1.CohereEmbeddingFunction; } }); | ||
var WebAIEmbeddingFunction_1 = require("./embeddings/WebAIEmbeddingFunction"); | ||
Object.defineProperty(exports, "WebAIEmbeddingFunction", { enumerable: true, get: function () { return WebAIEmbeddingFunction_1.WebAIEmbeddingFunction; } }); | ||
var TransformersEmbeddingFunction_1 = require("./embeddings/TransformersEmbeddingFunction"); | ||
Object.defineProperty(exports, "TransformersEmbeddingFunction", { enumerable: true, get: function () { return TransformersEmbeddingFunction_1.TransformersEmbeddingFunction; } }); | ||
//# sourceMappingURL=index.js.map |
@@ -30,3 +30,3 @@ export declare enum IncludeEnum { | ||
}; | ||
export type Where = BaseWhere & LogicalWhere; | ||
export type Where = BaseWhere | LogicalWhere; | ||
type WhereDocumentOperator = "$contains" | LogicalOperator; | ||
@@ -59,3 +59,6 @@ export type WhereDocument = { | ||
export type CollectionMetadata = Record<string, unknown>; | ||
export type ConfigOptions = { | ||
options?: RequestInit; | ||
}; | ||
export {}; | ||
//# sourceMappingURL=types.d.ts.map |
@@ -10,3 +10,3 @@ "use strict"; | ||
IncludeEnum["Distances"] = "distances"; | ||
})(IncludeEnum = exports.IncludeEnum || (exports.IncludeEnum = {})); | ||
})(IncludeEnum || (exports.IncludeEnum = IncludeEnum = {})); | ||
//# sourceMappingURL=types.js.map |
@@ -23,4 +23,5 @@ import { IEmbeddingFunction } from './embeddings/IEmbeddingFunction'; | ||
*/ | ||
constructor({ path }?: { | ||
constructor({ path, fetchOptions }?: { | ||
path?: string; | ||
fetchOptions?: RequestInit; | ||
}); | ||
@@ -27,0 +28,0 @@ /** |
@@ -18,3 +18,3 @@ import { Configuration, ApiApi as DefaultApi } from "./generated"; | ||
*/ | ||
constructor({ path } = {}) { | ||
constructor({ path, fetchOptions } = {}) { | ||
if (path === undefined) | ||
@@ -26,2 +26,3 @@ path = "http://localhost:8000"; | ||
this.api = new DefaultApi(apiConfig); | ||
this.api.options = fetchOptions !== null && fetchOptions !== void 0 ? fetchOptions : {}; | ||
} | ||
@@ -40,3 +41,3 @@ /** | ||
async reset() { | ||
return await this.api.reset(); | ||
return await this.api.reset(this.api.options); | ||
} | ||
@@ -53,3 +54,3 @@ /** | ||
async version() { | ||
const response = await this.api.version(); | ||
const response = await this.api.version(this.api.options); | ||
return await handleSuccess(response); | ||
@@ -67,3 +68,3 @@ } | ||
async heartbeat() { | ||
const response = await this.api.heartbeat(); | ||
const response = await this.api.heartbeat(this.api.options); | ||
let ret = await handleSuccess(response); | ||
@@ -104,3 +105,3 @@ return ret["nanosecond heartbeat"]; | ||
metadata, | ||
}) | ||
}, this.api.options) | ||
.then(handleSuccess) | ||
@@ -140,3 +141,3 @@ .catch(handleError); | ||
'get_or_create': true | ||
}) | ||
}, this.api.options) | ||
.then(handleSuccess) | ||
@@ -161,3 +162,3 @@ .catch(handleError); | ||
async listCollections() { | ||
const response = await this.api.listCollections(); | ||
const response = await this.api.listCollections(this.api.options); | ||
return handleSuccess(response); | ||
@@ -182,3 +183,3 @@ } | ||
const response = await this.api | ||
.getCollection(name) | ||
.getCollection(name, this.api.options) | ||
.then(handleSuccess) | ||
@@ -207,3 +208,3 @@ .catch(handleError); | ||
return await this.api | ||
.deleteCollection(name) | ||
.deleteCollection(name, this.api.options) | ||
.then(handleSuccess) | ||
@@ -210,0 +211,0 @@ .catch(handleError); |
@@ -113,3 +113,3 @@ import { handleError, handleSuccess } from "./utils"; | ||
metadatas: metadatasArray, | ||
}) | ||
}, this.api.options) | ||
.then(handleSuccess) | ||
@@ -147,3 +147,3 @@ .catch(handleError); | ||
metadatas: metadatasArray, | ||
}) | ||
}, this.api.options) | ||
.then(handleSuccess) | ||
@@ -163,3 +163,3 @@ .catch(handleError); | ||
async count() { | ||
const response = await this.api.count(this.id); | ||
const response = await this.api.count(this.id, this.api.options); | ||
return handleSuccess(response); | ||
@@ -187,3 +187,3 @@ } | ||
new_metadata: metadata, | ||
}) | ||
}, this.api.options) | ||
.then(handleSuccess) | ||
@@ -230,3 +230,3 @@ .catch(handleError); | ||
where_document: whereDocument, | ||
}) | ||
}, this.api.options) | ||
.then(handleSuccess) | ||
@@ -280,3 +280,3 @@ .catch(handleError); | ||
metadatas: metadatas | ||
}) | ||
}, this.api.options) | ||
.then(handleSuccess) | ||
@@ -344,3 +344,3 @@ .catch(handleError); | ||
include: include, | ||
}) | ||
}, this.api.options) | ||
.then(handleSuccess) | ||
@@ -368,3 +368,3 @@ .catch(handleError); | ||
limit: limit, | ||
}); | ||
}, this.api.options); | ||
return handleSuccess(response); | ||
@@ -395,3 +395,3 @@ } | ||
return await this.api | ||
.aDelete(this.id, { ids: idsArray, where: where, where_document: whereDocument }) | ||
.aDelete(this.id, { ids: idsArray, where: where, where_document: whereDocument }, this.api.options) | ||
.then(handleSuccess) | ||
@@ -398,0 +398,0 @@ .catch(handleError); |
@@ -7,2 +7,3 @@ let CohereAiApi; | ||
CohereAiApi = require("cohere-ai"); | ||
CohereAiApi.init(cohere_api_key); | ||
} | ||
@@ -9,0 +10,0 @@ catch (_a) { |
@@ -6,2 +6,4 @@ export { ChromaClient } from './ChromaClient'; | ||
export { CohereEmbeddingFunction } from './embeddings/CohereEmbeddingFunction'; | ||
export { WebAIEmbeddingFunction } from './embeddings/WebAIEmbeddingFunction'; | ||
export { TransformersEmbeddingFunction } from './embeddings/TransformersEmbeddingFunction'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -5,2 +5,4 @@ export { ChromaClient } from './ChromaClient'; | ||
export { CohereEmbeddingFunction } from './embeddings/CohereEmbeddingFunction'; | ||
export { WebAIEmbeddingFunction } from './embeddings/WebAIEmbeddingFunction'; | ||
export { TransformersEmbeddingFunction } from './embeddings/TransformersEmbeddingFunction'; | ||
//# sourceMappingURL=index.js.map |
@@ -30,3 +30,3 @@ export declare enum IncludeEnum { | ||
}; | ||
export type Where = BaseWhere & LogicalWhere; | ||
export type Where = BaseWhere | LogicalWhere; | ||
type WhereDocumentOperator = "$contains" | LogicalOperator; | ||
@@ -59,3 +59,6 @@ export type WhereDocument = { | ||
export type CollectionMetadata = Record<string, unknown>; | ||
export type ConfigOptions = { | ||
options?: RequestInit; | ||
}; | ||
export {}; | ||
//# sourceMappingURL=types.d.ts.map |
{ | ||
"name": "chromadb", | ||
"version": "1.5.2", | ||
"version": "1.5.3", | ||
"description": "A JavaScript interface for chroma", | ||
@@ -5,0 +5,0 @@ "keywords": [], |
@@ -5,3 +5,3 @@ import { IEmbeddingFunction } from './embeddings/IEmbeddingFunction'; | ||
import { Collection } from './Collection'; | ||
import { CollectionMetadata, CollectionType } from './types'; | ||
import { CollectionMetadata, CollectionType, ConfigOptions } from './types'; | ||
@@ -13,3 +13,3 @@ | ||
*/ | ||
private api: DefaultApi; | ||
private api: DefaultApi & ConfigOptions; | ||
@@ -29,3 +29,9 @@ /** | ||
*/ | ||
constructor({ path }: { path?: string } = {}) { | ||
constructor({ | ||
path, | ||
fetchOptions | ||
}: { | ||
path?: string, | ||
fetchOptions?: RequestInit | ||
} = {}) { | ||
if (path === undefined) path = "http://localhost:8000"; | ||
@@ -36,2 +42,3 @@ const apiConfig: Configuration = new Configuration({ | ||
this.api = new DefaultApi(apiConfig); | ||
this.api.options = fetchOptions ?? {}; | ||
} | ||
@@ -51,3 +58,3 @@ | ||
public async reset(): Promise<Api.Reset200Response> { | ||
return await this.api.reset(); | ||
return await this.api.reset(this.api.options); | ||
} | ||
@@ -65,3 +72,3 @@ | ||
public async version(): Promise<string> { | ||
const response = await this.api.version(); | ||
const response = await this.api.version(this.api.options); | ||
return await handleSuccess(response); | ||
@@ -80,3 +87,3 @@ } | ||
public async heartbeat(): Promise<number> { | ||
const response = await this.api.heartbeat(); | ||
const response = await this.api.heartbeat(this.api.options); | ||
let ret = await handleSuccess(response); | ||
@@ -127,3 +134,3 @@ return ret["nanosecond heartbeat"] | ||
metadata, | ||
}) | ||
}, this.api.options) | ||
.then(handleSuccess) | ||
@@ -174,3 +181,3 @@ .catch(handleError); | ||
'get_or_create': true | ||
}) | ||
}, this.api.options) | ||
.then(handleSuccess) | ||
@@ -204,3 +211,3 @@ .catch(handleError); | ||
public async listCollections(): Promise<CollectionType[]> { | ||
const response = await this.api.listCollections(); | ||
const response = await this.api.listCollections(this.api.options); | ||
return handleSuccess(response); | ||
@@ -232,3 +239,3 @@ } | ||
const response = await this.api | ||
.getCollection(name) | ||
.getCollection(name, this.api.options) | ||
.then(handleSuccess) | ||
@@ -270,3 +277,3 @@ .catch(handleError); | ||
return await this.api | ||
.deleteCollection(name) | ||
.deleteCollection(name, this.api.options) | ||
.then(handleSuccess) | ||
@@ -273,0 +280,0 @@ .catch(handleError); |
@@ -17,3 +17,4 @@ import { | ||
AddResponse, | ||
CollectionMetadata | ||
CollectionMetadata, | ||
ConfigOptions | ||
} from "./types"; | ||
@@ -33,3 +34,3 @@ import { IEmbeddingFunction } from './embeddings/IEmbeddingFunction'; | ||
*/ | ||
private api: DefaultApi; | ||
private api: DefaultApi & ConfigOptions; | ||
/** | ||
@@ -200,3 +201,3 @@ * @ignore | ||
metadatas: metadatasArray, | ||
}) | ||
}, this.api.options) | ||
.then(handleSuccess) | ||
@@ -255,2 +256,3 @@ .catch(handleError); | ||
}, | ||
this.api.options | ||
) | ||
@@ -274,3 +276,3 @@ .then(handleSuccess) | ||
public async count(): Promise<number> { | ||
const response = await this.api.count(this.id); | ||
const response = await this.api.count(this.id, this.api.options); | ||
return handleSuccess(response); | ||
@@ -308,2 +310,3 @@ } | ||
}, | ||
this.api.options | ||
) | ||
@@ -369,3 +372,3 @@ .then(handleSuccess) | ||
where_document: whereDocument, | ||
}) | ||
}, this.api.options) | ||
.then(handleSuccess) | ||
@@ -437,2 +440,3 @@ .catch(handleError); | ||
}, | ||
this.api.options | ||
) | ||
@@ -520,3 +524,3 @@ .then(handleSuccess) | ||
include: include, | ||
}) | ||
}, this.api.options) | ||
.then(handleSuccess) | ||
@@ -544,3 +548,3 @@ .catch(handleError); | ||
limit: limit, | ||
}); | ||
}, this.api.options); | ||
return handleSuccess(response); | ||
@@ -579,3 +583,3 @@ } | ||
return await this.api | ||
.aDelete(this.id, { ids: idsArray, where: where, where_document: whereDocument }) | ||
.aDelete(this.id, { ids: idsArray, where: where, where_document: whereDocument }, this.api.options) | ||
.then(handleSuccess) | ||
@@ -582,0 +586,0 @@ .catch(handleError); |
@@ -13,2 +13,3 @@ import { IEmbeddingFunction } from "./IEmbeddingFunction"; | ||
CohereAiApi = require("cohere-ai"); | ||
CohereAiApi.init(cohere_api_key); | ||
} catch { | ||
@@ -30,2 +31,2 @@ throw new Error( | ||
} | ||
} | ||
} |
export interface IEmbeddingFunction { | ||
generate(texts: string[]): Promise<number[][]>; | ||
} | ||
} |
@@ -48,2 +48,2 @@ import { IEmbeddingFunction } from "./IEmbeddingFunction"; | ||
} | ||
} | ||
} |
@@ -6,1 +6,3 @@ export { ChromaClient } from './ChromaClient'; | ||
export { CohereEmbeddingFunction } from './embeddings/CohereEmbeddingFunction'; | ||
export { WebAIEmbeddingFunction } from './embeddings/WebAIEmbeddingFunction'; | ||
export { TransformersEmbeddingFunction } from './embeddings/TransformersEmbeddingFunction'; |
@@ -40,3 +40,3 @@ export enum IncludeEnum { | ||
export type Where = BaseWhere & LogicalWhere; | ||
export type Where = BaseWhere | LogicalWhere; | ||
@@ -76,1 +76,7 @@ type WhereDocumentOperator = "$contains" | LogicalOperator; | ||
export type CollectionMetadata = Record<string, unknown>; | ||
// RequestInit can be used to set Authorization headers and more | ||
// see all options here: https://www.jsdocs.io/package/@types/node-fetch#RequestInit | ||
export type ConfigOptions = { | ||
options?: RequestInit; | ||
}; |
@@ -65,2 +65,2 @@ import { Api } from "./generated" | ||
} | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
591417
139
10378