Skip to main content
Intrinsic functions for core model capabilities.

Functions

FUNC check_certainty

check_certainty(context: ChatContext, backend: AdapterMixin) -> float
Estimate the model’s certainty about its last response. Intrinsic function that evaluates how certain the model is about the assistant’s response to a user’s question. The context should end with a user question followed by an assistant answer. Args:
  • context: Chat context containing user question and assistant answer.
  • backend: Backend instance that supports LoRA/aLoRA adapters.
Returns:
  • Certainty score as a float (higher = more certain).

FUNC requirement_check

requirement_check(context: ChatContext, backend: AdapterMixin, requirement: str) -> float
Detect if text adheres to provided requirements. Intrinsic function that determines if the text satisfies the given requirements. Appends an evaluation prompt to the context following the format specified by the Granite Guardian requirement checker model card. Args:
  • context: Chat context containing user question and assistant answer.
  • backend: Backend instance that supports LoRA/aLoRA adapters.
  • requirement: Set of requirements to satisfy.
Returns:
  • Score as a float between 0.0 and 1.0 (higher = more likely satisfied).