Classes
CLASS Hallucination
Hallucination data as returned by the model output parser.
Attributes:
hallucination_id: Unique identifier for the hallucination entry.risk: Risk level of the hallucination, e.g."low"or"high".reasoning: Optional model-provided reasoning for why this sentence was flagged.response_text: The portion of the response text that is flagged.response_begin: Start character offset ofresponse_textwithin the full response string.response_end: End character offset (exclusive) ofresponse_textwithin the full response string.
CLASS Citation
Citation data as returned by the model output parser.
Attributes:
citation_id: Unique identifier assigned to this citation.doc_id: Identifier of the source document being cited.context_text: Verbatim text from the source document that is cited.context_begin: Start character offset ofcontext_textwithin the source document.context_end: End character offset (exclusive) ofcontext_textwithin the source document.response_text: The portion of the response text that makes this citation.response_begin: Start character offset ofresponse_textwithin the response string.response_end: End character offset (exclusive) ofresponse_textwithin the response string.
CLASS Granite3Controls
Control flags for Granite 3.x model output behaviour.
Specifies which optional output features the model should produce, such as
inline citations, hallucination risk annotations, response length constraints,
and originality style.
Attributes:
citations: WhenTrue, instructs the model to annotate factual claims with inline citation markers.hallucinations: WhenTrue, instructs the model to append a list of sentences that may be hallucinated.length: Requested response length; must be"short","long", orNonefor no constraint.originality: Requested response originality style; must be"extractive","abstractive", orNone.
CLASS Granite3Kwargs
Chat template keyword arguments specific to IBM Granite 3.x models.
Extends :class:ChatTemplateKwargs with Granite 3-specific options for
output control flags and chain-of-thought (thinking) mode.
Attributes:
controls: Optional output control flags that enable or configure citations, hallucination detection, response length, and originality style.thinking: WhenTrue, enables chain-of-thought reasoning mode. Defaults toFalse.
CLASS Granite3ChatCompletion
Class that represents the inputs common to IBM Granite 3.x models.
Class that represents the inputs that are common to models of the IBM Granite 3.x
family.
Methods:
FUNC controls
- The controls record from the chat template kwargs,
or an empty :class:
Granite3Controlsif none were specified.
FUNC thinking
Trueif thethinkingflag is set in the chat template kwargs;Falseotherwise.
CLASS Granite3AssistantMessage
An assistant message with Granite 3 specific fields.
Attributes:
reasoning_content: Optional chain-of-thought reasoning text produced before the final response.citations: Optional list of citations parsed from the model output.documents: Optional list of documents referenced in the model output.hallucinations: Optional list of hallucination annotations parsed from the model output.stop_reason: Optional reason the model stopped generating.