Class OllamaOptions

java.lang.Object
org.springframework.ai.ollama.api.OllamaOptions
All Implemented Interfaces:
ChatOptions, EmbeddingOptions, ModelOptions

public class OllamaOptions extends Object implements ChatOptions, EmbeddingOptions
Helper class for creating strongly-typed Ollama options.
Since:
0.8.0
Author:
Christian Tzolov
See Also:
  • Field Details

    • DEFAULT_MODEL

      public static final String DEFAULT_MODEL
  • Constructor Details

    • OllamaOptions

      public OllamaOptions()
  • Method Details

    • withModel

      public OllamaOptions withModel(String model)
      Parameters:
      model - The ollama model names to use. See the OllamaModel for the common models.
    • getModel

      public String getModel()
    • setModel

      public void setModel(String model)
    • withUseNUMA

      public OllamaOptions withUseNUMA(Boolean useNUMA)
    • withNumCtx

      public OllamaOptions withNumCtx(Integer numCtx)
    • withNumBatch

      public OllamaOptions withNumBatch(Integer numBatch)
    • withNumGQA

      public OllamaOptions withNumGQA(Integer numGQA)
    • withNumGPU

      public OllamaOptions withNumGPU(Integer numGPU)
    • withMainGPU

      public OllamaOptions withMainGPU(Integer mainGPU)
    • withLowVRAM

      public OllamaOptions withLowVRAM(Boolean lowVRAM)
    • withF16KV

      public OllamaOptions withF16KV(Boolean f16KV)
    • withLogitsAll

      public OllamaOptions withLogitsAll(Boolean logitsAll)
    • withVocabOnly

      public OllamaOptions withVocabOnly(Boolean vocabOnly)
    • withUseMMap

      public OllamaOptions withUseMMap(Boolean useMMap)
    • withUseMLock

      public OllamaOptions withUseMLock(Boolean useMLock)
    • withEmbeddingOnly

      public OllamaOptions withEmbeddingOnly(Boolean embeddingOnly)
    • withRopeFrequencyBase

      public OllamaOptions withRopeFrequencyBase(Float ropeFrequencyBase)
    • withRopeFrequencyScale

      public OllamaOptions withRopeFrequencyScale(Float ropeFrequencyScale)
    • withNumThread

      public OllamaOptions withNumThread(Integer numThread)
    • withNumKeep

      public OllamaOptions withNumKeep(Integer numKeep)
    • withSeed

      public OllamaOptions withSeed(Integer seed)
    • withNumPredict

      public OllamaOptions withNumPredict(Integer numPredict)
    • withTopK

      public OllamaOptions withTopK(Integer topK)
    • withTopP

      public OllamaOptions withTopP(Float topP)
    • withTfsZ

      public OllamaOptions withTfsZ(Float tfsZ)
    • withTypicalP

      public OllamaOptions withTypicalP(Float typicalP)
    • withRepeatLastN

      public OllamaOptions withRepeatLastN(Integer repeatLastN)
    • withTemperature

      public OllamaOptions withTemperature(Float temperature)
    • withRepeatPenalty

      public OllamaOptions withRepeatPenalty(Float repeatPenalty)
    • withPresencePenalty

      public OllamaOptions withPresencePenalty(Float presencePenalty)
    • withFrequencyPenalty

      public OllamaOptions withFrequencyPenalty(Float frequencyPenalty)
    • withMirostat

      public OllamaOptions withMirostat(Integer mirostat)
    • withMirostatTau

      public OllamaOptions withMirostatTau(Float mirostatTau)
    • withMirostatEta

      public OllamaOptions withMirostatEta(Float mirostatEta)
    • withPenalizeNewline

      public OllamaOptions withPenalizeNewline(Boolean penalizeNewline)
    • withStop

      public OllamaOptions withStop(List<String> stop)
    • getUseNUMA

      public Boolean getUseNUMA()
    • setUseNUMA

      public void setUseNUMA(Boolean useNUMA)
    • getNumCtx

      public Integer getNumCtx()
    • setNumCtx

      public void setNumCtx(Integer numCtx)
    • getNumBatch

      public Integer getNumBatch()
    • setNumBatch

      public void setNumBatch(Integer numBatch)
    • getNumGQA

      public Integer getNumGQA()
    • setNumGQA

      public void setNumGQA(Integer numGQA)
    • getNumGPU

      public Integer getNumGPU()
    • setNumGPU

      public void setNumGPU(Integer numGPU)
    • getMainGPU

      public Integer getMainGPU()
    • setMainGPU

      public void setMainGPU(Integer mainGPU)
    • getLowVRAM

      public Boolean getLowVRAM()
    • setLowVRAM

      public void setLowVRAM(Boolean lowVRAM)
    • getF16KV

      public Boolean getF16KV()
    • setF16KV

      public void setF16KV(Boolean f16kv)
    • getLogitsAll

      public Boolean getLogitsAll()
    • setLogitsAll

      public void setLogitsAll(Boolean logitsAll)
    • getVocabOnly

      public Boolean getVocabOnly()
    • setVocabOnly

      public void setVocabOnly(Boolean vocabOnly)
    • getUseMMap

      public Boolean getUseMMap()
    • setUseMMap

      public void setUseMMap(Boolean useMMap)
    • getUseMLock

      public Boolean getUseMLock()
    • setUseMLock

      public void setUseMLock(Boolean useMLock)
    • getEmbeddingOnly

      public Boolean getEmbeddingOnly()
    • setEmbeddingOnly

      public void setEmbeddingOnly(Boolean embeddingOnly)
    • getRopeFrequencyBase

      public Float getRopeFrequencyBase()
    • setRopeFrequencyBase

      public void setRopeFrequencyBase(Float ropeFrequencyBase)
    • getRopeFrequencyScale

      public Float getRopeFrequencyScale()
    • setRopeFrequencyScale

      public void setRopeFrequencyScale(Float ropeFrequencyScale)
    • getNumThread

      public Integer getNumThread()
    • setNumThread

      public void setNumThread(Integer numThread)
    • getNumKeep

      public Integer getNumKeep()
    • setNumKeep

      public void setNumKeep(Integer numKeep)
    • getSeed

      public Integer getSeed()
    • setSeed

      public void setSeed(Integer seed)
    • getNumPredict

      public Integer getNumPredict()
    • setNumPredict

      public void setNumPredict(Integer numPredict)
    • getTopK

      public Integer getTopK()
      Specified by:
      getTopK in interface ChatOptions
    • setTopK

      public void setTopK(Integer topK)
    • getTopP

      public Float getTopP()
      Specified by:
      getTopP in interface ChatOptions
    • setTopP

      public void setTopP(Float topP)
    • getTfsZ

      public Float getTfsZ()
    • setTfsZ

      public void setTfsZ(Float tfsZ)
    • getTypicalP

      public Float getTypicalP()
    • setTypicalP

      public void setTypicalP(Float typicalP)
    • getRepeatLastN

      public Integer getRepeatLastN()
    • setRepeatLastN

      public void setRepeatLastN(Integer repeatLastN)
    • getTemperature

      public Float getTemperature()
      Specified by:
      getTemperature in interface ChatOptions
    • setTemperature

      public void setTemperature(Float temperature)
    • getRepeatPenalty

      public Float getRepeatPenalty()
    • setRepeatPenalty

      public void setRepeatPenalty(Float repeatPenalty)
    • getPresencePenalty

      public Float getPresencePenalty()
    • setPresencePenalty

      public void setPresencePenalty(Float presencePenalty)
    • getFrequencyPenalty

      public Float getFrequencyPenalty()
    • setFrequencyPenalty

      public void setFrequencyPenalty(Float frequencyPenalty)
    • getMirostat

      public Integer getMirostat()
    • setMirostat

      public void setMirostat(Integer mirostat)
    • getMirostatTau

      public Float getMirostatTau()
    • setMirostatTau

      public void setMirostatTau(Float mirostatTau)
    • getMirostatEta

      public Float getMirostatEta()
    • setMirostatEta

      public void setMirostatEta(Float mirostatEta)
    • getPenalizeNewline

      public Boolean getPenalizeNewline()
    • setPenalizeNewline

      public void setPenalizeNewline(Boolean penalizeNewline)
    • getStop

      public List<String> getStop()
    • setStop

      public void setStop(List<String> stop)
    • toMap

      public Map<String,Object> toMap()
      Convert the OllamaOptions object to a Map of key/value pairs.
      Returns:
      The Map of key/value pairs.
    • create

      public static OllamaOptions create()
      Helper factory method to create a new OllamaOptions instance.
      Returns:
      A new OllamaOptions instance.
    • filterNonSupportedFields

      public static Map<String,Object> filterNonSupportedFields(Map<String,Object> options)
      Filter out the non supported fields from the options.
      Parameters:
      options - The options to filter.
      Returns:
      The filtered options.