Record Class OllamaApi.ChatResponse
java.lang.Object
java.lang.Record
org.springframework.ai.ollama.api.OllamaApi.ChatResponse
- Record Components:
model- The model used for generating the response.createdAt- The timestamp of the response generation.message- The responseOllamaApi.MessagewithOllamaApi.Message.Role.ASSISTANT.doneReason- The reason the model stopped generating text.done- Whether this is the final response. For streaming response only the last message is marked as done. If true, this response may be followed by another response with the following, additional fields: context, prompt_eval_count, prompt_eval_duration, eval_count, eval_duration.totalDuration- Time spent generating the response.loadDuration- Time spent loading the model.promptEvalCount- Number of tokens in the prompt.promptEvalDuration- Time spent evaluating the prompt.evalCount- Number of tokens in the response.evalDuration- Time spent generating the response.
- Enclosing class:
- OllamaApi
public static record OllamaApi.ChatResponse(String model, Instant createdAt, OllamaApi.Message message, String doneReason, Boolean done, Long totalDuration, Long loadDuration, Integer promptEvalCount, Long promptEvalDuration, Integer evalCount, Long evalDuration)
extends Record
Ollama chat response object.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionChatResponse(String model, Instant createdAt, OllamaApi.Message message, String doneReason, Boolean done, Long totalDuration, Long loadDuration, Integer promptEvalCount, Long promptEvalDuration, Integer evalCount, Long evalDuration) Creates an instance of aChatResponserecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thecreatedAtrecord component.done()Returns the value of thedonerecord component.Returns the value of thedoneReasonrecord component.final booleanIndicates whether some other object is "equal to" this one.Returns the value of theevalCountrecord component.Returns the value of theevalDurationrecord component.final inthashCode()Returns a hash code value for this object.Returns the value of theloadDurationrecord component.message()Returns the value of themessagerecord component.model()Returns the value of themodelrecord component.Returns the value of thepromptEvalCountrecord component.Returns the value of thepromptEvalDurationrecord component.final StringtoString()Returns a string representation of this record class.Returns the value of thetotalDurationrecord component.
-
Constructor Details
-
ChatResponse
public ChatResponse(String model, Instant createdAt, OllamaApi.Message message, String doneReason, Boolean done, Long totalDuration, Long loadDuration, Integer promptEvalCount, Long promptEvalDuration, Integer evalCount, Long evalDuration) Creates an instance of aChatResponserecord class.- Parameters:
model- the value for themodelrecord componentcreatedAt- the value for thecreatedAtrecord componentmessage- the value for themessagerecord componentdoneReason- the value for thedoneReasonrecord componentdone- the value for thedonerecord componenttotalDuration- the value for thetotalDurationrecord componentloadDuration- the value for theloadDurationrecord componentpromptEvalCount- the value for thepromptEvalCountrecord componentpromptEvalDuration- the value for thepromptEvalDurationrecord componentevalCount- the value for theevalCountrecord componentevalDuration- the value for theevalDurationrecord component
-
-
Method Details
-
getTotalDuration
-
getLoadDuration
-
getPromptEvalDuration
-
getEvalDuration
-
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). -
model
Returns the value of themodelrecord component.- Returns:
- the value of the
modelrecord component
-
createdAt
Returns the value of thecreatedAtrecord component.- Returns:
- the value of the
createdAtrecord component
-
message
Returns the value of themessagerecord component.- Returns:
- the value of the
messagerecord component
-
doneReason
Returns the value of thedoneReasonrecord component.- Returns:
- the value of the
doneReasonrecord component
-
done
Returns the value of thedonerecord component.- Returns:
- the value of the
donerecord component
-
totalDuration
Returns the value of thetotalDurationrecord component.- Returns:
- the value of the
totalDurationrecord component
-
loadDuration
Returns the value of theloadDurationrecord component.- Returns:
- the value of the
loadDurationrecord component
-
promptEvalCount
Returns the value of thepromptEvalCountrecord component.- Returns:
- the value of the
promptEvalCountrecord component
-
promptEvalDuration
Returns the value of thepromptEvalDurationrecord component.- Returns:
- the value of the
promptEvalDurationrecord component
-
evalCount
Returns the value of theevalCountrecord component.- Returns:
- the value of the
evalCountrecord component
-
evalDuration
Returns the value of theevalDurationrecord component.- Returns:
- the value of the
evalDurationrecord component
-