Record Class OllamaApi.EmbeddingsRequest

java.lang.Object
java.lang.Record
org.springframework.ai.ollama.api.OllamaApi.EmbeddingsRequest
Record Components:
model - The name of model to generate embeddings from.
input - The text or list of text to generate embeddings for.
keepAlive - Controls how long the model will stay loaded into memory following the request (default: 5m).
options - Additional model parameters listed in the documentation for the
truncate - Truncates the end of each input to fit within context length. Returns error if false and context length is exceeded. Defaults to true.
Enclosing class:
OllamaApi

public static record OllamaApi.EmbeddingsRequest(String model, List<String> input, String keepAlive, Map<String,Object> options, Boolean truncate) extends Record
Generate embeddings from a model.
  • Constructor Details

    • EmbeddingsRequest

      public EmbeddingsRequest(String model, String input)
      Shortcut constructor to create a EmbeddingRequest without options.
      Parameters:
      model - The name of model to generate embeddings from.
      input - The text or list of text to generate embeddings for.
    • EmbeddingsRequest

      public EmbeddingsRequest(String model, List<String> input, String keepAlive, Map<String,Object> options, Boolean truncate)
      Creates an instance of a EmbeddingsRequest record class.
      Parameters:
      model - the value for the model record component
      input - the value for the input record component
      keepAlive - the value for the keepAlive record component
      options - the value for the options record component
      truncate - the value for the truncate record component
  • Method Details

    • 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
    • input

      public List<String> input()
      Returns the value of the input record component.
      Returns:
      the value of the input record component
    • keepAlive

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

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

      public Boolean truncate()
      Returns the value of the truncate record component.
      Returns:
      the value of the truncate record component