类 OllamaOptions

java.lang.Object
io.agentscope.core.model.ollama.OllamaOptions

public class OllamaOptions extends Object
AgentScope implementation of Ollama model configuration options. Provides a strongly-typed builder for setting model parameters such as temperature, context size, and penalties.

This class maps to the Ollama API parameters for model creation and inference. It supports both advanced model loading parameters (like GPU offloading, memory management) and runtime generation options (like sampling parameters, penalties).

The class provides utility methods for conversion to/from generic GenerateOptions, allowing seamless integration with AgentScope's general model interface.

  • 构造器详细资料

    • OllamaOptions

      public OllamaOptions()
  • 方法详细资料

    • builder

      public static OllamaOptions.Builder builder()
    • fromOptions

      public static OllamaOptions fromOptions(OllamaOptions fromOptions)
    • fromGenerateOptions

      public static OllamaOptions fromGenerateOptions(GenerateOptions genOptions)
      Converts generic GenerateOptions to OllamaOptions.

      This adapter method maps standard framework options to Ollama-specific parameters. Note that some fields (like execution config or tools) are not mapped as they belong to different layers.

      参数:
      genOptions - The generic options to convert.
      返回:
      A configured OllamaOptions instance.
    • toGenerateOptions

      public GenerateOptions toGenerateOptions()
      Converts this OllamaOptions to generic GenerateOptions.
      返回:
      A configured GenerateOptions instance.
    • getModel

      public String getModel()
    • setModel

      public void setModel(String model)
    • getFormat

      public Object getFormat()
    • setFormat

      public void setFormat(Object format)
    • getKeepAlive

      public String getKeepAlive()
    • setKeepAlive

      public void setKeepAlive(String keepAlive)
    • 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)
    • 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)
    • 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)
    • getMaxTokens

      public Integer getMaxTokens()
    • setMaxTokens

      public void setMaxTokens(Integer maxTokens)
    • getNumPredict

      public Integer getNumPredict()
    • setNumPredict

      public void setNumPredict(Integer numPredict)
    • getTopK

      public Integer getTopK()
    • setTopK

      public void setTopK(Integer topK)
    • getTopP

      public Double getTopP()
    • setTopP

      public void setTopP(Double topP)
    • getMinP

      public Double getMinP()
    • setMinP

      public void setMinP(Double minP)
    • 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 Double getTemperature()
    • setTemperature

      public void setTemperature(Double temperature)
    • getRepeatPenalty

      public Double getRepeatPenalty()
    • setRepeatPenalty

      public void setRepeatPenalty(Double repeatPenalty)
    • getPresencePenalty

      public Double getPresencePenalty()
    • setPresencePenalty

      public void setPresencePenalty(Double presencePenalty)
    • getFrequencyPenalty

      public Double getFrequencyPenalty()
    • setFrequencyPenalty

      public void setFrequencyPenalty(Double 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)
    • getStopSequences

      public List<String> getStopSequences()
    • setStopSequences

      public void setStopSequences(List<String> stopSequences)
    • getStop

      public List<String> getStop()
    • setStop

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

      public Boolean getTruncate()
    • setTruncate

      public void setTruncate(Boolean truncate)
    • getThinkOption

      public ThinkOption getThinkOption()
    • setThinkOption

      public void setThinkOption(ThinkOption thinkOption)
    • getExecutionConfig

      public ExecutionConfig getExecutionConfig()
    • setExecutionConfig

      public void setExecutionConfig(ExecutionConfig executionConfig)
    • toMap

      public Map<String,Object> toMap()
      Serializes the OllamaOptions into a Map representation.
      返回:
      A map containing the configured options.
    • copy

      public OllamaOptions copy()
    • merge

      public OllamaOptions merge(GenerateOptions other)
      Merges the given GenerateOptions into a new instance, with the given options taking precedence.

      This is a convenience method that converts the GenerateOptions to OllamaOptions and then merges it.

      参数:
      other - The options to merge (can be null).
      返回:
      A new merged OllamaOptions instance.
    • merge

      public OllamaOptions merge(OllamaOptions other)
      Merges the given options into a new instance, with the given options taking precedence.
      参数:
      other - The options to merge (can be null).
      返回:
      A new merged OllamaOptions instance.
    • toBuilder

      public OllamaOptions.Builder toBuilder()
    • equals

      public boolean equals(Object o)
      覆盖:
      equals 在类中 Object
    • hashCode

      public int hashCode()
      覆盖:
      hashCode 在类中 Object