requestLLMStructured
inline suspend fun <T> AIAgentFunctionalContext.requestLLMStructured(message: String, examples: List<T> = emptyList(), fixingParser: StructureFixingParser? = null): Result<StructuredResponse<T>>(source)
Sends a message to a Large Language Model (LLM) and requests structured data from the LLM with error correction capabilities. The message becomes part of the current prompt, and the LLM's response is processed to extract structured data.
Return
Result containing the structured response if successful, or an error if parsing failed.
Parameters
message
The content of the message to be sent to the LLM.
structure
Definition of expected output format and parsing logic.
retries
Number of retry attempts for failed generations.
fixingModel
LLM used for error correction.