createObjectIfPossible

open fun <T> createObjectIfPossible(prompt: String, outputClass: Class<T>): ThinkingResponse<T?>

Try to create an object of the given type with thinking block extraction.

Similar to createObject but designed for scenarios where the conversion might fail. Returns thinking blocks even when object creation fails.

Return

Response with potentially null result but always available thinking blocks

Parameters

T

The type of object to create

prompt

The text prompt to send to the LLM

outputClass

The class of the object to create


abstract fun <T> createObjectIfPossible(messages: List<Message>, outputClass: Class<T>): ThinkingResponse<T?>

Try to create an object from messages with thinking block extraction.

Return

Response with potentially null result but always available thinking blocks

Parameters

T

The type of object to create

messages

The conversation messages to send to the LLM

outputClass

The class of the object to create


open fun <T> createObjectIfPossible(content: MultimodalContent, outputClass: Class<T>): ThinkingResponse<T?>

Try to create an object from multimodal content with thinking block extraction.

Return

Response with potentially null result but always available thinking blocks

Parameters

T

The type of object to create

content

The multimodal content (text + images) to send to the LLM

outputClass

The class of the object to create