ExChromaDb.Api.Operations (ex_chroma_db v0.1.0)

View Source

Provides API endpoints related to operations

Summary

Functions

Retrieves the number of records in a collection.

Deletes records in a collection. Can filter by IDs or metadata.

Retrieves records from a collection by ID or metadata filter.

Query a collection in a variety of ways, including vector search, metadata filtering, and full-text search

Upserts records in a collection (create if not exists, otherwise update).

Retrieves the total number of collections in a given database.

Creates a new collection under the specified database.

Creates a new database for a given tenant.

Creates a new tenant.

Deletes a collection in a given database.

Deletes a specific database.

Retrieves a collection by ID or name.

Retrieves a specific database by name.

Returns an existing tenant by name.

Retrieves the current user's identity, tenant, and databases.

Health check endpoint that returns 200 if the server and executor are ready

Heartbeat endpoint that returns a nanosecond timestamp of the current time.

Lists all collections in the specified database.

Lists all databases for a given tenant.

Pre-flight checks endpoint reporting basic readiness info.

Reset endpoint allowing authorized users to reset the database.

Updates an existing collection's name or metadata.

Returns the version of the server.

Functions

collection_add(tenant, database, collection_id, body, opts \\ [])

@spec collection_add(
  String.t(),
  String.t(),
  String.t(),
  ExChromaDb.Api.AddCollectionRecordsPayload.t(),
  keyword()
) :: {:ok, map()} | :error

Adds records to a collection.

collection_count(tenant, database, collection_id, opts \\ [])

@spec collection_count(String.t(), String.t(), String.t(), keyword()) ::
  {:ok, integer()} | {:error, ExChromaDb.Api.ErrorResponse.t()}

Retrieves the number of records in a collection.

collection_delete(tenant, database, collection_id, body, opts \\ [])

@spec collection_delete(
  String.t(),
  String.t(),
  String.t(),
  ExChromaDb.Api.DeleteCollectionRecordsPayload.t(),
  keyword()
) :: {:ok, map()} | {:error, ExChromaDb.Api.ErrorResponse.t()}

Deletes records in a collection. Can filter by IDs or metadata.

collection_get(tenant, database, collection_id, body, opts \\ [])

Retrieves records from a collection by ID or metadata filter.

collection_query(tenant, database, collection_id, body, opts \\ [])

Query a collection in a variety of ways, including vector search, metadata filtering, and full-text search

Options

  • limit: Limit for pagination
  • offset: Offset for pagination

collection_update(tenant, database, collection_id, body, opts \\ [])

@spec collection_update(
  String.t(),
  String.t(),
  String.t(),
  ExChromaDb.Api.UpdateCollectionRecordsPayload.t(),
  keyword()
) :: {:ok, map()} | :error

Updates records in a collection by ID.

collection_upsert(tenant, database, collection_id, body, opts \\ [])

@spec collection_upsert(
  String.t(),
  String.t(),
  String.t(),
  ExChromaDb.Api.UpsertCollectionRecordsPayload.t(),
  keyword()
) :: {:ok, map()} | {:error, ExChromaDb.Api.ErrorResponse.t()}

Upserts records in a collection (create if not exists, otherwise update).

count_collections(tenant, database, opts \\ [])

@spec count_collections(String.t(), String.t(), keyword()) ::
  {:ok, integer()} | {:error, ExChromaDb.Api.ErrorResponse.t()}

Retrieves the total number of collections in a given database.

create_collection(tenant, database, body, opts \\ [])

Creates a new collection under the specified database.

create_database(tenant, body, opts \\ [])

@spec create_database(String.t(), ExChromaDb.Api.CreateDatabasePayload.t(), keyword()) ::
  {:ok, map()} | {:error, ExChromaDb.Api.ErrorResponse.t()}

Creates a new database for a given tenant.

create_tenant(body, opts \\ [])

@spec create_tenant(
  ExChromaDb.Api.CreateTenantPayload.t(),
  keyword()
) :: {:ok, map()} | {:error, ExChromaDb.Api.ErrorResponse.t()}

