Class InvocationContext.Builder

java.lang.Object
dev.langchain4j.invocation.InvocationContext.Builder
Enclosing interface:
InvocationContext

public static class InvocationContext.Builder extends Object
A builder class to create InvocationContext instances.
Since:
1.6.0
  • Constructor Details

    • Builder

      protected Builder()
    • Builder

      protected Builder(InvocationContext invocationContext)
  • Method Details

    • invocationId

      public InvocationContext.Builder invocationId(UUID invocationId)
      Sets the invocation ID.
    • interfaceName

      public InvocationContext.Builder interfaceName(String interfaceName)
      Sets the name of the interface associated with the builder.
    • methodName

      public InvocationContext.Builder methodName(String methodName)
      Sets the name of the method associated with the builder.
    • methodArguments

      public InvocationContext.Builder methodArguments(List<Object> methodArguments)
      Sets the method arguments for the builder. If the provided list of method arguments is not null, they will be added to the existing list of method arguments.
    • methodArgument

      public InvocationContext.Builder methodArgument(Object methodArgument)
      Adds a single method argument to the builder's list of method arguments. If the provided argument is not null, it will be added to the collection.
    • chatMemoryId

      public InvocationContext.Builder chatMemoryId(Object memoryId)
      Sets the memory identifier for the builder.
    • invocationParameters

      public InvocationContext.Builder invocationParameters(InvocationParameters invocationParameters)
      Sets the invocation parameters for the builder.
    • timestamp

      public InvocationContext.Builder timestamp(Instant timestamp)
      Sets the timestamp for the builder.
    • timestampNow

      public InvocationContext.Builder timestampNow()
      Updates the builder's timestamp to the current system time.
      Returns:
      This Builder instance with the timestamp set to the current time.
    • build

      public <T extends InvocationContext> T build()
      Constructs an instance of InvocationContext using the current state of the builder.
    • invocationId

      public UUID invocationId()
    • interfaceName

      public String interfaceName()
    • methodName

      public String methodName()
    • methodArguments

      public List<@NonNull Object> methodArguments()
    • chatMemoryId

      public Object chatMemoryId()
    • invocationParameters

      public InvocationParameters invocationParameters()
    • timestamp

      public Instant timestamp()