Package com.axelor.ai.chat
Record Class ChatResult
java.lang.Object
java.lang.Record
com.axelor.ai.chat.ChatResult
- Record Components:
finishReason- why the LLM stopped generatinginputTokens- number of input/prompt tokens used (null if unavailable)outputTokens- number of output/completion tokens used (null if unavailable)cacheReadTokens- input tokens served from provider cache (null if unavailable)cacheWriteTokens- input tokens written to provider cache (null if unavailable)modelCode- the model code used (null if unknown)providerCode- the provider code used (null if unknown)
public record ChatResult(FinishReason finishReason, Integer inputTokens, Integer outputTokens, Integer cacheReadTokens, Integer cacheWriteTokens, String modelCode, String providerCode)
extends Record
Outcome of a single LLM turn, delivered via
ChatProvider.Listener.onFinish(com.axelor.ai.chat.ChatResult).-
Constructor Summary
ConstructorsConstructorDescriptionChatResult(FinishReason finishReason) ChatResult(FinishReason finishReason, Integer inputTokens, Integer outputTokens) ChatResult(FinishReason finishReason, Integer inputTokens, Integer outputTokens, Integer cacheReadTokens, Integer cacheWriteTokens, String modelCode, String providerCode) Creates an instance of aChatResultrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thecacheReadTokensrecord component.Returns the value of thecacheWriteTokensrecord component.final booleanIndicates whether some other object is "equal to" this one.Returns the value of thefinishReasonrecord component.final inthashCode()Returns a hash code value for this object.Returns the value of theinputTokensrecord component.Returns the value of themodelCoderecord component.Returns the value of theoutputTokensrecord component.Returns the value of theproviderCoderecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
ChatResult
-
ChatResult
-
ChatResult
public ChatResult(FinishReason finishReason, Integer inputTokens, Integer outputTokens, Integer cacheReadTokens, Integer cacheWriteTokens, String modelCode, String providerCode) Creates an instance of aChatResultrecord class.- Parameters:
finishReason- the value for thefinishReasonrecord componentinputTokens- the value for theinputTokensrecord componentoutputTokens- the value for theoutputTokensrecord componentcacheReadTokens- the value for thecacheReadTokensrecord componentcacheWriteTokens- the value for thecacheWriteTokensrecord componentmodelCode- the value for themodelCoderecord componentproviderCode- the value for theproviderCoderecord component
-
-
Method Details
-
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). -
finishReason
Returns the value of thefinishReasonrecord component.- Returns:
- the value of the
finishReasonrecord component
-
inputTokens
Returns the value of theinputTokensrecord component.- Returns:
- the value of the
inputTokensrecord component
-
outputTokens
Returns the value of theoutputTokensrecord component.- Returns:
- the value of the
outputTokensrecord component
-
cacheReadTokens
Returns the value of thecacheReadTokensrecord component.- Returns:
- the value of the
cacheReadTokensrecord component
-
cacheWriteTokens
Returns the value of thecacheWriteTokensrecord component.- Returns:
- the value of the
cacheWriteTokensrecord component
-
modelCode
Returns the value of themodelCoderecord component.- Returns:
- the value of the
modelCoderecord component
-
providerCode
Returns the value of theproviderCoderecord component.- Returns:
- the value of the
providerCoderecord component
-