Creates a new tenant.

delete_collection(tenant, database, collection_id, opts \\ [])

@spec delete_collection(String.t(), String.t(), String.t(), keyword()) ::
  {:ok, map()} | {:error, ExChromaDb.Api.ErrorResponse.t()}

Deletes a collection in a given database.

delete_database(tenant, database, opts \\ [])

@spec delete_database(String.t(), String.t(), keyword()) ::
  {:ok, map()} | {:error, ExChromaDb.Api.ErrorResponse.t()}

Deletes a specific database.

get_collection(tenant, database, collection_id, opts \\ [])

@spec get_collection(String.t(), String.t(), String.t(), keyword()) ::
  {:ok, ExChromaDb.Api.Collection.t()}
  | {:error, ExChromaDb.Api.ErrorResponse.t()}

Retrieves a collection by ID or name.

get_database(tenant, database, opts \\ [])

@spec get_database(String.t(), String.t(), keyword()) ::
  {:ok, ExChromaDb.Api.Database.t()}
  | {:error, ExChromaDb.Api.ErrorResponse.t()}

Retrieves a specific database by name.

get_tenant(tenant_name, opts \\ [])

@spec get_tenant(
  String.t(),
  keyword()
) ::
  {:ok, ExChromaDb.Api.GetTenantResponse.t()}
  | {:error, ExChromaDb.Api.ErrorResponse.t()}

Returns an existing tenant by name.

get_user_identity(opts \\ [])

@spec get_user_identity(keyword()) ::
  {:ok, ExChromaDb.Api.GetUserIdentityResponse.t()}
  | {:error, ExChromaDb.Api.ErrorResponse.t()}

Retrieves the current user's identity, tenant, and databases.

healthcheck(opts \\ [])

@spec healthcheck(keyword()) ::
  {:ok, String.t()} | {:error, ExChromaDb.Api.ErrorResponse.t()}

Health check endpoint that returns 200 if the server and executor are ready

heartbeat(opts \\ [])

@spec heartbeat(keyword()) ::
  {:ok, ExChromaDb.Api.HeartbeatResponse.t()}
  | {:error, ExChromaDb.Api.ErrorResponse.t()}

Heartbeat endpoint that returns a nanosecond timestamp of the current time.

list_collections(tenant, database, opts \\ [])

@spec list_collections(String.t(), String.t(), keyword()) ::
  {:ok, [ExChromaDb.Api.Vec.t()]} | {:error, ExChromaDb.Api.ErrorResponse.t()}

Lists all collections in the specified database.

Options

  • limit: Limit for pagination
  • offset: Offset for pagination

list_databases(tenant, opts \\ [])

@spec list_databases(
  String.t(),
  keyword()
) ::
  {:ok, [ExChromaDb.Api.Vec.t()]} | {:error, ExChromaDb.Api.ErrorResponse.t()}

Lists all databases for a given tenant.

Options

  • limit: Limit for pagination
  • offset: Offset for pagination

pre_flight_checks(opts \\ [])

@spec pre_flight_checks(keyword()) ::
  {:ok, ExChromaDb.Api.ChecklistResponse.t()}
  | {:error, ExChromaDb.Api.ErrorResponse.t()}

Pre-flight checks endpoint reporting basic readiness info.

reset(opts \\ [])

@spec reset(keyword()) ::
  {:ok, boolean()} | {:error, ExChromaDb.Api.ErrorResponse.t()}

Reset endpoint allowing authorized users to reset the database.

update_collection(tenant, database, collection_id, body, opts \\ [])

@spec update_collection(
  String.t(),
  String.t(),
  String.t(),
  ExChromaDb.Api.UpdateCollectionPayload.t(),
  keyword()
) :: {:ok, map()} | {:error, ExChromaDb.Api.ErrorResponse.t()}

Updates an existing collection's name or metadata.

version(opts \\ [])

@spec version(keyword()) :: {:ok, String.t()} | :error

Returns the version of the server.