Skip to content

toolsets

Class info

Classes

Name Children Inherits
BaseToolsetConfig
llmling_agent.models.toolsets
Base configuration for toolsets.
CustomToolsetConfig
llmling_agent.models.toolsets
Configuration for custom toolsets.
    EntryPointToolsetConfig
    llmling_agent.models.toolsets
    Configuration for entry point toolsets.
      OpenAPIToolsetConfig
      llmling_agent.models.toolsets
      Configuration for OpenAPI toolsets.
        ResourceProvider
        llmling_agent.resource_providers.base
        Base class for resource providers.

        🛈 DocStrings

        Models for tools.

        BaseToolsetConfig

        Bases: ConfigModel

        Base configuration for toolsets.

        Source code in src/llmling_agent/models/toolsets.py
        15
        16
        17
        18
        19
        class BaseToolsetConfig(ConfigModel):
            """Base configuration for toolsets."""
        
            namespace: str | None = Field(default=None)
            """Optional namespace prefix for tool names"""
        

        namespace class-attribute instance-attribute

        namespace: str | None = Field(default=None)
        

        Optional namespace prefix for tool names

        CustomToolsetConfig

        Bases: BaseToolsetConfig

        Configuration for custom toolsets.

        Source code in src/llmling_agent/models/toolsets.py
        57
        58
        59
        60
        61
        62
        63
        64
        65
        66
        67
        68
        69
        70
        71
        72
        73
        74
        75
        76
        77
        78
        79
        80
        81
        82
        83
        84
        85
        86
        87
        88
        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:
                # 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
        
            def get_provider(self) -> ResourceProvider:
                """Create custom provider from import path."""
                from llmling.utils.importing import import_class
        
                provider_cls = import_class(self.import_path)
                if not issubclass(provider_cls, ResourceProvider):
                    msg = f"{self.import_path} must be a ResourceProvider subclass"
                    raise ValueError(msg)  # noqa: TRY004
                return provider_cls(name=provider_cls.__name__)
        

        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.

        get_provider

        get_provider() -> ResourceProvider
        

        Create custom provider from import path.

        Source code in src/llmling_agent/models/toolsets.py
        80
        81
        82
        83
        84
        85
        86
        87
        88
        def get_provider(self) -> ResourceProvider:
            """Create custom provider from import path."""
            from llmling.utils.importing import import_class
        
            provider_cls = import_class(self.import_path)
            if not issubclass(provider_cls, ResourceProvider):
                msg = f"{self.import_path} must be a ResourceProvider subclass"
                raise ValueError(msg)  # noqa: TRY004
            return provider_cls(name=provider_cls.__name__)
        

        EntryPointToolsetConfig

        Bases: BaseToolsetConfig

        Configuration for entry point toolsets.

        Source code in src/llmling_agent/models/toolsets.py
        41
        42
        43
        44
        45
        46
        47
        48
        49
        50
        51
        52
        53
        54
        class EntryPointToolsetConfig(BaseToolsetConfig):
            """Configuration for entry point toolsets."""
        
            type: Literal["entry_points"] = Field("entry_points", init=False)
            """Discriminator field identifying this as an entry point toolset."""
        
            module: str = Field(..., description="Python module path")
            """Python module path to load tools from via entry points."""
        
            def get_provider(self) -> ResourceProvider:
                """Create entry point tools provider from this config."""
                from llmling_agent_toolsets.entry_points import EntryPointTools
        
                return EntryPointTools(module=self.module)
        

        module class-attribute instance-attribute

        module: str = Field(..., description='Python module path')
        

        Python module path to load tools from via entry points.

        type class-attribute instance-attribute

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

        Discriminator field identifying this as an entry point toolset.

        get_provider

        get_provider() -> ResourceProvider
        

        Create entry point tools provider from this config.

        Source code in src/llmling_agent/models/toolsets.py
        50
        51
        52
        53
        54
        def get_provider(self) -> ResourceProvider:
            """Create entry point tools provider from this config."""
            from llmling_agent_toolsets.entry_points import EntryPointTools
        
            return EntryPointTools(module=self.module)
        

        OpenAPIToolsetConfig

        Bases: BaseToolsetConfig

        Configuration for OpenAPI toolsets.

        Source code in src/llmling_agent/models/toolsets.py
        22
        23
        24
        25
        26
        27
        28
        29
        30
        31
        32
        33
        34
        35
        36
        37
        38
        class OpenAPIToolsetConfig(BaseToolsetConfig):
            """Configuration for OpenAPI toolsets."""
        
            type: Literal["openapi"] = Field("openapi", init=False)
            """Discriminator field identifying this as an OpenAPI toolset."""
        
            spec: str = Field(...)
            """URL or path to the OpenAPI specification document."""
        
            base_url: str | None = Field(default=None)
            """Optional base URL for API requests, overrides the one in spec."""
        
            def get_provider(self) -> ResourceProvider:
                """Create OpenAPI tools provider from this config."""
                from llmling_agent_toolsets.openapi import OpenAPITools
        
                return OpenAPITools(spec=self.spec, base_url=self.base_url or "")
        

        base_url class-attribute instance-attribute

        base_url: str | None = Field(default=None)
        

        Optional base URL for API requests, overrides the one in spec.

        spec class-attribute instance-attribute

        spec: str = Field(...)
        

        URL or path to the OpenAPI specification document.

        type class-attribute instance-attribute

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

        Discriminator field identifying this as an OpenAPI toolset.

        get_provider

        get_provider() -> ResourceProvider
        

        Create OpenAPI tools provider from this config.

        Source code in src/llmling_agent/models/toolsets.py
        34
        35
        36
        37
        38
        def get_provider(self) -> ResourceProvider:
            """Create OpenAPI tools provider from this config."""
            from llmling_agent_toolsets.openapi import OpenAPITools
        
            return OpenAPITools(spec=self.spec, base_url=self.base_url or "")