Class ChatExecutor.AbstractBuilder<T extends ChatExecutor.AbstractBuilder<T>>

java.lang.Object
dev.langchain4j.guardrail.ChatExecutor.AbstractBuilder<T>
Type Parameters:
T - the type of the builder subclass for enabling fluent method chaining
Direct Known Subclasses:
ChatExecutor.StreamingToSynchronousBuilder, ChatExecutor.SynchronousBuilder
Enclosing interface:
ChatExecutor

public abstract static class ChatExecutor.AbstractBuilder<T extends ChatExecutor.AbstractBuilder<T>> extends Object
An abstract base-builder class for constructing instances of ChatExecutor. This class provides a fluent API for setting required components, such as ChatRequest, and defines a contract for building ChatExecutor instances. Subclasses should implement the build() method to ensure proper construction of the target chat executor object.
  • Field Details

  • Constructor Details

    • AbstractBuilder

      protected AbstractBuilder()
  • Method Details

    • chatRequest

      public ChatExecutor.AbstractBuilder<T> chatRequest(ChatRequest chatRequest)
      Sets the ChatRequest instance for the synchronousBuilder. The ChatRequest encapsulates the input messages and parameters required to generate a response from the chat model.
      Parameters:
      chatRequest - the ChatRequest containing the input messages and parameters
      Returns:
      the updated SynchronousBuilder instance
    • build

      public abstract ChatExecutor build()
      Constructs and returns an instance of ChatExecutor. Ensures that all required parameters have been appropriately set before building the ChatExecutor.
      Returns:
      a fully constructed ChatExecutor instance