Class: ChromaClient#
Constructors#
constructor#
• new ChromaClient(params?
)
Creates a new ChromaClient instance.
Example
Parameters#
Name | Type | Description |
---|---|---|
params | Object | The parameters for creating a new client |
params.path? | string | The base path for the Chroma API. |
Methods#
createCollection#
â–¸ createCollection(params
): Promise
<Collection
>
Creates a new collection with the specified properties.
Throws
If there is an issue creating the collection.
Example
Parameters#
Name | Type | Description |
---|---|---|
params | Object | The parameters for creating a new collection. |
params.embeddingFunction? | IEmbeddingFunction | Optional custom embedding function for the collection. |
params.metadata? | CollectionMetadata | Optional metadata associated with the collection. |
params.name | string | The name of the collection. |
Returns#
Promise
<Collection
>
A promise that resolves to the created collection.
deleteCollection#
â–¸ deleteCollection(params
): Promise
<void
>
Deletes a collection with the specified name.
Throws
If there is an issue deleting the collection.
Example
Parameters#
Name | Type | Description |
---|---|---|
params | Object | The parameters for deleting a collection. |
params.name | string | The name of the collection. |
Returns#
Promise
<void
>
A promise that resolves when the collection is deleted.
getCollection#
â–¸ getCollection(params
): Promise
<Collection
>
Gets a collection with the specified name.
Throws
If there is an issue getting the collection.
Example
Parameters#
Name | Type | Description |
---|---|---|
params | Object | The parameters for getting a collection. |
params.embeddingFunction? | IEmbeddingFunction | Optional custom embedding function for the collection. |
params.name | string | The name of the collection. |
Returns#
Promise
<Collection
>
A promise that resolves to the collection.
getOrCreateCollection#
â–¸ getOrCreateCollection(params
): Promise
<Collection
>
Gets or creates a collection with the specified properties.
Throws
If there is an issue getting or creating the collection.
Example
Parameters#
Name | Type | Description |
---|---|---|
params | Object | The parameters for creating a new collection. |
params.embeddingFunction? | IEmbeddingFunction | Optional custom embedding function for the collection. |
params.metadata? | CollectionMetadata | Optional metadata associated with the collection. |
params.name | string | The name of the collection. |
Returns#
Promise
<Collection
>
A promise that resolves to the got or created collection.
heartbeat#
â–¸ heartbeat(): Promise
<number
>
Returns a heartbeat from the Chroma API.
Example
Returns#
Promise
<number
>
A promise that resolves to the heartbeat from the Chroma API.
listCollections#
â–¸ listCollections(): Promise
<CollectionType
[]>
Lists all collections.
Throws
If there is an issue listing the collections.
Example
Returns#
Promise
<CollectionType
[]>
A promise that resolves to a list of collection names.
reset#
â–¸ reset(): Promise
<Reset200Response
>
Resets the state of the object by making an API call to the reset endpoint.
Throws
If there is an issue resetting the state.
Example
Returns#
Promise
<Reset200Response
>
A promise that resolves when the reset operation is complete.
version#
â–¸ version(): Promise
<string
>
Returns the version of the Chroma API.
Example
Returns#
Promise
<string
>
A promise that resolves to the version of the Chroma API.