JS Client

Class: ChromaClient#

ChromaClient.ChromaClient

Constructors#

constructor#

• new ChromaClient(params?)

Creates a new ChromaClient instance.

Parameters#

NameTypeDescription
paramsChromaClientParamsThe parameters for creating a new client

Example

typescript

Methods#

countCollections#

â–¸ countCollections(): Promise<number>

Counts all collections.

Returns#

Promise<number>

A promise that resolves to the number of collections.

Throws

If there is an issue counting the collections.

Example

typescript


createCollection#

â–¸ createCollection(params): Promise<Collection>

Creates a new collection with the specified properties.

Parameters#

NameTypeDescription
paramsCreateCollectionParamsThe parameters for creating a new collection.

Returns#

Promise<Collection>

A promise that resolves to the created collection.

Throws

If the client is unable to connect to the server.

Throws

If there is an issue creating the collection.

Example

typescript


deleteCollection#

â–¸ deleteCollection(params): Promise<void>

Deletes a collection with the specified name.

Parameters#

NameTypeDescription
paramsDeleteCollectionParamsThe parameters for deleting a collection.

Returns#

Promise<void>

A promise that resolves when the collection is deleted.

Throws

If there is an issue deleting the collection.

Example

typescript


getCollection#

â–¸ getCollection(params): Promise<Collection>

Gets a collection with the specified name.

Parameters#

NameTypeDescription
paramsGetCollectionParamsThe parameters for getting a collection.

Returns#

Promise<Collection>

A promise that resolves to the collection.

Throws

If there is an issue getting the collection.

Example

typescript


getOrCreateCollection#

â–¸ getOrCreateCollection(params): Promise<Collection>

Gets or creates a collection with the specified properties.

Parameters#

NameTypeDescription
paramsCreateCollectionParamsThe parameters for creating a new collection.

Returns#

Promise<Collection>

A promise that resolves to the got or created collection.

Throws

If there is an issue getting or creating the collection.

Example

typescript


heartbeat#

â–¸ heartbeat(): Promise<number>

Returns a heartbeat from the Chroma API.

Returns#

Promise<number>

A promise that resolves to the heartbeat from the Chroma API.

Throws

If the client is unable to connect to the server.

Example

typescript


listCollections#

▸ listCollections(«destructured»?): Promise<CollectionParams[]>

Lists all collections.

Parameters#

NameType
«destructured»ListCollectionsParams

Returns#

Promise<CollectionParams[]>

A promise that resolves to a list of collection names.

Throws

If there is an issue listing the collections.

Example

typescript


reset#

â–¸ reset(): Promise<boolean>

Resets the state of the object by making an API call to the reset endpoint.

Returns#

Promise<boolean>

A promise that resolves when the reset operation is complete.

Throws

If the client is unable to connect to the server.

Throws

If the server experienced an error while the state.

Example

typescript


version#

â–¸ version(): Promise<string>

Returns the version of the Chroma API.

Returns#

Promise<string>

A promise that resolves to the version of the Chroma API.

Throws

If the client is unable to connect to the server.

Example

typescript