pip install "mellea[hf]", a GPU or Apple Silicon Mac recommended for
acceptable inference speed. All intrinsics require a LocalHFBackend with a
Granite model.
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 requireSet up the backend once and reuse it across intrinsic calls:LocalHFBackendwith an IBM Granite model (e.g.,ibm-granite/granite-4.0-micro). They do not work with Ollama, OpenAI, or other remote backends.
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 andGraniteCommonAdapterdirectly.
Intrinsic component loads aLoRA adapters (falling back to LoRA) by task name.
Output format is task-specific — requirement_check returns a likelihood score.