Record Class OllamaApi.GenerateResponse
java.lang.Object
java.lang.Record
org.springframework.ai.ollama.api.OllamaApi.GenerateResponse
- Record Components:
model
- The model used for completion.createdAt
- When the request was made.response
- The completion response. Empty if the response was streamed, if not streamed, this will contain the full responsedone
- Whether this is the final response. 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.context
- Encoding of the conversation used in this response, this can be sent in the next request to keep a conversational memory.totalDuration
- Time spent generating the response.loadDuration
- Time spent loading the model.promptEvalCount
- Number of times the prompt was evaluated.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.GenerateResponse(String model, Instant createdAt, String response, Boolean done, List<Integer> context, Duration totalDuration, Duration loadDuration, Integer promptEvalCount, Duration promptEvalDuration, Integer evalCount, Duration evalDuration)
extends Record
The response object returned from the /generate endpoint. To calculate how fast the
response is generated in tokens per second (token/s), divide eval_count /
eval_duration.
-
Constructor Summary
ConstructorDescriptionGenerateResponse
(String model, Instant createdAt, String response, Boolean done, List<Integer> context, Duration totalDuration, Duration loadDuration, Integer promptEvalCount, Duration promptEvalDuration, Integer evalCount, Duration evalDuration) Creates an instance of aGenerateResponse
record class. -
Method Summary
Modifier and TypeMethodDescriptioncontext()
Returns the value of thecontext
record component.Returns the value of thecreatedAt
record component.done()
Returns the value of thedone
record component.final boolean
Indicates whether some other object is "equal to" this one.Returns the value of theevalCount
record component.Returns the value of theevalDuration
record component.final int
hashCode()
Returns a hash code value for this object.Returns the value of theloadDuration
record component.model()
Returns the value of themodel
record component.Returns the value of thepromptEvalCount
record component.Returns the value of thepromptEvalDuration
record component.response()
Returns the value of theresponse
record component.final String
toString()
Returns a string representation of this record class.Returns the value of thetotalDuration
record component.
-
Constructor Details
-
GenerateResponse
public GenerateResponse(String model, Instant createdAt, String response, Boolean done, List<Integer> context, Duration totalDuration, Duration loadDuration, Integer promptEvalCount, Duration promptEvalDuration, Integer evalCount, Duration evalDuration) Creates an instance of aGenerateResponse
record class.- Parameters:
model
- the value for themodel
record componentcreatedAt
- the value for thecreatedAt
record componentresponse
- the value for theresponse
record componentdone
- the value for thedone
record componentcontext
- the value for thecontext
record componenttotalDuration
- the value for thetotalDuration
record componentloadDuration
- the value for theloadDuration
record componentpromptEvalCount
- the value for thepromptEvalCount
record componentpromptEvalDuration
- the value for thepromptEvalDuration
record componentevalCount
- the value for theevalCount
record componentevalDuration
- the value for theevalDuration
record 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)
. -
model
Returns the value of themodel
record component.- Returns:
- the value of the
model
record component
-
createdAt
Returns the value of thecreatedAt
record component.- Returns:
- the value of the
createdAt
record component
-
response
Returns the value of theresponse
record component.- Returns:
- the value of the
response
record component
-
done
Returns the value of thedone
record component.- Returns:
- the value of the
done
record component
-
context
Returns the value of thecontext
record component.- Returns:
- the value of the
context
record component
-
totalDuration
Returns the value of thetotalDuration
record component.- Returns:
- the value of the
totalDuration
record component
-
loadDuration
Returns the value of theloadDuration
record component.- Returns:
- the value of the
loadDuration
record component
-
promptEvalCount
Returns the value of thepromptEvalCount
record component.- Returns:
- the value of the
promptEvalCount
record component
-
promptEvalDuration
Returns the value of thepromptEvalDuration
record component.- Returns:
- the value of the
promptEvalDuration
record component
-
evalCount
Returns the value of theevalCount
record component.- Returns:
- the value of the
evalCount
record component
-
evalDuration
Returns the value of theevalDuration
record component.- Returns:
- the value of the
evalDuration
record component
-