Skip to content

app_settings

Application settings module

Attributes

SETTINGS_ENCODING module-attribute

SETTINGS_ENCODING = 'utf-8'

SETTINGS_ENV_DOTENV module-attribute

SETTINGS_ENV_DOTENV = (
    f"{SETTINGS_ENV_PREFIX}SETTINGS_DOTENV"
)

SETTINGS_ENV_PREFIX module-attribute

SETTINGS_ENV_PREFIX = 'ELEANOR_'

SETTINGS_ENV_YAML module-attribute

SETTINGS_ENV_YAML = f'{SETTINGS_ENV_PREFIX}SETTINGS_YAML'

SETTINGS_FIELD_DELIMITER module-attribute

SETTINGS_FIELD_DELIMITER = '__'

Classes

APIClient

Bases: IoCFactoryModel

High-level Eleanor framework backend API client factory settings. See: eleanor.client.EleanorAPIClient

Attributes:

Attributes

low_level_client class-attribute instance-attribute
low_level_client: LowLevelAPIClient = Field(
    ..., description=__doc__
)

AppSettings

Bases: BaseSettings, SettingsBaseModel

Eleanor framework configuration settings

Settings will be loaded in the following order
  1. Parameters passed in on instantiation
  2. A YAML configuration referenced by the environment variable ‘ELEANOR_SETTINGS_YAML’
  3. A .env file that is typically passed in on the constructor ex:

settings = Settings(_env_file=’config/settings.env’)

  1. file_secret_settings, see https://docs.pydantic.dev/latest/concepts/pydantic_settings/#secrets

Note that the first appearance of a setting effectively locks it in.

Attributes:

Attributes

api_client class-attribute instance-attribute
api_client: APIClient = Field(..., description=__doc__)
backend class-attribute instance-attribute
backend: BackendSettings = Field(..., description=__doc__)
chain_registry class-attribute instance-attribute
chain_registry: SkipJsonSchema[
    Registry[Tuple[ChainBuilder, RunnableSerializable]]
] = Field(
    default_factory=Registry[
        Tuple[ChainBuilder, RunnableSerializable]
    ],
    title="Chain Registry",
    description="The Eleanor framework will load LangChain chains into this registry so they can be referenced when invoking them via the service or API layers. This field is considered volatile and is intended to be set each time the application starts.",
    frozen=False,
    exclude=True,
    validate_default=True,
)
cognitive class-attribute instance-attribute
cognitive: CognitiveSettings = Field(
    ..., description=__doc__
)
corpus_reader class-attribute instance-attribute
corpus_reader: CorpusReaderSettings = Field(
    ..., title="Corpus Reader Settings", description=__doc__
)
db_engine class-attribute instance-attribute
db_engine: DBEngineSettings = Field(
    ..., description=__doc__
)
db_engine_connection_logging class-attribute instance-attribute
db_engine_connection_logging: bool = Field(
    default=True,
    title="DB Connection Logging",
    description="When true, the framework will log database connection creation events. Usefulwhen debugging database connection issues.",
)
embeddings_model_path class-attribute instance-attribute
embeddings_model_path: str = Field(
    default="",
    description="Filesystem path to the embeddings model",
)
encoding class-attribute instance-attribute
encoding: str = Field(
    default="UTF-8",
    title="Default Encoding",
    description="Default character encoding used by the framework",
)
llm_client class-attribute instance-attribute
llm_client: IoCFactoryModel = Field(
    ...,
    title="Eleanor LLM Client Factory",
    description="Eleanor framework LLM client configuration. This is a LangChain LLM client that can be used to connect to the Eleanor Framework chat API.",
)
llms class-attribute instance-attribute
llms: Dict[str, LLMSettings] = Field(
    default_factory=dict, frozen=True, description=__doc__
)
model_config class-attribute instance-attribute
model_config = SettingsConfigDict(
    env_prefix=SETTINGS_ENV_PREFIX,
    case_sensitive=False,
    env_file_encoding=SETTINGS_ENCODING,
    env_nested_delimiter=SETTINGS_FIELD_DELIMITER,
)
monkeypatch class-attribute instance-attribute
monkeypatch: List[MonkeyPatchSettingsRecord] = Field(
    default_factory=list,
    title="Monkeypatch Settings",
    description=__doc__,
)
quantization class-attribute instance-attribute
quantization: QuantizationSettings = Field(
    ..., title="", description=__doc__
)
sessionmaker_kwargs class-attribute instance-attribute
sessionmaker_kwargs: KwargsModel = Field(
    default_factory=KwargsModel,
    title="Sessionmaker Kwargs",
    description="Additional Kwargs to pass to the sessionmaker constructor, see https://docs.sqlalchemy.org/en/20/orm/session_api.html#sqlalchemy.orm.sessionmaker",
)
text_evolve_evaluate class-attribute instance-attribute
text_evolve_evaluate: EvaluateSettings = Field(
    ..., description=__doc__
)
textproc class-attribute instance-attribute
textproc: TextProcSettings = Field(
    ..., title="TextProc Settings", description=__doc__
)
timezone class-attribute instance-attribute
timezone: str = Field(
    default="UTC",
    title="Timezone",
    description="System timezone",
)
ui class-attribute instance-attribute
ui: UISettings = Field(..., description=__doc__)
vector_stores class-attribute instance-attribute
vector_stores: Dict[str, VectorStoreSettings] = Field(
    default_factory=dict, description=__doc__
)
vector_tokenizer class-attribute instance-attribute
vector_tokenizer: VectorTokenizer = Field(
    ..., title="Vector Tokenizer", description=__doc__
)
vectordb_bulk_op_pool_size class-attribute instance-attribute
vectordb_bulk_op_pool_size: int = Field(
    default=1,
    title="Bulk Vectorize Pool Size",
    description="When performing bulk memory adds, the vectorization process before it is added to the vector store can be parallelized by collection. This pool limits the number of parallel collections that are added to the vector store. Note that this value is global, meaning if multiple processes are adding memories they will share the same thread pool.",
)
vectordb_bulk_op_timeout class-attribute instance-attribute
vectordb_bulk_op_timeout: int = Field(
    default=300,
    title="Bulk Vectorize Operation Timeout",
    description="LangChain VectorStore operation timeout for bulk vectorization operations. This ia a global settings that should be considered closely with the 'bulk_vectorize_pool_size' setting.",
)
vectordb_worker_batch_size class-attribute instance-attribute
vectordb_worker_batch_size: int = Field(
    default=1000,
    title="Bulk Vectorize Worker Batch Size",
    description="Each bulk vectorization worker wraps LangChain VectorStore add_texts operation. This setting controls the batch_size parameter used in this process.",
)
vectordb_worker_default_trim_strategy class-attribute instance-attribute
vectordb_worker_default_trim_strategy: str = Field(
    default="chunk",
    title="Bulk Vectorize Default Trim Strategy",
    description="During bulk vectorization, the worker needs a way to handle texts that exceed the embeddings maximum size. This value represents the system default strategy and can be either 'truncate' or 'chunk'.",
)

