Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

ChromaClient

class ChromaClient {
constructor({ path, fetchOptions, auth, tenant, database }?: ChromaClientParams);
private _adminClient;
private _initPromise;
private authProvider;
api: ApiApi & ConfigOptions;
database: string;
tenant: string;
 
countCollections(): Promise<number>;
createCollection({ name, metadata, embeddingFunction }: CreateCollectionParams): Promise<Collection>;
deleteCollection({ name }: DeleteCollectionParams): Promise<void>;
getCollection({ name, embeddingFunction }: GetCollectionParams): Promise<Collection>;
getOrCreateCollection({ name, metadata, embeddingFunction }: GetOrCreateCollectionParams): Promise<Collection>;
getUserIdentity(): Promise<void>;
heartbeat(): Promise<number>;
init(): Promise<void>;
listCollections({ limit, offset }?: ListCollectionsParams): Promise<string[]>;
listCollectionsAndMetadata({ limit, offset }?: ListCollectionsParams): Promise<{
name: string;
id: string;
metadata?: CollectionMetadata;
}
[]
>
;
reset(): Promise<boolean>;
version(): Promise<string>;
}

§Constructors

§
new ChromaClient({ path, fetchOptions, auth, tenant, database }?: ChromaClientParams)
[src]

Creates a new ChromaClient instance.

@param params
  • The parameters for creating a new client
@example
const client = new ChromaClient({
  path: "http://localhost:8000"
});

§Properties

§
_adminClient
[src]
§
_initPromise
[src]
§
authProvider
[src]
§
api: ApiApi & ConfigOptions
[src]
§
database: string
[src]
§
tenant: string
[src]

§Methods

§
countCollections(): Promise<number>
[src]

Counts all collections.

@return

A promise that resolves to the number of collections.

@example
const collections = await client.countCollections();
§
createCollection({ name, metadata, embeddingFunction }: CreateCollectionParams): Promise<Collection>
[src]

Creates a new collection with the specified properties.

@param params
  • The parameters for creating a new collection.
@param params.name
  • The name of the collection.
@return

A promise that resolves to the created collection.

@example
const collection = await client.createCollection({
  name: "my_collection",
  metadata: {
    "description": "My first collection"
  }
});
§
deleteCollection({ name }: DeleteCollectionParams): Promise<void>
[src]

Deletes a collection with the specified name.

@param params
  • The parameters for deleting a collection.
@param params.name
  • The name of the collection.
@return

A promise that resolves when the collection is deleted.

@example
await client.deleteCollection({
 name: "my_collection"
});
§
getCollection({ name, embeddingFunction }: GetCollectionParams): Promise<Collection>
[src]

Gets a collection with the specified name.

@param params
  • The parameters for getting a collection.
@param params.name
  • The name of the collection.
@return

A promise that resolves to the collection.

@example
const collection = await client.getCollection({
  name: "my_collection"
});
§
getOrCreateCollection({ name, metadata, embeddingFunction }: GetOrCreateCollectionParams): Promise<Collection>
[src]

Gets or creates a collection with the specified properties.

@param params
  • The parameters for creating a new collection.
@param params.name
  • The name of the collection.
@return

A promise that resolves to the got or created collection.

@example
const collection = await client.getOrCreateCollection({
  name: "my_collection",
  metadata: {
    "description": "My first collection"
  }
});
§
getUserIdentity(): Promise<void>
[src]

Tries to set the tenant and database for the client.

@return

A promise that resolves when the tenant/database is resolved.

§
heartbeat(): Promise<number>
[src]

Returns a heartbeat from the Chroma API.

@return

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

@example
const heartbeat = await client.heartbeat();
§
init(): Promise<void>
[src]
§
listCollections({ limit, offset }?: ListCollectionsParams): Promise<string[]>
[src]

Get all collection names.

@return

A promise that resolves to a list of collection names.

@example
const collections = await client.listCollections({
    limit: 10,
    offset: 0,
});
§
listCollectionsAndMetadata({ limit, offset }?: ListCollectionsParams): Promise<{
name: string;
id: string;
metadata?: CollectionMetadata;
}
[]
>
[src]

List collection names, IDs, and metadata.

@return
@example
const collections = await client.listCollectionsAndMetadata({
   limit: 10,
   offset: 0,
});
§
reset(): Promise<boolean>
[src]

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

@return

A promise that resolves when the reset operation is complete.

@example
await client.reset();
§
version(): Promise<string>
[src]

Returns the version of the Chroma API.

@return

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

@example
const version = await client.version();