Skip to content

TestModelConfig

Base classes

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

⋔ Inheritance diagram

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

🛈 DocStrings

Bases: BaseModelConfig

Configuration for test models.

Source code in src/llmling_models_config/configs.py
class TestModelConfig(BaseModelConfig):
    """Configuration for test models."""

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

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

    custom_output_text: str | None = Field(
        default=None,
        examples=["Test response", "Mock output for testing"],
        title="Custom output text",
    )
    """Optional custom text to return from the test model."""

    call_tools: list[str] | Literal["all"] = Field(
        default="all",
        examples=["all", ["tool1", "tool2"]],
        title="Available tools",
    )
    """Tools that can be called by the test model."""

    tool_args: dict[str, dict[str, Any]] | None = Field(
        default=None,
        examples=[{"read": {"path": "/test/file.txt"}}],
        title="Fixed tool arguments",
    )
    """Optional mapping of tool_name -> args to use instead of generated args."""

    seed: int = Field(default=0, title="Random seed")
    """Seed for generating random tool arguments (when tool_args not specified)."""

    def get_model(self) -> Any:
        if self.tool_args:
            from llmling_models.models.test_model import FixedArgsTestModel

            return FixedArgsTestModel(
                tool_args=self.tool_args,
                custom_output_text=self.custom_output_text,
                call_tools=self.call_tools,
                seed=self.seed,
            )
        from pydantic_ai.models.test import TestModel

        return TestModel(
            custom_output_text=self.custom_output_text,
            call_tools=self.call_tools,
            seed=self.seed,
        )

call_tools class-attribute instance-attribute

call_tools: list[str] | Literal["all"] = Field(
    default="all", examples=["all", ["tool1", "tool2"]], title="Available tools"
)

Tools that can be called by the test model.

custom_output_text class-attribute instance-attribute

custom_output_text: str | None = Field(
    default=None, examples=["Test response", "Mock output for testing"], title="Custom output text"
)

Optional custom text to return from the test model.

seed class-attribute instance-attribute

seed: int = Field(default=0, title='Random seed')

Seed for generating random tool arguments (when tool_args not specified).

tool_args class-attribute instance-attribute

tool_args: dict[str, dict[str, Any]] | None = Field(
    default=None, examples=[{"read": {"path": "/test/file.txt"}}], title="Fixed tool arguments"
)

Optional mapping of tool_name -> args to use instead of generated args.

type class-attribute instance-attribute

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

Type identifier for test model.

:fa-brands-github: Show source on GitHub