instrukt.indexes.manager.IndexManager

class instrukt.indexes.manager.IndexManager(*, chroma_settings: ChromaSettings, chroma_kwargs: dict[str, Any] = None, **kwargs)[source]

Bases: BaseModel

Helper to access chroma indexes.

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

param chroma_kwargs: dict[str, Any] [Optional]
param chroma_settings: ChromaSettings [Required]
async adelete_index(name: str) None[source]

Remove the given index.

async aget_index(collection_name: str) ChromaWrapper | None[source]

Async version of get_index.

create(_ctx: Context, index: Index) ChromaWrapper | None[source]

Create a new index from the given file or directory path.

get_embedding_fn(col_name: str) EmbeddingDetails[source]

Get embedding function as fully qualified class name for the collection.

The embedding function is stored in the collection metadata.

Returns:

(embedding_fn_cls, Optional[model_name])

get_embedding_fn_cls(embedding_fqn: str) Type[TEmbeddings][source]

Get embedding function class for the collection.

get_index(collection_name: str) ChromaWrapper | None[source]

Return the chroma db instance for the given collection name.

get_loader(path: str, loader_type: str | None = None)[source]
list_collections() Sequence[Collection][source]

List the available index collections.

property indexes: Sequence[str]

Return the list of loaded indexes.

model Config[source]

Bases: object

arbitrary_types_allowed = True
extra = 'allow'