Interface PromptRunner.Thinking

  • All Implemented Interfaces:
    com.embabel.common.core.thinking.ThinkingCapability

    
    public interface PromptRunner.Thinking
     implements ThinkingCapability
                        

    Fluent interface for operations that extract thinking blocks from LLM responses. Provides access to:

    • Creating objects or text with thinking extraction

    • Processing multimodal content with thinkingg

    Instances are obtained via PromptRunner.thinking.

    • Constructor Detail

    • Method Detail

      • generateText

         ThinkingResponse<String> generateText(String prompt)

        Generate text with thinking block extraction.

        Parameters:
        prompt - The text prompt to send to the LLM
        Returns:

        Response containing both generated text and extracted thinking blocks

      • generateText

         ThinkingResponse<String> generateText(MultimodalContent content)

        Generate text from multimodal content with thinking block extraction.

        Parameters:
        content - The multimodal content (text + images) to send to the LLM
        Returns:

        Response containing both generated text and extracted thinking blocks

      • createObject

         <T extends Any> ThinkingResponse<T> createObject(String prompt, Class<T> outputClass)

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

        Uses the given prompt and LLM options from context to generate a structured object while capturing the LLM's reasoning process.

        Parameters:
        prompt - The text prompt to send to the LLM
        outputClass - The class of the object to create
        Returns:

        Response containing both the converted object and extracted thinking blocks

      • createObject

         abstract <T extends Any> ThinkingResponse<T> createObject(List<Message> messages, Class<T> outputClass)

        Create an object from messages with thinking block extraction.

        Parameters:
        messages - The conversation messages to send to the LLM
        outputClass - The class of the object to create
        Returns:

        Response containing both the converted object and extracted thinking blocks

      • createObject

         <T extends Any> ThinkingResponse<T> createObject(MultimodalContent content, Class<T> outputClass)

        Create an object from multimodal content with thinking block extraction.

        Parameters:
        content - The multimodal content (text + images) to send to the LLM
        outputClass - The class of the object to create
        Returns:

        Response containing both the converted object and extracted thinking blocks

      • createObjectIfPossible

         <T extends Any> ThinkingResponse<T> createObjectIfPossible(String prompt, Class<T> outputClass)

        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.

        Parameters:
        prompt - The text prompt to send to the LLM
        outputClass - The class of the object to create
        Returns:

        Response with potentially null result but always available thinking blocks

      • createObjectIfPossible

         abstract <T extends Any> ThinkingResponse<T> createObjectIfPossible(List<Message> messages, Class<T> outputClass)

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

        Parameters:
        messages - The conversation messages to send to the LLM
        outputClass - The class of the object to create
        Returns:

        Response with potentially null result but always available thinking blocks

      • createObjectIfPossible

         <T extends Any> ThinkingResponse<T> createObjectIfPossible(MultimodalContent content, Class<T> outputClass)

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

        Parameters:
        content - The multimodal content (text + images) to send to the LLM
        outputClass - The class of the object to create
        Returns:

        Response with potentially null result but always available thinking blocks

      • respond

         ThinkingResponse<AssistantMessage> respond(MultimodalContent content)

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

        Parameters:
        content - The multimodal content to respond to
        Returns:

        Response containing both the assistant message and extracted thinking blocks

      • respond

         abstract ThinkingResponse<AssistantMessage> respond(List<Message> messages)

        Respond in a conversation with thinking block extraction.

        Parameters:
        messages - The conversation messages to respond to
        Returns:

        Response containing both the assistant message and extracted thinking blocks

      • evaluateCondition

         abstract ThinkingResponse<Boolean> evaluateCondition(String condition, String context, Double confidenceThreshold)

        Evaluate a condition with thinking block extraction.

        Evaluates a boolean condition using the LLM while capturing its reasoning process.

        Parameters:
        condition - The condition to evaluate
        context - The context for evaluation
        confidenceThreshold - The confidence threshold for the evaluation
        Returns:

        Response containing both the evaluation result and extracted thinking blocks