Skip to content

AugmentedModelConfig

Base classes

Name Children Inherits
BaseModelConfig
llmling_models_config.configs
Base for model configurations.

⋔ Inheritance diagram

graph TD
  2692251666["configs.AugmentedModelConfig"]
  3497727833["configs.BaseModelConfig"]
  330168112["schema.Schema"]
  3879467795["main.BaseModel"]
  2751680898["builtins.object"]
  3497727833 --> 2692251666
  330168112 --> 3497727833
  3879467795 --> 330168112
  2751680898 --> 3879467795

🛈 DocStrings

Bases: BaseModelConfig

Configuration for model with pre/post prompt processing.

The post-prompt is not applied when the model is streamed (only the pre-prompt is).

Source code in src/llmling_models_config/configs.py
class AugmentedModelConfig(BaseModelConfig):
    """Configuration for model with pre/post prompt processing.

    The post-prompt is not applied when the model is streamed (only the pre-prompt is).
    """

    model_config = ConfigDict(json_schema_extra={"x-doc-title": "Augmented model"})

    type: Literal["augmented"] = Field(default="augmented", init=False)
    """Type identifier for augmented model."""

    main_model: ModelId | BaseModelConfig | str = Field(
        examples=["openai:gpt-5-nano", "anthropic:claude-sonnet-4-5"],
        title="Primary model",
    )
    """The primary model identifier."""

    pre_prompt: PrePostPromptConfig | None = Field(
        default=None,
        title="Pre-processing prompt",
    )
    """Optional configuration for prompt preprocessing."""

    post_prompt: PrePostPromptConfig | None = Field(
        default=None,
        title="Post-processing prompt",
    )
    """Optional configuration for prompt postprocessing."""

    def get_model(self) -> AugmentedModel:
        from llmling_models.models.augmented import (
            AugmentedModel,
            PrePostPromptConfig as RuntimePrePostPromptConfig,
        )

        def convert(cfg: PrePostPromptConfig | None) -> RuntimePrePostPromptConfig | None:
            if cfg is None:
                return None
            return RuntimePrePostPromptConfig(text=cfg.text, model=_build_model(cfg.model))

        return AugmentedModel(
            main_model=_build_model(self.main_model),
            pre_prompt=convert(self.pre_prompt),
            post_prompt=convert(self.post_prompt),
        )

main_model class-attribute instance-attribute

main_model: ModelId | BaseModelConfig | str = Field(
    examples=["openai:gpt-5-nano", "anthropic:claude-sonnet-4-5"], title="Primary model"
)

The primary model identifier.

post_prompt class-attribute instance-attribute

post_prompt: PrePostPromptConfig | None = Field(default=None, title='Post-processing prompt')

Optional configuration for prompt postprocessing.

pre_prompt class-attribute instance-attribute

pre_prompt: PrePostPromptConfig | None = Field(default=None, title='Pre-processing prompt')

Optional configuration for prompt preprocessing.

type class-attribute instance-attribute

type: Literal['augmented'] = Field(default='augmented', init=False)

Type identifier for augmented model.

:fa-brands-github: Show source on GitHub