> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mellea.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# mellea.formatters.granite.granite3.granite32.output

> Parser for Granite 3.2 model output.

export const SidebarFix = () => <script dangerouslySetInnerHTML={{
  __html: `
        (function () {
          const INTERVAL_MS = 500;

          const upgradeSidebar = () => {
            const links = document.querySelectorAll('a[href^="#"]');

            links.forEach((link) => {
              if (link.dataset.badged === "true") return;

              const rawText = (link.textContent || "").trim();

              // ========== FUNC ==========
              if (rawText.startsWith("FUNC ")) {
                const label = rawText.replace(/^FUNC\\s+/, "").trim();

                while (link.firstChild) link.removeChild(link.firstChild);

                // 👉 Make the whole link a single flex row & prevent wrapping
                link.style.display = "flex";
                link.style.alignItems = "center";
                link.style.whiteSpace = "nowrap";
                link.style.columnGap = "0.5rem";

                const badge = document.createElement("span");
                badge.style.marginRight = "0.5rem";
                badge.style.display = "inline-flex";
                badge.style.alignItems = "center";
                badge.style.borderRadius = "9999px";
                badge.style.padding = "0rem 0.6rem";
                badge.style.fontSize = "0.5rem";
                badge.style.fontWeight = "700";
                badge.style.letterSpacing = "0.05em";
                badge.style.backgroundColor = "rgba(48, 100, 227, 0.20)";
                badge.style.color = "#1D4ED8";

                badge.textContent = "FUNC";

                link.appendChild(badge);
                link.appendChild(document.createTextNode(label));
                link.dataset.badged = "true";
                return;
              }

              // ========== CLASS ==========
              if (rawText.startsWith("CLASS ")) {
                const label = rawText.replace(/^CLASS\\s+/, "").trim();

                while (link.firstChild) link.removeChild(link.firstChild);

                // 👉 Same flex / nowrap treatment for class links
                link.style.display = "flex";
                link.style.alignItems = "center";
                link.style.whiteSpace = "nowrap";
                link.style.columnGap = "0.5rem";

                const badge = document.createElement("span");
                badge.style.marginRight = "0.5rem";
                badge.style.display = "inline-flex";
                badge.style.alignItems = "center";
                badge.style.borderRadius = "9999px";
                badge.style.padding = "0rem 0.6rem";
                badge.style.fontSize = "0.5rem";
                badge.style.fontWeight = "700";
                badge.style.letterSpacing = "0.05em";
                badge.style.backgroundColor = "rgba(74, 222, 128, 0.20)";
                badge.style.color = "#15803D";

                badge.textContent = "CLASS";

                link.appendChild(badge);
                link.appendChild(document.createTextNode(label));
                link.dataset.badged = "true";
                return;
              }
            });
          };

          upgradeSidebar();
          setInterval(upgradeSidebar, INTERVAL_MS);
        })();
      `
}} />;

<SidebarFix />

Parser for Granite 3.2 model output.

Parser which receives Granite 3.2 model output and returns the constituents of the
output.

The input to the parser is assumed to be as follows:

```
response_text

# Citations:
citations_text

# Hallucinations:
hallucinations_text
```

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

<div className="w-full h-px bg-gray-200 dark:bg-gray-700 my-4" />

### <span className="ml-2 inline-flex items-center rounded-full px-2 py-1 text-[0.7rem] font-bold tracking-wide bg-[#4ADE8033]/20 text-[#15803D]">CLASS</span> `Granite32OutputProcessor` <sup><a href="https://github.com/generative-computing/mellea/blob/v0.6.0/mellea/formatters/granite/granite3/granite32/output.py#L612" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

Output processor for version 3.2 of the main Granite models, all sizes.

<div className="h-8" />

**Methods:**

<div className="w-full h-px bg-gray-200 dark:bg-gray-700 my-4" />

#### <span className="ml-2 inline-flex items-center rounded-full px-2 py-1 text-[0.7rem] font-bold tracking-wide bg-[#3064E3]/20 text-[#1D4ED8]">FUNC</span> `transform` <sup><a href="https://github.com/generative-computing/mellea/blob/v0.6.0/mellea/formatters/granite/granite3/granite32/output.py#L615" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python theme={null}
transform(self, model_output: str, chat_completion: ChatCompletion | None = None) -> AssistantMessage
```

Parse Granite 3.2 model output into a structured assistant message.

**Args:**

* `model_output`: Raw text output from the Granite 3.2 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.

<div className="w-full h-px bg-gray-200 dark:bg-gray-700 my-4" />
