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 theOllamaOptionsbuilder 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
Nested ClassesModifier and TypeClassDescriptionstatic classstatic final recordRepresents a tool the model may call. -
Constructor Summary
ConstructorsConstructorDescriptionChatRequest(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 aChatRequestrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.format()Returns the value of theformatrecord component.final inthashCode()Returns a hash code value for this object.Returns the value of thekeepAliverecord component.messages()Returns the value of themessagesrecord component.model()Returns the value of themodelrecord component.options()Returns the value of theoptionsrecord component.stream()Returns the value of thestreamrecord component.tools()Returns the value of thetoolsrecord component.final StringtoString()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 aChatRequestrecord class.- Parameters:
model- the value for themodelrecord componentmessages- the value for themessagesrecord componentstream- the value for thestreamrecord componentformat- the value for theformatrecord componentkeepAlive- the value for thekeepAliverecord componenttools- the value for thetoolsrecord componentoptions- the value for theoptionsrecord 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 themodelrecord component.- Returns:
- the value of the
modelrecord component
-
messages
Returns the value of themessagesrecord component.- Returns:
- the value of the
messagesrecord component
-
stream
Returns the value of thestreamrecord component.- Returns:
- the value of the
streamrecord component
-
format
Returns the value of theformatrecord component.- Returns:
- the value of the
formatrecord component
-
keepAlive
Returns the value of thekeepAliverecord component.- Returns:
- the value of the
keepAliverecord component
-
tools
Returns the value of thetoolsrecord component.- Returns:
- the value of the
toolsrecord component
-
options
Returns the value of theoptionsrecord component.- Returns:
- the value of the
optionsrecord component
-