mod ir_builder#

module ir_builder#

AnnotatedLlmRequest to PromptIR construction pipeline.

Functions

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 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.