Skip to content

base_provider

Class info

Classes

Name Children Inherits
BaseProvider
llmling_agent.base_provider
Base class for all providers.

    🛈 DocStrings

    Base classes for providers.

    BaseProvider

    Base class for all providers.

    Source code in src/llmling_agent/base_provider.py
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    class BaseProvider[ConfigT]:
        """Base class for all providers."""
    
        def __init__(self, config: ConfigT) -> None:
            """Initialize provider with configuration."""
            self.config = config
    
        @classmethod
        @abstractmethod
        def from_kwargs(cls, **kwargs: Any) -> Self:
            """Alternative constructor with explicit parameters."""
            raise NotImplementedError
    
        def __repr__(self) -> str:
            """Return string representation of provider with non-default config values."""
            non_defaults = self.config.model_dump(exclude_defaults=True)  # type: ignore[attr-defined]
            fields_str = ", ".join(f"{k}={v!r}" for k, v in non_defaults.items())
            return f"{self.__class__.__name__}({fields_str})"
    

    __init__

    __init__(config: ConfigT) -> None
    

    Initialize provider with configuration.

    Source code in src/llmling_agent/base_provider.py
    17
    18
    19
    def __init__(self, config: ConfigT) -> None:
        """Initialize provider with configuration."""
        self.config = config
    

    __repr__

    __repr__() -> str
    

    Return string representation of provider with non-default config values.

    Source code in src/llmling_agent/base_provider.py
    27
    28
    29
    30
    31
    def __repr__(self) -> str:
        """Return string representation of provider with non-default config values."""
        non_defaults = self.config.model_dump(exclude_defaults=True)  # type: ignore[attr-defined]
        fields_str = ", ".join(f"{k}={v!r}" for k, v in non_defaults.items())
        return f"{self.__class__.__name__}({fields_str})"
    

    from_kwargs abstractmethod classmethod

    from_kwargs(**kwargs: Any) -> Self
    

    Alternative constructor with explicit parameters.

    Source code in src/llmling_agent/base_provider.py
    21
    22
    23
    24
    25
    @classmethod
    @abstractmethod
    def from_kwargs(cls, **kwargs: Any) -> Self:
        """Alternative constructor with explicit parameters."""
        raise NotImplementedError