Chroma.Collection (chroma v0.1.1)
Chroma Collection methods.
Summary
Functions
Adds a batch of embeddings in the database.
Counts all embeddings from a collection.
Creates a collection.
Deletes a collection by name.
Gets a collection by name.
Gets or create a collection by name.
Lists all collections.
It updates the name and metadata of a collection.
Creates a new Chroma.Collection
struct.
Updates a batch of embeddings in the database.
Upserts a batch of embeddings in the database
Functions
add(collection, data)
Adds a batch of embeddings in the database.
count(collection)
Counts all embeddings from a collection.
Examples:
iex> Chroma.Collection.count(%Chroma.Collection{id: "123"})
{:ok, 100}
create(name, metadata \\ %{})
@spec create(String.t(), map()) :: {:error, any()} | {:ok, %{id: any(), metadata: any(), name: any()}}
Creates a collection.
Examples:
iex> Chroma.Collection.create("my_collection", metadata: %{type: "test"})
{:ok, %Chroma.Collection{id: "123", name: "my_collection", metadata: %{type: "test"}}}
delete(collection)
Deletes a collection by name.
Examples:
iex> Chroma.Collection.delete("my_collection")
{:ok, nil}
get(name)
Gets a collection by name.
Examples:
iex> Chroma.Collection.get("my_collection")
{:ok, %Chroma.Collection{id: "123", name: "my_collection", metadata: %{}}}
get_or_create(name, metadata \\ %{})
@spec get_or_create(String.t(), map()) :: {:error, any()} | {:ok, %{id: any(), metadata: any(), name: any()}}
Gets or create a collection by name.
Examples:
iex> Chroma.Collection.get_or_create("my_collection", metadata: %{type: "test"})
{:ok, %Chroma.Collection{id: "123", name: "my_collection", metadata: %{type: "test"})}}
list()
Lists all collections.
Examples:
iex> Chroma.Collection.list()
{:ok, [%Chroma.Collection{id: "123", name: "my_collection", metadata: %{}}]}
modify(collection, kwargs)
It updates the name and metadata of a collection.
Examples:
iex> Chroma.Collection.modify(%Chroma.Collection{id: "123"}, name: "new_name")
{:ok, %Chroma.Collection{id: "123", name: "new_name", metadata: %{}}}
iex> Chroma.Collection.modify(%Chroma.Collection{id: "123"}, metadata: %{type: "test"})
{:ok, %Chroma.Collection{id: "123", name: "new_name", metadata: %{type: "test"}}}
iex> Chroma.Collection.modify(%Chroma.Collection{id: "123"}, %{name: "new_name", metadata: %{type: "test"}})
{:ok, %Chroma.Collection{id: "123", name: "new_name", metadata: %{type: "test"}}}
new(map)
Creates a new Chroma.Collection
struct.
Examples:
iex> Chroma.Collection.new(%{"id" => "123", "name" => "my_collection", "metadata" => %{}})
%Chroma.Collection{id: "123", name: "my_collection", metadata: %{}}
query(collection, embeddings, options)
update(collection, data)
Updates a batch of embeddings in the database.
upsert(collection, data)
Upserts a batch of embeddings in the database