Class ToolLoopLlmOperations

  • All Implemented Interfaces:
    com.embabel.agent.spi.LlmOperations

    
    public class ToolLoopLlmOperations
    extends AbstractLlmOperations
                        

    LlmOperations implementation that uses Embabel's framework-agnostic tool loop.

    This class provides the core tool loop orchestration logic without depending on any specific LLM framework (Spring AI, LangChain4j, etc.). Subclasses provide the framework-specific implementations for message sending and output conversion.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      <O extends Any> O doTransform(List<Message> messages, LlmInteraction interaction, Class<O> outputClass, LlmRequestEvent<O> llmRequestEvent) Low level transform, not necessarily aware of platform
      • Methods inherited from class com.embabel.agent.spi.LlmOperations

        doTransform, generate
      • Methods inherited from class com.embabel.agent.spi.support.AbstractLlmOperations

        createObject, createObjectIfPossible
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ToolLoopLlmOperations

        ToolLoopLlmOperations(ModelProvider modelProvider, ToolDecorator toolDecorator, Validator validator, ValidationPromptGenerator validationPromptGenerator, LlmDataBindingProperties dataBindingProperties, AutoLlmSelectionCriteriaResolver autoLlmSelectionCriteriaResolver, LlmOperationsPromptsProperties promptsProperties, ObjectMapper objectMapper, ObservationRegistry observationRegistry)
        Parameters:
        modelProvider - ModelProvider to get the LLM model
        toolDecorator - ToolDecorator to decorate tools
        validator - Validator for bean validation
        validationPromptGenerator - Generator for validation prompts
        dataBindingProperties - Properties for data binding configuration
        autoLlmSelectionCriteriaResolver - Resolver for auto LLM selection
        promptsProperties - Properties for prompt configuration
        objectMapper - ObjectMapper for JSON serialization
        observationRegistry - Registry for distributed tracing observations
    • Method Detail

      • doTransform

         <O extends Any> O doTransform(List<Message> messages, LlmInteraction interaction, Class<O> outputClass, LlmRequestEvent<O> llmRequestEvent)

        Low level transform, not necessarily aware of platform

        Parameters:
        messages - messages
        interaction - The LLM call options
        outputClass - Class of the output object
        llmRequestEvent - Event already published for this request if one has been