Skip to content

UserSelectModelConfig

Base classes

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

⋔ Inheritance diagram

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

🛈 DocStrings

Bases: BaseModelConfig

Configuration for interactive model selection.

Source code in src/llmling_models_config/configs.py
class UserSelectModelConfig(BaseModelConfig):
    """Configuration for interactive model selection."""

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

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

    models: list[ModelId | str | BaseModelConfig] = Field(
        min_length=1,
        title="Selectable models",
        examples=[["openai:gpt-5-nano", "anthropic:claude-sonnet-4-5"]],
    )
    """List of models the user can choose from."""

    prompt_template: str = Field(
        default="🤖 Choose a model for: {prompt}",
        examples=["🤖 Choose a model for: {prompt}", "Select model for: {prompt}"],
        title="Selection prompt template",
    )
    """Template for displaying the choice prompt to the user."""

    show_system: bool = Field(default=True, title="Show system messages")
    """Whether to show system messages during selection."""

    input_prompt: str = Field(
        default="Enter model number (0-{max}): ",
        examples=["Enter model number (0-{max}): ", "Choose (0-{max}): "],
        title="Selection input prompt",
    )
    """Text displayed when requesting model selection."""

    handler: ImportString[Any] = Field(
        default="llmling_models:DefaultInputHandler",
        validate_default=True,
        title="Selection handler",
    )
    """Handler for processing user selection input."""

    def get_model(self) -> Any:
        from llmling_models.models import UserSelectModel

        converted_models = [_build_model(m) for m in self.models]
        return UserSelectModel(
            models=converted_models,
            prompt_template=self.prompt_template,
            show_system=self.show_system,
            input_prompt=self.input_prompt,
            handler=self.handler,
        )

handler class-attribute instance-attribute

handler: ImportString[Any] = Field(
    default="llmling_models:DefaultInputHandler", validate_default=True, title="Selection handler"
)

Handler for processing user selection input.

input_prompt class-attribute instance-attribute

input_prompt: str = Field(
    default="Enter model number (0-{max}): ",
    examples=["Enter model number (0-{max}): ", "Choose (0-{max}): "],
    title="Selection input prompt",
)

Text displayed when requesting model selection.

models class-attribute instance-attribute

models: list[ModelId | str | BaseModelConfig] = Field(
    min_length=1,
    title="Selectable models",
    examples=[["openai:gpt-5-nano", "anthropic:claude-sonnet-4-5"]],
)

List of models the user can choose from.

prompt_template class-attribute instance-attribute

prompt_template: str = Field(
    default="🤖 Choose a model for: {prompt}",
    examples=["🤖 Choose a model for: {prompt}", "Select model for: {prompt}"],
    title="Selection prompt template",
)

Template for displaying the choice prompt to the user.

show_system class-attribute instance-attribute

show_system: bool = Field(default=True, title='Show system messages')

Whether to show system messages during selection.

type class-attribute instance-attribute

type: Literal['user-select'] = Field(default='user-select', init=False)

Type identifier for user-select model.

:fa-brands-github: Show source on GitHub