Class OllamaOptions
java.lang.Object
io.agentscope.extensions.model.ollama.options.OllamaOptions
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classstatic enumKeys for Ollama parameters. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic OllamaOptions.Builderbuilder()copy()booleanstatic OllamaOptionsfromGenerateOptions(io.agentscope.core.model.GenerateOptions genOptions) Converts genericGenerateOptionstoOllamaOptions.static OllamaOptionsfromOptions(OllamaOptions fromOptions) io.agentscope.core.model.ExecutionConfiggetF16KV()getMinP()getModel()getSeed()getStop()getTfsZ()getTopK()getTopP()inthashCode()merge(io.agentscope.core.model.GenerateOptions other) Merges the givenGenerateOptionsinto a new instance, with the given options taking precedence.merge(OllamaOptions other) Merges the given options into a new instance, with the given options taking precedence.voidsetExecutionConfig(io.agentscope.core.model.ExecutionConfig executionConfig) voidvoidvoidsetFrequencyPenalty(Double frequencyPenalty) voidsetKeepAlive(String keepAlive) voidsetLogitsAll(Boolean logitsAll) voidsetLowVRAM(Boolean lowVRAM) voidsetMainGPU(Integer mainGPU) voidsetMaxTokens(Integer maxTokens) voidvoidsetMirostat(Integer mirostat) voidsetMirostatEta(Float mirostatEta) voidsetMirostatTau(Float mirostatTau) voidvoidsetNumBatch(Integer numBatch) voidvoidvoidsetNumKeep(Integer numKeep) voidsetNumPredict(Integer numPredict) voidsetNumThread(Integer numThread) voidsetPenalizeNewline(Boolean penalizeNewline) voidsetPresencePenalty(Double presencePenalty) voidsetRepeatLastN(Integer repeatLastN) voidsetRepeatPenalty(Double repeatPenalty) voidvoidvoidsetStopSequences(List<String> stopSequences) voidsetTemperature(Double temperature) voidvoidsetThinkOption(ThinkOption thinkOption) voidvoidvoidsetTruncate(Boolean truncate) voidsetTypicalP(Float typicalP) voidsetUseMLock(Boolean useMLock) voidsetUseMMap(Boolean useMMap) voidsetUseNUMA(Boolean useNUMA) voidsetVocabOnly(Boolean vocabOnly) io.agentscope.core.model.GenerateOptionsConverts thisOllamaOptionsto genericGenerateOptions.toMap()Serializes theOllamaOptionsinto aMaprepresentation.
-
Constructor Details
-
OllamaOptions
public OllamaOptions()
-
-
Method Details
-
builder
-
fromOptions
-
fromGenerateOptions
public static OllamaOptions fromGenerateOptions(io.agentscope.core.model.GenerateOptions genOptions) Converts genericGenerateOptionstoOllamaOptions.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.
- Parameters:
genOptions- The generic options to convert.- Returns:
- A configured
OllamaOptionsinstance.
-
toGenerateOptions
public io.agentscope.core.model.GenerateOptions toGenerateOptions()Converts thisOllamaOptionsto genericGenerateOptions.- Returns:
- A configured
GenerateOptionsinstance.
-
getModel
-
setModel
-
getFormat
-
setFormat
-
getKeepAlive
-
setKeepAlive
-
getUseNUMA
-
setUseNUMA
-
getNumCtx
-
setNumCtx
-
getNumBatch
-
setNumBatch
-
getNumGPU
-
setNumGPU
-
getMainGPU
-
setMainGPU
-
getLowVRAM
-
setLowVRAM
-
getF16KV
-
setF16KV
-
getLogitsAll
-
setLogitsAll
-
getVocabOnly
-
setVocabOnly
-
getUseMMap
-
setUseMMap
-
getUseMLock
-
setUseMLock
-
getNumThread
-
setNumThread
-
getNumKeep
-
setNumKeep
-
getSeed
-
setSeed
-
getMaxTokens
-
setMaxTokens
-
getNumPredict
-
setNumPredict
-
getTopK
-
setTopK
-
getTopP
-
setTopP
-
getMinP
-
setMinP
-
getTfsZ
-
setTfsZ
-
getTypicalP
-
setTypicalP
-
getRepeatLastN
-
setRepeatLastN
-
getTemperature
-
setTemperature
-
getRepeatPenalty
-
setRepeatPenalty
-
getPresencePenalty
-
setPresencePenalty
-
getFrequencyPenalty
-
setFrequencyPenalty
-
getMirostat
-
setMirostat
-
getMirostatTau
-
setMirostatTau
-
getMirostatEta
-
setMirostatEta
-
getPenalizeNewline
-
setPenalizeNewline
-
getStopSequences
-
setStopSequences
-
getStop
-
setStop
-
getTruncate
-
setTruncate
-
getThinkOption
-
setThinkOption
-
getExecutionConfig
public io.agentscope.core.model.ExecutionConfig getExecutionConfig() -
setExecutionConfig
public void setExecutionConfig(io.agentscope.core.model.ExecutionConfig executionConfig) -
toMap
Serializes theOllamaOptionsinto aMaprepresentation.- Returns:
- A map containing the configured options.
-
copy
-
merge
Merges the givenGenerateOptionsinto a new instance, with the given options taking precedence.This is a convenience method that converts the
GenerateOptionstoOllamaOptionsand then merges it.- Parameters:
other- The options to merge (can be null).- Returns:
- A new merged
OllamaOptionsinstance.
-
merge
Merges the given options into a new instance, with the given options taking precedence.- Parameters:
other- The options to merge (can be null).- Returns:
- A new merged
OllamaOptionsinstance.
-
toBuilder
-
equals
-
hashCode
public int hashCode()
-