Skip to content

ImportModelConfig

Base classes

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

⋔ Inheritance diagram

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

🛈 DocStrings

Bases: BaseModelConfig

Configuration for importing external models.

Source code in src/llmling_models_config/configs.py
class ImportModelConfig(BaseModelConfig):
    """Configuration for importing external models."""

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

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

    model: ImportString[Any] = Field(
        examples=["my_models.CustomModel"],
        title="Model import path",
    )
    """Import path to the model class or function."""

    kw_args: dict[str, str] = Field(default_factory=dict, title="Model arguments")
    """Keyword arguments to pass to the imported model."""

    def get_model(self) -> Any:
        return self.model(**self.kw_args) if isinstance(self.model, type) else self.model

kw_args class-attribute instance-attribute

kw_args: dict[str, str] = Field(default_factory=dict, title='Model arguments')

Keyword arguments to pass to the imported model.

model class-attribute instance-attribute

model: ImportString[Any] = Field(examples=['my_models.CustomModel'], title='Model import path')

Import path to the model class or function.

type class-attribute instance-attribute

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

Type identifier for import model.

:fa-brands-github: Show source on GitHub