Skip to content

gerd.models.gen

Models for the generation and chat service.

Classes:

Name Description
GenerationConfig

Configuration for the generation services.

GenerationFeaturesConfig

Configuration for the generation-specific features.

GenerationConfig

Bases: BaseSettings

Configuration for the generation services.

A configuration can be used for the [GenerationService][gerd.services.generation.GenerationService] or the [ChatService][gerd.services.chat.ChatService]. Both support to generate text based on a prompt.

Methods:

Name Description
settings_customise_sources

Customize the settings sources used by pydantic-settings.

Attributes:

Name Type Description
features GenerationFeaturesConfig

The extra features to be used for the generation service.

model ModelConfig

The model to be used for the generation service.

features class-attribute instance-attribute

features: GenerationFeaturesConfig = GenerationFeaturesConfig()

The extra features to be used for the generation service.

model class-attribute instance-attribute

model: ModelConfig = ModelConfig()

The model to be used for the generation service.

settings_customise_sources classmethod

settings_customise_sources(_: Type[BaseSettings], init_settings: PydanticBaseSettingsSource, env_settings: PydanticBaseSettingsSource, dotenv_settings: PydanticBaseSettingsSource, file_secret_settings: PydanticBaseSettingsSource) -> Tuple[PydanticBaseSettingsSource, ...]

Customize the settings sources used by pydantic-settings.

The order of the sources is important. The first source has the highest priority.

Parameters:

Name Type Description Default

cls

The class of the settings.

required

init_settings

PydanticBaseSettingsSource

The settings from the initialization.

required

env_settings

PydanticBaseSettingsSource

The settings from the environment.

required

dotenv_settings

PydanticBaseSettingsSource

The settings from the dotenv file.

required

file_secret_settings

PydanticBaseSettingsSource

The settings from the secret file.

required

Returns:

Type Description
Tuple[PydanticBaseSettingsSource, ...]

The customized settings sources.

Source code in gerd/models/gen.py
@classmethod
def settings_customise_sources(
    cls,
    _: Type[BaseSettings],
    init_settings: PydanticBaseSettingsSource,
    env_settings: PydanticBaseSettingsSource,
    dotenv_settings: PydanticBaseSettingsSource,
    file_secret_settings: PydanticBaseSettingsSource,
) -> Tuple[PydanticBaseSettingsSource, ...]:
    """Customize the settings sources used by pydantic-settings.

    The order of the sources is important.
    The first source has the highest priority.

    Parameters:
        cls: The class of the settings.
        init_settings: The settings from the initialization.
        env_settings: The settings from the environment.
        dotenv_settings: The settings from the dotenv file.
        file_secret_settings: The settings from the secret file.

    Returns:
        The customized settings sources.
    """
    return (
        file_secret_settings,
        env_settings,
        dotenv_settings,
        init_settings,
    )

GenerationFeaturesConfig

Bases: BaseModel

Configuration for the generation-specific features.

Attributes:

Name Type Description
prompt_chaining PromptChainingConfig | None

Configuration for prompt chaining.

prompt_chaining class-attribute instance-attribute

prompt_chaining: PromptChainingConfig | None = None

Configuration for prompt chaining.