Class ToolServiceResult

java.lang.Object
dev.langchain4j.service.tool.ToolServiceResult

public class ToolServiceResult extends Object
  • Constructor Details

  • Method Details

    • intermediateResponses

      public List<ChatResponse> intermediateResponses()
      Since:
      1.2.0
    • finalResponse

      public ChatResponse finalResponse()
      Since:
      1.2.0
    • aggregateResponse

      public ChatResponse aggregateResponse()
      Since:
      1.2.0
    • chatResponse

      @Deprecated(since="1.2.0") public ChatResponse chatResponse()
      Deprecated.
      Please use aggregateResponse() instead for clarity
    • toolExecutions

      public List<ToolExecution> toolExecutions()
    • aggregateTokenUsage

      public TokenUsage aggregateTokenUsage()
      Since:
      1.2.0
    • immediateToolReturn

      public boolean immediateToolReturn()
      Since:
      1.4.0
    • messages

      public List<ChatMessage> messages()
      The conversation the tool loop ended with (the messages sent, every tool round trip and the final response), when the AI Service has no chat memory. Empty when it has one: the chat memory holds the conversation then.
      Since:
      1.23.0
    • lastChatRequest

      public ChatRequest lastChatRequest()
      The last request the tool loop sent to the model, whose response is finalResponse(): its messages include the tool calls and tool results of all rounds. null when the loop sent no request, because the response of the call that started the loop had no tool calls.
      Since:
      1.23.0
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • builder

      public static ToolServiceResult.Builder builder()