Interface InvocationContext

All Known Implementing Classes:
DefaultInvocationContext

public interface InvocationContext
Represents the context of a single AI Service invocation. A new instance is created each time an AI Service method is invoked, and it exists until the end of the AI Service invocation, potentially spanning multiple calls to the ChatModel.
Since:
1.6.0
  • Method Details

    • invocationId

      UUID invocationId()
      Unique identifier for an entire AI Service invocation
    • interfaceName

      String interfaceName()
      The fully-qualified name of the AI Service interface where the invocation was initiated from
      See Also:
    • methodName

      String methodName()
      The method name on interfaceName() where the invocation was initiated from
    • methodArguments

      List<Object> methodArguments()
      The arguments passed into the AI Service method
    • userMessage

      default UserMessage userMessage()
      The UserMessage to be sent to the LLM. This is the message after all transformations (RAG augmentation, content injection, input guardrails, output format instructions).
      Since:
      1.13.0
    • chatMemoryId

      Object chatMemoryId()
      The chat memory id parameter of the method
    • invocationParameters

      InvocationParameters invocationParameters()
      The invocation parameters
    • managedParameters

      default Map<Class<? extends LangChain4jManaged>, LangChain4jManaged> managedParameters()
      LangChain4j managed parameters
      Since:
      1.8.0
    • timestamp

      Instant timestamp()
      Retrieves the point in time when the invocation occurred.
    • toBuilder

      default InvocationContext.Builder toBuilder()
      Converts the current instance of DefaultInvocationContext into a InvocationContext.Builder, pre-populated with the current values of the instance.
    • builder

      static InvocationContext.Builder builder()
      Creates a new instance of the Builder class for constructing instances of DefaultInvocationContext.