Functions

settings_customise_sources classmethod
settings_customise_sources(
    settings_cls: Type[BaseSettings],
    init_settings: PydanticBaseSettingsSource,
    env_settings: PydanticBaseSettingsSource,
    dotenv_settings: PydanticBaseSettingsSource,
    file_secret_settings: PydanticBaseSettingsSource,
) -> Tuple[PydanticBaseSettingsSource, ...]
trigger_initializers
trigger_initializers(condition: InitCondition) -> None

Triggers all initializers that have the specified condition.

Parameters:

  • condition (InitCondition) –

    The condition to check against the available conditions.

Returns:

  • None

    None

validate_timezone classmethod
validate_timezone(timezone: str) -> str

ChainBuilder

Bases: BaseModel

Chain builder configuration

Attributes:

Attributes

description class-attribute instance-attribute
description: str = Field(
    default="",
    title="Chain Description",
    description="Description of the chain configuration",
)
name class-attribute instance-attribute
name: str = Field(
    ...,
    title="Chain Name",
    description="Unique name of the chain configuration",
)

Functions

build
build() -> RunnableSerializable

Builds the chain configuration.

This method is responsible for building the chain configuration based on the parameters provided in the configuration.

Returns:

  • RunnableSerializable ( RunnableSerializable ) –

    The chain configuration

DBEngineSettings

Bases: IoCFactoryModel

RDBMS SQLAlchemy Engine settings

Attributes:

  • url (SecretStr) –

    SQLAlchemy connection string

Attributes

url class-attribute instance-attribute
url: SecretStr = Field(
    ...,
    exclude=True,
    title="URL",
    description="SQLAlchemy connection string",
)

EmbeddingFunctionSettings

Bases: IoCFactoryModel

Reference to embeddings model endpoint URL

