类 OllamaOptions
java.lang.Object
io.agentscope.core.model.ollama.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.
-
嵌套类概要
嵌套类修饰符和类型类说明static final classstatic enumKeys for Ollama parameters. -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static OllamaOptions.Builderbuilder()copy()booleanstatic OllamaOptionsfromGenerateOptions(GenerateOptions genOptions) Converts genericGenerateOptionstoOllamaOptions.static OllamaOptionsfromOptions(OllamaOptions fromOptions) getF16KV()getMinP()getModel()getSeed()getStop()getTfsZ()getTopK()getTopP()inthashCode()merge(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(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) Converts thisOllamaOptionsto genericGenerateOptions.toMap()Serializes theOllamaOptionsinto aMaprepresentation.
-
构造器详细资料
-
OllamaOptions
public OllamaOptions()
-
-
方法详细资料
-
builder
-
fromOptions
-
fromGenerateOptions
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.
- 参数:
genOptions- The generic options to convert.- 返回:
- A configured
OllamaOptionsinstance.
-
toGenerateOptions
Converts thisOllamaOptionsto genericGenerateOptions.- 返回:
- 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
-
setExecutionConfig
-
toMap
Serializes theOllamaOptionsinto aMaprepresentation.- 返回:
- 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.- 参数:
other- The options to merge (can be null).- 返回:
- A new merged
OllamaOptionsinstance.
-
merge
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
OllamaOptionsinstance.
-
toBuilder
-
equals
-
hashCode
public int hashCode()
-