Skip to content

CustomToolsetConfig

Base classes

Name Children Inherits
BaseToolsetConfig
llmling.config.models
Base configuration for toolsets.

⋔ Inheritance diagram

graph TD
  3080415092["models.CustomToolsetConfig"]
  376452731["models.BaseToolsetConfig"]
  2455074328["base.ConfigModel"]
  330168112["schema.Schema"]
  3879467795["main.BaseModel"]
  2751680898["builtins.object"]
  376452731 --> 3080415092
  2455074328 --> 376452731
  330168112 --> 2455074328
  3879467795 --> 330168112
  2751680898 --> 3879467795

🛈 DocStrings

Bases: BaseToolsetConfig

Configuration for custom toolsets.

Source code in src/llmling/config/models.py
class CustomToolsetConfig(BaseToolsetConfig):
    """Configuration for custom toolsets."""

    type: Literal["custom"] = Field("custom", init=False)
    """Discriminator field identifying this as a custom toolset."""

    import_path: str = Field(...)
    """Dotted import path to the custom toolset implementation class."""

    @field_validator("import_path", mode="after")
    @classmethod
    def validate_import_path(cls, v: str) -> str:
        from llmling.tools.toolsets import ToolSet

        # v is already confirmed to be a str here
        try:
            cls = import_class(v)
            if not issubclass(cls, ToolSet):
                msg = f"{v} must be a ToolSet class"
                raise ValueError(msg)  # noqa: TRY004, TRY301
        except Exception as exc:
            msg = f"Invalid toolset class: {v}"
            raise ValueError(msg) from exc
        return v

import_path class-attribute instance-attribute

import_path: str = Field(...)

Dotted import path to the custom toolset implementation class.

type class-attribute instance-attribute

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

Discriminator field identifying this as a custom toolset.

:fa-brands-github: Show source on GitHub