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 the OllamaOptions builder to create the options then OllamaOptions.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:
  • Constructor Details

  • Method Details

    • builder

      public static OllamaApi.ChatRequest.Builder builder(String model)
    • 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
    • messages

      public List<OllamaApi.Message> messages()
      Returns the value of the messages record component.
      Returns:
      the value of the messages record component
    • stream

      public Boolean stream()
      Returns the value of the stream record component.
      Returns:
      the value of the stream record component
    • format

      public Object format()
      Returns the value of the format record component.
      Returns:
      the value of the format record component
    • keepAlive

      public String keepAlive()
      Returns the value of the keepAlive record component.
      Returns:
      the value of the keepAlive record component
    • tools

      Returns the value of the tools record component.
      Returns:
      the value of the tools record component
    • options

      public Map<String,Object> options()
      Returns the value of the options record component.
      Returns:
      the value of the options record component