pip install "mellea[hf]" for LocalHFBackend (GPU or Apple
Silicon Mac recommended), or pip install mellea for OpenAIBackend with a
Granite Switch model served via vLLM.
Intrinsics are adapter-accelerated operations for RAG quality checks. They use
LoRA/aLoRA adapters loaded directly into the HuggingFace backend — faster and more
reliable than prompting a general-purpose model for these specialized micro-tasks.
Backend note: Intrinsics work with two backends:Set up the backend once and reuse it across intrinsic calls:Intrinsics do not work with Ollama or other remote backends.
- LocalHFBackend — loads LoRA/aLoRA adapters from the catalog at runtime. All intrinsics are available. Requires a GPU or Apple Silicon Mac.
- OpenAIBackend — uses a Granite Switch model served via vLLM with
load_embedded_adapters=True. Only intrinsics embedded in the model are available — check the model’sadapter_index.jsonfor the list. Seedocs/docs/examples/granite-switch/README.md
Answerability
Check whether a set of retrieved documents can answer a given question:Context relevance
Assess whether a document is relevant to a question:Hallucination detection
Flag sentences in an assistant response that are not grounded in the source documents:Answer relevance rewriting
Rewrite a vague or incomplete answer to be more grounded in the source documents:Query rewriting
Rewrite an ambiguous user query using conversation history to improve retrieval:Citations
Find supporting sentences in source documents for a given assistant response:Direct intrinsic usage
Advanced: For custom adapter tasks, use theIntrinsiccomponent andCustomIntrinsicAdapterdirectly.
Intrinsic component loads aLoRA adapters (falling back to LoRA) by task name.
For OpenAI backends with Granite Switch, adapters are loaded from the model’s
HuggingFace repository configuration instead of the intrinsic catalog.
Output format is task-specific — requirement-check returns a likelihood score.
Guardian Intrinsics
Safety and factuality checks use a separate set of Guardian-specific intrinsics:guardian_check(), policy_guardrails(), factuality_detection(), and
factuality_correction(). These are documented in the
Safety Guardrails how-to guide.