> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nemo/relay/llms.txt.
> For full documentation content, see https://docs.nvidia.com/nemo/relay/llms-full.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/nemo/relay/_mcp/server.

# Function build_prompt_ir

> Build a normalized `PromptIR` from an annotated LLM request.

Generated from `cargo doc --no-deps -p nemo-relay -p nemo-relay-adaptive -p nemo-relay-ffi`.

<pre />

Build a normalized [`PromptIR`](/reference/api/rust-library-reference/nemo-relay-adaptive/acg/prompt_ir/struct-promptir) from an annotated LLM request.

The builder preserves prompt order, inserts tool-schema blocks before the first non-system message when tools are present, and computes the request hashes needed by downstream Adaptive Cache Governor (ACG) analysis.

## Parameters

* `request`: Annotated LLM request to normalize.

## Returns

A [`Result`](/reference/api/rust-library-reference/nemo-relay-adaptive/acg/error/type-result) containing the constructed [`PromptIR`](/reference/api/rust-library-reference/nemo-relay-adaptive/acg/prompt_ir/struct-promptir).

## Errors

Returns an error when tool definitions or request components cannot be serialized into the canonical form required by the IR.