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 response OllamaApi.Message with OllamaApi.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 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 a ChatResponse record class.
      Parameters:
      model - the value for the model record component
      createdAt - the value for the createdAt record component
      message - the value for the message record component
      doneReason - the value for the doneReason record component
      done - the value for the done record component
      totalDuration - the value for the totalDuration record component
      loadDuration - the value for the loadDuration record component
      promptEvalCount - the value for the promptEvalCount record component
      promptEvalDuration - the value for the promptEvalDuration record component
      evalCount - the value for the evalCount record component
      evalDuration - the value for the evalDuration record component
  • Method Details

    • getTotalDuration

      public Duration getTotalDuration()
    • getLoadDuration

      public Duration getLoadDuration()
    • getPromptEvalDuration

      public Duration getPromptEvalDuration()
    • getEvalDuration

      public Duration getEvalDuration()
    • 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.
    • model

      public String model()
      Returns the value of the model record component.
      Returns:
      the value of the model record component
    • createdAt

      public Instant createdAt()
      Returns the value of the createdAt record component.
      Returns:
      the value of the createdAt record component
    • message

      public OllamaApi.Message message()
      Returns the value of the message record component.
      Returns:
      the value of the message record component
    • doneReason

      public String doneReason()
      Returns the value of the doneReason record component.
      Returns:
      the value of the doneReason record component
    • done

      public Boolean done()
      Returns the value of the done record component.
      Returns:
      the value of the done record component
    • totalDuration

      public Long totalDuration()
      Returns the value of the totalDuration record component.
      Returns:
      the value of the totalDuration record component
    • loadDuration

      public Long loadDuration()
      Returns the value of the loadDuration record component.
      Returns:
      the value of the loadDuration record component
    • promptEvalCount

      public Integer promptEvalCount()
      Returns the value of the promptEvalCount record component.
      Returns:
      the value of the promptEvalCount record component
    • promptEvalDuration

      public Long promptEvalDuration()
      Returns the value of the promptEvalDuration record component.
      Returns:
      the value of the promptEvalDuration record component
    • evalCount

      public Integer evalCount()
      Returns the value of the evalCount record component.
      Returns:
      the value of the evalCount record component
    • evalDuration

      public Long evalDuration()
      Returns the value of the evalDuration record component.
      Returns:
      the value of the evalDuration record component