Attributes:

  • volatile (str) –

    Volatile flag, defaults to ‘yes’

  • api_key (SecretStr) –

    Embeddings endpoint API key

Attributes

api_key class-attribute instance-attribute
api_key: SecretStr = Field(
    default_factory=lambda: SecretStr(""),
    exclude=True,
    description="Embeddings endpoint API key",
)
volatile class-attribute instance-attribute
volatile: str = Field(default='yes', exclude=True)

LowLevelAPIClient

Bases: IoCFactoryModel

Generated low-level API client factory settings

Attributes:

Attributes

configuration class-attribute instance-attribute
configuration: LowLevelAPIClientConfiguration = Field(
    ..., description=__doc__
)

LowLevelAPIClientConfiguration

Bases: IoCFactoryModel

Low-level client configuration Eleanor backend API client configuration settings

Attributes:

  • api_key (SecretStr) –

    Endpoint API key

Attributes

api_key class-attribute instance-attribute
api_key: SecretStr = Field(
    default_factory=lambda: SecretStr(""),
    exclude=True,
    description="Endpoint API key",
)

MonkeyPatchOperation

Bases: BaseModel

Monkeypatch operation record.

Attributes:

  • target (str) –

    Full path to the target method or function

  • patch (str) –

    Full path to the patch method or function

Attributes

patch class-attribute instance-attribute
patch: str = Field(
    ...,
    title="Patch Path",
    description="Full path to the patch method or function (e.g., 'module.patch_function').",
)
target class-attribute instance-attribute
target: str = Field(
    ...,
    title="Target Path",
    description="Full path to the target method or function (e.g., 'module.Class.method').",
)

Functions

validate_dotted_path classmethod
validate_dotted_path(v: str) -> str

Ensure the value is in the correct dotted path format.

MonkeyPatchSettingsRecord

Bases: BaseModel

Monkeypatch settings record.

Attributes:

  • name (str) –

    Short name of the monkeypatch

  • description (str) –

    Detailed description of monkeypatch

  • references (List[str]) –

    List of references to external documentation or Github issues relevant to the patch

  • apply (bool) –

    Flag that determines if the monkeypatch is applied when the framework starts

  • operations (List[MonkeyPatchOperation]) –

    List of monkeypatch

Attributes

apply class-attribute instance-attribute
apply: bool = Field(
    default=True,
    title="Apply",
    description="Flag that determines if the monkeypatch is applied when the framework starts.",
)
description class-attribute instance-attribute
description: str = Field(
    default="",
    title="Description",
    description="Detailed description of monkeypatch, best practice is to include rationale and context that necessitate the patch.",
)
name class-attribute instance-attribute
name: str = Field(
    ...,
    title="Name",
    description="Short name of the monkeypatch.",
)
operations class-attribute instance-attribute
operations: List[MonkeyPatchOperation] = Field(
    ...,
    title="Operations",
    description="List of monkeypatch operations.",
)
references class-attribute instance-attribute
references: List[str] = Field(
    default_factory=list,
    title="References",
    description="List of references to external documentation or Github issues relevant to the patch.",
)

VectorStoreSettings

Bases: IoCFactoryModel

Vector store IoC factory settings

Attributes:

Attributes

embedding_function class-attribute instance-attribute
embedding_function: EmbeddingFunctionSettings = Field(
    ..., description=__doc__
)

VectorTokenizer

Bases: BaseModel

Tokenizer used for context string pre-processing prior to sending to a vector store’s embeddings function.

Attributes:

  • max_length (int) –

    Maximum input length of the target embedding

  • factory (IoCFactoryModel) –

    Vector tokenizer IoC factory, an instance is created on model load.

Attributes

factory class-attribute instance-attribute
factory: IoCFactoryModel = Field(
    ...,
    title="Tokenizer Factory",
    description="Vector tokenizer IoC factory, an instance is created on model load.",
)
max_length class-attribute instance-attribute
max_length: int = Field(
    ...,
    title="Max Length",
    description="Maximum input length of the target embedding",
)
model_config class-attribute instance-attribute
model_config = ConfigDict(arbitrary_types_allowed=True)
tokenizer class-attribute instance-attribute
tokenizer: SkipJsonSchema[BaseTokenizer] = Field(
    None,
    title="Vector Tokenizer Instance (volatile)",
    description="Vector tokenizer instance.",
    frozen=False,
    exclude=True,
    validate_default=False,
)

Functions

validate_env
validate_env() -> VectorTokenizer