Skip to content

LoaderContext

Base classes

Name Children Inherits
Generic
typing
Abstract base class for generic types.

⋔ Inheritance diagram

graph TD
  2864194550["base.LoaderContext"]
  3481597255["typing.Generic"]
  2751680898["builtins.object"]
  3481597255 --> 2864194550
  2751680898 --> 3481597255

🛈 DocStrings

Context for resource loading.

Provides all information needed to load and identify a resource.

Source code in src/llmling/resources/base.py
@dataclass
class LoaderContext[TResource: BaseResource]:
    """Context for resource loading.

    Provides all information needed to load and identify a resource.
    """

    resource: TResource
    name: str

    def __repr__(self) -> str:
        """Show context details."""
        # Cast to Protocol to make type checker happy
        resource = cast(BaseResource, self.resource)
        cls_name = self.__class__.__name__
        return f"{cls_name}(name={self.name!r}, type={resource.type})"

__repr__

__repr__() -> str

Show context details.

Source code in src/llmling/resources/base.py
def __repr__(self) -> str:
    """Show context details."""
    # Cast to Protocol to make type checker happy
    resource = cast(BaseResource, self.resource)
    cls_name = self.__class__.__name__
    return f"{cls_name}(name={self.name!r}, type={resource.type})"

:fa-brands-github: Show source on GitHub