ThinkingPromptRunnerOperations

User-facing interface for executing prompts with thinking block extraction.

This interface provides thinking-aware versions of standard prompt operations, returning both the converted results and the reasoning content that LLMs generated during their processing.

Usage

Access this interface through the withThinking() extension:

val result = promptRunner.withThinking().createObject("analyze this", Person::class.java)
val person = result.result // The converted Person object
val thinking = result.thinkingBlocks // List of reasoning blocks

Thinking Block Extraction

This interface automatically extracts thinking content in various formats:

  • Tagged thinking: <think>reasoning here</think>, <analysis>content</analysis>

  • Prefix thinking: //THINKING: reasoning here

  • Untagged thinking: raw text content before JSON objects

Relationship to Regular Operations

Unlike com.embabel.agent.api.common.PromptRunnerOperations which returns direct objects, all methods in this interface return ThinkingResponse wrappers that provide access to both results and reasoning.

See also

for standard operations

for the response wrapper

com.embabel.common.core.thinking.ThinkingBlock

for thinking content details

Functions

Link copied to clipboard
open fun <T> createObject(content: MultimodalContent, outputClass: Class<T>): ThinkingResponse<T>

Create an object from multimodal content with thinking block extraction.

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

Create an object of the given type with thinking block extraction.

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

Create an object from messages with thinking block extraction.

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

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

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

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

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

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

Link copied to clipboard
abstract fun evaluateCondition(condition: String, context: String, confidenceThreshold: <Error class: unknown class> = 0.8): ThinkingResponse<Boolean>

Evaluate a condition with thinking block extraction.

Link copied to clipboard

Generate text from multimodal content with thinking block extraction.

open infix fun generateText(prompt: String): ThinkingResponse<String>

Generate text with thinking block extraction.

Link copied to clipboard

Respond in a conversation with multimodal content and thinking block extraction.

Respond in a conversation with thinking block extraction.