Record Class LlmExecutionResponse

java.lang.Object
java.lang.Record
com.agentforge4j.llm.api.LlmExecutionResponse
Record Components:
text - model output text; never null
modelUsed - concrete model the provider actually ran for this call; may differ from LlmExecutionRequest.model() when the caller passed null, an alias, or the provider performed server-side routing; null when the provider response does not include a model field (Bedrock passes through the invoked modelId because the Anthropic InvokeModel body does not carry it)
tokenUsage - provider-reported token counts, or null when the provider returned no usage block at all for this call (absence convention — not an empty populated record)

public record LlmExecutionResponse(String text, String modelUsed, TokenUsageReport tokenUsage) extends Record
Result of a single LlmClient invocation.
  • Constructor Details

  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • text

      public String text()
      Returns the value of the text record component.
      Returns:
      the value of the text record component
    • modelUsed

      public String modelUsed()
      Returns the value of the modelUsed record component.
      Returns:
      the value of the modelUsed record component
    • tokenUsage

      public TokenUsageReport tokenUsage()
      Returns the value of the tokenUsage record component.
      Returns:
      the value of the tokenUsage record component