Package com.tnsai.llm.observability
Record Class LLMResponse
java.lang.Object
java.lang.Record
com.tnsai.llm.observability.LLMResponse
- Record Components:
content- full text response — may be empty when the response is purely tool callstoolCalls- each tool call the model requested; empty when the model produced text onlyreasoningContent- separate reasoning-pass text for thinking models; absent for non-thinking models
public record LLMResponse(String content, List<LLMResponse.ToolCallRequest> toolCalls, Optional<String> reasoningContent)
extends Record
Captured output side of an LLM call (issue #79).
Holds the LLM's text completion + any tool-call requests it made, plus optional reasoning / thinking content for reasoning-capable models (OpenAI o-series, Anthropic Claude with extended thinking).
- Since:
- 0.5.0 (issue #79)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordOne tool-call request from the LLM. -
Constructor Summary
ConstructorsConstructorDescriptionLLMResponse(String content, List<LLMResponse.ToolCallRequest> toolCalls, Optional<String> reasoningContent) Creates an instance of aLLMResponserecord class. -
Method Summary
Modifier and TypeMethodDescriptioncontent()Returns the value of thecontentrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of thereasoningContentrecord component.static LLMResponseConvenience: pure-text response (no tool calls, no reasoning).Returns the value of thetoolCallsrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
LLMResponse
public LLMResponse(String content, List<LLMResponse.ToolCallRequest> toolCalls, Optional<String> reasoningContent) Creates an instance of aLLMResponserecord class.- Parameters:
content- the value for thecontentrecord componenttoolCalls- the value for thetoolCallsrecord componentreasoningContent- the value for thereasoningContentrecord component
-
-
Method Details
-
textOnly
Convenience: pure-text response (no tool calls, no reasoning). -
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. -
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. -
equals
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 withObjects::equals(Object,Object). -
content
Returns the value of thecontentrecord component.- Returns:
- the value of the
contentrecord component
-
toolCalls
Returns the value of thetoolCallsrecord component.- Returns:
- the value of the
toolCallsrecord component
-
reasoningContent
Returns the value of thereasoningContentrecord component.- Returns:
- the value of the
reasoningContentrecord component
-