Skip to main content
Parser which receives Granite 3.3 model output and returns the constituents of the output. The output from the lowest level of the parser is a dictionary as follows:
  • “citations”: List of citations
  • “docs”: List of document references
  • “hallucinations”: List of hallucinations
  • “response”: Model response text without the above constituents
This dict is further refined into dataclasses before being returned as an extended AssistantMessage.

Classes

CLASS Granite33OutputProcessor

Output processor for version 3.3 of the main Granite models, all sizes.
Methods:

FUNC transform

transform(self, model_output: str, chat_completion: ChatCompletion | None = None) -> AssistantMessage
Parse Granite 3.3 model output into a structured assistant message. Args:
  • model_output: Raw text output from the Granite 3.3 model.
  • chat_completion: The original chat completion request that produced model_output. Used to determine which output features (thinking, tools, citations, hallucinations) to parse. Defaults to None.
Returns:
  • A :class:Granite3AssistantMessage containing the parsed response text, optional tool calls, chain-of-thought reasoning, citations, documents, and hallucination annotations.
Raises:
  • ValueError: If parsing citations, documents, or hallucinations from the model output fails.