IndexConfig

class lightning_ir.retrieve.base.indexer.IndexConfig[source]

Bases: object

Configuration class for indexers that defines the index type and other parameters.

Methods

from_pretrained(index_dir)

Load the index configuration from a directory.

save(index_dir)

Save the index configuration to a directory.

to_dict()

Convert the index configuration to a dictionary.

Attributes

indexer_class

SUPPORTED_MODELS

classmethod from_pretrained(index_dir: Path | str) IndexConfig[source]

Load the index configuration from a directory.

Parameters:

index_dir (Path | str) – Path to the directory containing the index configuration.

Returns:

An instance of the index configuration class.

Return type:

IndexConfig

Raises:

ValueError – If the index type in the configuration does not match the expected class name.

save(index_dir: Path) None[source]

Save the index configuration to a directory.

Parameters:

index_dir (Path) – The directory to save the index configuration.

to_dict() dict[source]

Convert the index configuration to a dictionary.

Returns:

A dictionary representation of the index configuration.

Return type:

dict