mellea.stdlib.components.intrinsic.intrinsic
Intrinsic component for invoking fine-tuned adapter capabilities.
An Intrinsic component references a named adapter from Mellea's intrinsic catalog
and transforms a chat completion request — typically by injecting new messages,
modifying model parameters, or applying structured output constraints. It must be
paired with a backend that supports adapter loading (e.g. LocalHFBackend with an
attached IntrinsicAdapter).
Classes
CLASS Intrinsic
A component representing an intrinsic fine-tuned adapter capability.
Intrinsics transform a chat completion request by injecting messages, modifying model parameters, or applying structured output constraints. Must be paired with a backend that supports adapter loading.
Args:
intrinsic_name: The user-visible name of the intrinsic; must match a known name in Mellea's intrinsics catalog.intrinsic_kwargs: Optional keyword arguments required by the intrinsic at invocation time.
Attributes:
metadata: The intrinsic metadata fetched from the catalog.intrinsic_kwargs: Keyword arguments passed to the intrinsic.intrinsic_name: User-visible name of this intrinsic (property).adapter_types: Available adapter types that implement this intrinsic (property). Defaults to values in self.metadata.
Methods:
FUNC intrinsic_name
intrinsic_name(self)
User-visible name of this intrinsic.
FUNC adapter_types
adapter_types(self) -> tuple[AdapterType, ...]
Tuple of available adapter types that implement this intrinsic.
FUNC parts
parts(self) -> list[Component | CBlock]
Return the constituent parts of this intrinsic component.
Will need to be implemented by subclasses since not all intrinsics produce text or message output.
Returns:
- list[Component | CBlock]: Always an empty list for the base class.
FUNC format_for_llm
format_for_llm(self) -> TemplateRepresentation | str
Not implemented for the base Intrinsic class.
Intrinsic components are intended to be used as the action passed
directly to the backend, not as a part of the context rendered by the
formatter.
Returns:
- TemplateRepresentation | str: Never returns; always raises.
Raises:
NotImplementedError: Always, becauseIntrinsicdoes not implementformat_for_llmby default.