Classes
CLASS Granite32InputProcessor
Input processor for version 3.2 of the main Granite models, all sizes.
This input processor is based on the Jinja template that was used during
supervised fine tuning of these models. This template is as follows:
FUNC sanitize
chat_completion: The chat completion request to sanitize.parts: Which parts of the chat completion to sanitize; defaults to"all".
- The sanitized chat completion with all Granite 3.2 special tokens
- removed from the specified parts.
FUNC transform
chat_completion: The structured chat completion request to convert into a tokenizer-ready prompt string.add_generation_prompt: WhenTrue, appends the assistant role header to the end of the prompt to trigger generation. Defaults toTrue.
- The prompt string formatted for the Granite 3.2 model tokenizer.
ValueError: If conflicting options are specified, such as enablingthinkingmode together with documents, tools, or a custom system message; or enablingcitationsorhallucinationswith a custom system message.