Record Class OllamaApi.ChatRequest
java.lang.Object
java.lang.Record
org.springframework.ai.ollama.api.OllamaApi.ChatRequest
- Record Components:
model
- The model to use for completion. It should be a name familiar to Ollama from the Library.messages
- The list of messages in the chat. This can be used to keep a chat memory.stream
- Whether to stream the response. If false, the response will be returned as a single response object rather than a stream of objects.format
- The format to return the response in. It can either be the String "json" or a Map containing a JSON Schema definition.keepAlive
- Controls how long the model will stay loaded into memory following this request (default: 5m).tools
- List of tools the model has access to.options
- Model-specific options. For example, "temperature" can be set through this field, if the model supports it. You can use theOllamaOptions
builder to create the options thenOllamaOptions.toMap()
to convert the options into a map.
- Enclosing class:
- OllamaApi
public static record OllamaApi.ChatRequest(String model, List<OllamaApi.Message> messages, Boolean stream, Object format, String keepAlive, List<OllamaApi.ChatRequest.Tool> tools, Map<String,Object> options)
extends Record
Chat request object.
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static final record
Represents a tool the model may call. -
Constructor Summary
ConstructorDescriptionChatRequest
(String model, List<OllamaApi.Message> messages, Boolean stream, Object format, String keepAlive, List<OllamaApi.ChatRequest.Tool> tools, Map<String, Object> options) Creates an instance of aChatRequest
record class. -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Indicates whether some other object is "equal to" this one.format()
Returns the value of theformat
record component.final int
hashCode()
Returns a hash code value for this object.Returns the value of thekeepAlive
record component.messages()
Returns the value of themessages
record component.model()
Returns the value of themodel
record component.options()
Returns the value of theoptions
record component.stream()
Returns the value of thestream
record component.tools()
Returns the value of thetools
record component.final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
ChatRequest
public ChatRequest(String model, List<OllamaApi.Message> messages, Boolean stream, Object format, String keepAlive, List<OllamaApi.ChatRequest.Tool> tools, Map<String, Object> options) Creates an instance of aChatRequest
record class.- Parameters:
model
- the value for themodel
record componentmessages
- the value for themessages
record componentstream
- the value for thestream
record componentformat
- the value for theformat
record componentkeepAlive
- the value for thekeepAlive
record componenttools
- the value for thetools
record componentoptions
- the value for theoptions
record component
-
-
Method Details
-
builder
-
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
-
messages
Returns the value of themessages
record component.- Returns:
- the value of the
messages
record component
-
stream
Returns the value of thestream
record component.- Returns:
- the value of the
stream
record component
-
format
Returns the value of theformat
record component.- Returns:
- the value of the
format
record component
-
keepAlive
Returns the value of thekeepAlive
record component.- Returns:
- the value of the
keepAlive
record component
-
tools
Returns the value of thetools
record component.- Returns:
- the value of the
tools
record component
-
options
Returns the value of theoptions
record component.- Returns:
- the value of the
options
record component
-