Skip to main content
Version: 1.0

aixplain.factories.index_factory.utils

BaseIndexParams Objects

class BaseIndexParams(BaseModel, ABC)

[view_source]

Abstract base class for index parameters.

This class defines the common parameters and functionality for all index types. It uses Pydantic for data validation and serialization.

Attributes:

  • model_config ConfigDict - Pydantic configuration using enum values.
  • name Text - Name of the index.
  • description Optional[Text] - Description of the index. Defaults to "".

to_dict

def to_dict() -> Dict

[view_source]

Convert the parameters to a dictionary format.

Converts the parameters to a dictionary suitable for API requests, renaming 'name' to 'data' in the process.

Returns:

  • Dict - Dictionary representation of the parameters.

id

@property
@abstractmethod
def id() -> str

[view_source]

Abstract property that must be implemented in subclasses.

BaseIndexParamsWithEmbeddingModel Objects

class BaseIndexParamsWithEmbeddingModel(BaseIndexParams, ABC)

[view_source]

Abstract base class for index parameters that require an embedding model.

This class extends BaseIndexParams to add support for embedding model configuration, including model selection and embedding size settings.

Attributes:

  • embedding_model Optional[Union[EmbeddingModel, str]] - Model to use for text embeddings. Defaults to EmbeddingModel.OPENAI_ADA002.
  • embedding_size Optional[int] - Size of the embeddings to generate. Defaults to None.

validate_embedding_model

@field_validator("embedding_model")
def validate_embedding_model(cls, model_id) -> str

[view_source]

Validate that the provided model is a text embedding model.

Arguments:

  • model_id Union[EmbeddingModel, str] - Model ID or enum value to validate.

Returns:

  • str - The validated model ID.

Raises:

  • ValueError - If the model is not a text embedding model.

to_dict

def to_dict() -> Dict

[view_source]

Convert the parameters to a dictionary format.

Extends the base to_dict method to handle embedding-specific parameters, renaming fields and restructuring as needed for the API.

Returns:

  • Dict - Dictionary representation of the parameters with embedding configuration properly formatted.

VectaraParams Objects

class VectaraParams(BaseIndexParams)

[view_source]

Parameters for creating a Vectara index.

This class defines the configuration for Vectara's vector search index.

Attributes:

  • _id ClassVar[str] - Static model ID for Vectara index type.

id

@property
def id() -> str

[view_source]

Get the model ID for Vectara index type.

Returns:

  • str - The Vectara model ID.

ZeroEntropyParams Objects

class ZeroEntropyParams(BaseIndexParams)

[view_source]

Parameters for creating a Zero Entropy index.

This class defines the configuration for Zero Entropy's vector search index.

Attributes:

  • _id ClassVar[str] - Static model ID for Zero Entropy index type.

id

@property
def id() -> str

[view_source]

Get the model ID for Zero Entropy index type.

Returns:

  • str - The Zero Entropy model ID.

AirParams Objects

class AirParams(BaseIndexParamsWithEmbeddingModel)

[view_source]

Parameters for creating an AIR (aiXplain Index and Retrieval) index.

This class defines the configuration for AIR's vector search index, including embedding model settings.

Attributes:

  • _id ClassVar[str] - Static model ID for AIR index type.

id

@property
def id() -> str

[view_source]

Get the model ID for AIR index type.

Returns:

  • str - The AIR model ID.

GraphRAGParams Objects

class GraphRAGParams(BaseIndexParamsWithEmbeddingModel)

[view_source]

Parameters for creating a GraphRAG (Graph-based Retrieval-Augmented Generation) index.

This class defines the configuration for GraphRAG's vector search index, including embedding model and LLM settings.

Attributes:

  • _id ClassVar[str] - Static model ID for GraphRAG index type.
  • llm Optional[Text] - ID of the LLM to use for generation. Defaults to None.

id

@property
def id() -> str

[view_source]

Get the model ID for GraphRAG index type.

Returns:

  • str - The GraphRAG model ID.