requestLLMStructured

open suspend override fun <T> requestLLMStructured(structure: StructuredData<T>, retries: Int, fixingModel: LLModel): Result<StructuredResponse<T>>(source)

Requests an LLM (Language Model) to generate a structured output based on the provided structure. The response is post-processed to update the prompt with the raw response.

Return

A structured response containing both the parsed structure and the raw response text.

Parameters

structure

The structured data definition specifying the expected structured output format, schema, and parsing logic.

retries

The number of retry attempts to allow in case of generation failures.

fixingModel

The language model to use for re-parsing or error correction during retries.