Function build_prompt_ir

View as Markdown

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

pub fn build_prompt_ir(request: &AnnotatedLlmRequest) -> Result<PromptIR>

Build a normalized 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 containing the constructed PromptIR.

Errors

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