requestLLMStructured

Sends a request to LLM and gets a structured response.

Parameters

config

A configuration defining structures and behavior.


suspend fun <T> requestLLMStructured(serializer: KSerializer<T>, examples: List<T> = emptyList(), fixingParser: StructureFixingParser? = null): Result<StructuredResponse<T>>(source)

Sends a request to LLM and gets a structured response.

Parameters

serializer

Serializer for the requested structure type.

examples

Optional examples that help the model follow the target format.

fixingParser

Optional parser for malformed structured responses.


inline suspend fun <T> requestLLMStructured(examples: List<T> = emptyList(), fixingParser: StructureFixingParser? = null): Result<StructuredResponse<T>>(source)

Requests a structured response from the language model using a reified serializer.

Parameters

examples

Optional examples that help the model follow the target format.

fixingParser

Optional parser for malformed structured responses.