OllamaOptions
@JsonInclude(Include.NON_NULL) public class OllamaOptions
io/agentscope/extensions/model/ollama/options/OllamaOptions.java:41–1350Ollama 选项,保存相关配置项。位于 io.agentscope.extensions.model.ollama.options 包。核心成员包括 builder、fromOptions、fromGenerateOptions、toGenerateOptions、getModel、setModel。
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
| 类Class | 类型Kind | 说明Description |
|---|---|---|
ParamKey | 枚举enum | 定义参数键相关取值的枚举。 Keys for Ollama parameters. |
Builder | 类class | 构建器,用于构建并配置目标实例。 A class in io.agentscope.extensions.model.ollama.options that talks to model services and returns generated or embedded output. |
方法摘要Method Summary
方法详情Method Detail
builder
public static Builder builder()
返回构建器实例。
Returns the builder.
Builderio/agentscope/extensions/model/ollama/options/OllamaOptions.java:306–308fromOptions
public static OllamaOptions fromOptions(OllamaOptions fromOptions)
设置来自选项。
Performs the from options operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
fromOptions | OllamaOptions | 来自选项(类型 `OllamaOptions`)。The from options. |
OllamaOptionsio/agentscope/extensions/model/ollama/options/OllamaOptions.java:310–349fromGenerateOptions
public static OllamaOptions fromGenerateOptions(GenerateOptions genOptions)
转换泛型GenerateOptions到OllamaOptions。
Converts generic GenerateOptions to OllamaOptions.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
genOptions | GenerateOptions | 泛型选项到转换。The generic options to convert. |
OllamaOptionsio/agentscope/extensions/model/ollama/options/OllamaOptions.java:360–401toGenerateOptions
public GenerateOptions toGenerateOptions()
转换此OllamaOptions到泛型GenerateOptions。
Converts this OllamaOptions to generic GenerateOptions.
GenerateOptionsio/agentscope/extensions/model/ollama/options/OllamaOptions.java:408–455getModel
public String getModel()
获取模型。
Returns the model.
Stringio/agentscope/extensions/model/ollama/options/OllamaOptions.java:597–599setModel
public void setModel(String model)
设置模型。
Sets the model.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
model | String | 模型实例(类型 `String`)。The model. |
io/agentscope/extensions/model/ollama/options/OllamaOptions.java:601–603getFormat
public Object getFormat()
获取格式。
Returns the format.
Objectio/agentscope/extensions/model/ollama/options/OllamaOptions.java:605–607setFormat
public void setFormat(Object format)
设置格式。
Sets the format.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
format | Object | 格式(类型 `Object`)。The format. |
io/agentscope/extensions/model/ollama/options/OllamaOptions.java:609–611getKeepAlive
public String getKeepAlive()
获取 getKeepAlive。
Returns the keep alive.
Stringio/agentscope/extensions/model/ollama/options/OllamaOptions.java:613–615setKeepAlive
public void setKeepAlive(String keepAlive)
设置 setKeepAlive。
Sets the keep alive.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
keepAlive | String | keep Alive(类型 `String`)。The keep alive. |
io/agentscope/extensions/model/ollama/options/OllamaOptions.java:617–619getUseNUMA
public Boolean getUseNUMA()
获取使用 NUMA。
Returns the use NUMA.
Booleanio/agentscope/extensions/model/ollama/options/OllamaOptions.java:621–623setUseNUMA
public void setUseNUMA(Boolean useNUMA)
设置使用 NUMA。
Sets the use NUMA.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
useNUMA | Boolean | 使用 NUMA(类型 `Boolean`)。The use NUMA. |
io/agentscope/extensions/model/ollama/options/OllamaOptions.java:625–627getNumCtx
public Integer getNumCtx()
获取 getNumCtx。
Returns the num ctx.
Integerio/agentscope/extensions/model/ollama/options/OllamaOptions.java:629–631setNumCtx
public void setNumCtx(Integer numCtx)
设置 setNumCtx。
Sets the num ctx.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
numCtx | Integer | num Ctx(类型 `Integer`)。The num ctx. |
io/agentscope/extensions/model/ollama/options/OllamaOptions.java:633–635getNumBatch
public Integer getNumBatch()
获取 getNumBatch。
Returns the num batch.
Integerio/agentscope/extensions/model/ollama/options/OllamaOptions.java:637–639setNumBatch
public void setNumBatch(Integer numBatch)
设置 setNumBatch。
Sets the num batch.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
numBatch | Integer | num Batch(类型 `Integer`)。The num batch. |
io/agentscope/extensions/model/ollama/options/OllamaOptions.java:641–643getNumGPU
public Integer getNumGPU()
获取 getNumGPU。
Returns the num GPU.
Integerio/agentscope/extensions/model/ollama/options/OllamaOptions.java:645–647setNumGPU
public void setNumGPU(Integer numGPU)
设置 setNumGPU。
Sets the num GPU.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
numGPU | Integer | num GPU(类型 `Integer`)。The num GPU. |
io/agentscope/extensions/model/ollama/options/OllamaOptions.java:649–651getMainGPU
public Integer getMainGPU()
获取主 GPU。
Returns the main GPU.
Integerio/agentscope/extensions/model/ollama/options/OllamaOptions.java:653–655setMainGPU
public void setMainGPU(Integer mainGPU)
设置主 GPU。
Sets the main GPU.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
mainGPU | Integer | 主 GPU(类型 `Integer`)。The main GPU. |
io/agentscope/extensions/model/ollama/options/OllamaOptions.java:657–659getLowVRAM
public Boolean getLowVRAM()
获取 getLowVRAM。
Returns the low VRAM.
Booleanio/agentscope/extensions/model/ollama/options/OllamaOptions.java:661–663setLowVRAM
public void setLowVRAM(Boolean lowVRAM)
设置 setLowVRAM。
Sets the low VRAM.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
lowVRAM | Boolean | low VRAM(类型 `Boolean`)。The low VRAM. |
io/agentscope/extensions/model/ollama/options/OllamaOptions.java:665–667getF16KV
public Boolean getF16KV()
获取F 16 KV。
Returns the f 16 KV.
Booleanio/agentscope/extensions/model/ollama/options/OllamaOptions.java:669–671setF16KV
public void setF16KV(Boolean f16kv)
设置F 16 KV。
Sets the f 16 KV.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
f16kv | Boolean | f 16 kv(类型 `Boolean`)。The f 16 kv. |
io/agentscope/extensions/model/ollama/options/OllamaOptions.java:673–675getLogitsAll
public Boolean getLogitsAll()
获取 getLogitsAll。
Returns the logits all.
Booleanio/agentscope/extensions/model/ollama/options/OllamaOptions.java:677–679setLogitsAll
public void setLogitsAll(Boolean logitsAll)
设置 setLogitsAll。
Sets the logits all.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
logitsAll | Boolean | logits 所有(类型 `Boolean`)。The logits all. |
io/agentscope/extensions/model/ollama/options/OllamaOptions.java:681–683getVocabOnly
public Boolean getVocabOnly()
获取 getVocabOnly。
Returns the vocab only.
Booleanio/agentscope/extensions/model/ollama/options/OllamaOptions.java:685–687setVocabOnly
public void setVocabOnly(Boolean vocabOnly)
设置 setVocabOnly。
Sets the vocab only.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
vocabOnly | Boolean | vocab Only(类型 `Boolean`)。The vocab only. |
io/agentscope/extensions/model/ollama/options/OllamaOptions.java:689–691getUseMMap
public Boolean getUseMMap()
获取使用 M 映射。
Returns the use m map.
Booleanio/agentscope/extensions/model/ollama/options/OllamaOptions.java:693–695setUseMMap
public void setUseMMap(Boolean useMMap)
设置使用 M 映射。
Sets the use m map.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
useMMap | Boolean | 使用 M 映射(类型 `Boolean`)。The use m map. |
io/agentscope/extensions/model/ollama/options/OllamaOptions.java:697–699getUseMLock
public Boolean getUseMLock()
获取使用 M 锁。
Returns the use m lock.
Booleanio/agentscope/extensions/model/ollama/options/OllamaOptions.java:701–703setUseMLock
public void setUseMLock(Boolean useMLock)
设置使用 M 锁。
Sets the use m lock.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
useMLock | Boolean | 使用 M 锁(类型 `Boolean`)。The use m lock. |
io/agentscope/extensions/model/ollama/options/OllamaOptions.java:705–707getNumThread
public Integer getNumThread()
获取 getNumThread。
Returns the num thread.
Integerio/agentscope/extensions/model/ollama/options/OllamaOptions.java:709–711setNumThread
public void setNumThread(Integer numThread)
设置 setNumThread。
Sets the num thread.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
numThread | Integer | num 会话线程(类型 `Integer`)。The num thread. |
io/agentscope/extensions/model/ollama/options/OllamaOptions.java:713–715getNumKeep
public Integer getNumKeep()
获取 getNumKeep。
Returns the num keep.
Integerio/agentscope/extensions/model/ollama/options/OllamaOptions.java:717–719setNumKeep
public void setNumKeep(Integer numKeep)
设置 setNumKeep。
Sets the num keep.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
numKeep | Integer | num Keep(类型 `Integer`)。The num keep. |
io/agentscope/extensions/model/ollama/options/OllamaOptions.java:721–723getSeed
public Integer getSeed()
获取预置。
Returns the seed.
Integerio/agentscope/extensions/model/ollama/options/OllamaOptions.java:725–727setSeed
public void setSeed(Integer seed)
设置预置。
Sets the seed.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
seed | Integer | 预置(类型 `Integer`)。The seed. |
io/agentscope/extensions/model/ollama/options/OllamaOptions.java:729–731getMaxTokens
public Integer getMaxTokens()
获取最大令牌数。
Returns the max tokens.
Integerio/agentscope/extensions/model/ollama/options/OllamaOptions.java:733–735setMaxTokens
public void setMaxTokens(Integer maxTokens)
设置最大令牌数。
Sets the max tokens.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
maxTokens | Integer | 最大令牌数(类型 `Integer`)。The max tokens. |
io/agentscope/extensions/model/ollama/options/OllamaOptions.java:737–739getNumPredict
public Integer getNumPredict()
获取 getNumPredict。
Returns the num predict.
Integerio/agentscope/extensions/model/ollama/options/OllamaOptions.java:741–743setNumPredict
public void setNumPredict(Integer numPredict)
设置 setNumPredict。
Sets the num predict.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
numPredict | Integer | num Predict(类型 `Integer`)。The num predict. |
io/agentscope/extensions/model/ollama/options/OllamaOptions.java:745–747getTopK
public Integer getTopK()
获取 getTopK。
Returns the top k.
Integerio/agentscope/extensions/model/ollama/options/OllamaOptions.java:749–751setTopK
public void setTopK(Integer topK)
设置 setTopK。
Sets the top k.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
topK | Integer | top K(类型 `Integer`)。The top k. |
io/agentscope/extensions/model/ollama/options/OllamaOptions.java:753–755getTopP
public Double getTopP()
获取 getTopP。
Returns the top p.
Doubleio/agentscope/extensions/model/ollama/options/OllamaOptions.java:757–759setTopP
public void setTopP(Double topP)
设置 setTopP。
Sets the top p.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
topP | Double | top P(类型 `Double`)。The top p. |
io/agentscope/extensions/model/ollama/options/OllamaOptions.java:761–763getMinP
public Double getMinP()
获取最小 P。
Returns the min p.
Doubleio/agentscope/extensions/model/ollama/options/OllamaOptions.java:765–767setMinP
public void setMinP(Double minP)
设置最小 P。
Sets the min p.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
minP | Double | 最小 P(类型 `Double`)。The min p. |
io/agentscope/extensions/model/ollama/options/OllamaOptions.java:769–771getTfsZ
public Float getTfsZ()
获取 getTfsZ。
Returns the tfs z.
Floatio/agentscope/extensions/model/ollama/options/OllamaOptions.java:773–775setTfsZ
public void setTfsZ(Float tfsZ)
设置 setTfsZ。
Sets the tfs z.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
tfsZ | Float | tfs Z(类型 `Float`)。The tfs z. |
io/agentscope/extensions/model/ollama/options/OllamaOptions.java:777–779getTypicalP
public Float getTypicalP()
获取 getTypicalP。
Returns the typical p.
Floatio/agentscope/extensions/model/ollama/options/OllamaOptions.java:781–783setTypicalP
public void setTypicalP(Float typicalP)
设置 setTypicalP。
Sets the typical p.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
typicalP | Float | typical P(类型 `Float`)。The typical p. |
io/agentscope/extensions/model/ollama/options/OllamaOptions.java:785–787getRepeatLastN
public Integer getRepeatLastN()
获取 getRepeatLastN。
Returns the repeat last n.
Integerio/agentscope/extensions/model/ollama/options/OllamaOptions.java:789–791setRepeatLastN
public void setRepeatLastN(Integer repeatLastN)
设置 setRepeatLastN。
Sets the repeat last n.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
repeatLastN | Integer | repeat 最后 N(类型 `Integer`)。The repeat last n. |
io/agentscope/extensions/model/ollama/options/OllamaOptions.java:793–795getTemperature
public Double getTemperature()
获取 getTemperature。
Returns the temperature.
Doubleio/agentscope/extensions/model/ollama/options/OllamaOptions.java:797–799setTemperature
public void setTemperature(Double temperature)
设置 setTemperature。
Sets the temperature.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
temperature | Double | temperature(类型 `Double`)。The temperature. |
io/agentscope/extensions/model/ollama/options/OllamaOptions.java:801–803getRepeatPenalty
public Double getRepeatPenalty()
获取 getRepeatPenalty。
Returns the repeat penalty.
Doubleio/agentscope/extensions/model/ollama/options/OllamaOptions.java:805–807setRepeatPenalty
public void setRepeatPenalty(Double repeatPenalty)
设置 setRepeatPenalty。
Sets the repeat penalty.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
repeatPenalty | Double | repeat Penalty(类型 `Double`)。The repeat penalty. |
io/agentscope/extensions/model/ollama/options/OllamaOptions.java:809–811getPresencePenalty
public Double getPresencePenalty()
获取 getPresencePenalty。
Returns the presence penalty.
Doubleio/agentscope/extensions/model/ollama/options/OllamaOptions.java:813–815setPresencePenalty
public void setPresencePenalty(Double presencePenalty)
设置 setPresencePenalty。
Sets the presence penalty.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
presencePenalty | Double | 在线状态 Penalty(类型 `Double`)。The presence penalty. |
io/agentscope/extensions/model/ollama/options/OllamaOptions.java:817–819getFrequencyPenalty
public Double getFrequencyPenalty()
获取 getFrequencyPenalty。
Returns the frequency penalty.
Doubleio/agentscope/extensions/model/ollama/options/OllamaOptions.java:821–823setFrequencyPenalty
public void setFrequencyPenalty(Double frequencyPenalty)
设置 setFrequencyPenalty。
Sets the frequency penalty.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
frequencyPenalty | Double | frequency Penalty(类型 `Double`)。The frequency penalty. |
io/agentscope/extensions/model/ollama/options/OllamaOptions.java:825–827getMirostat
public Integer getMirostat()
获取 getMirostat。
Returns the mirostat.
Integerio/agentscope/extensions/model/ollama/options/OllamaOptions.java:829–831setMirostat
public void setMirostat(Integer mirostat)
设置 setMirostat。
Sets the mirostat.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
mirostat | Integer | mirostat(类型 `Integer`)。The mirostat. |
io/agentscope/extensions/model/ollama/options/OllamaOptions.java:833–835getMirostatTau
public Float getMirostatTau()
获取 getMirostatTau。
Returns the mirostat tau.
Floatio/agentscope/extensions/model/ollama/options/OllamaOptions.java:837–839setMirostatTau
public void setMirostatTau(Float mirostatTau)
设置 setMirostatTau。
Sets the mirostat tau.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
mirostatTau | Float | mirostat Tau(类型 `Float`)。The mirostat tau. |
io/agentscope/extensions/model/ollama/options/OllamaOptions.java:841–843getMirostatEta
public Float getMirostatEta()
获取 getMirostatEta。
Returns the mirostat eta.
Floatio/agentscope/extensions/model/ollama/options/OllamaOptions.java:845–847setMirostatEta
public void setMirostatEta(Float mirostatEta)
设置 setMirostatEta。
Sets the mirostat eta.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
mirostatEta | Float | mirostat Eta(类型 `Float`)。The mirostat eta. |
io/agentscope/extensions/model/ollama/options/OllamaOptions.java:849–851getPenalizeNewline
public Boolean getPenalizeNewline()
获取 getPenalizeNewline。
Returns the penalize newline.
Booleanio/agentscope/extensions/model/ollama/options/OllamaOptions.java:853–855setPenalizeNewline
public void setPenalizeNewline(Boolean penalizeNewline)
设置 setPenalizeNewline。
Sets the penalize newline.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
penalizeNewline | Boolean | penalize Newline(类型 `Boolean`)。The penalize newline. |
io/agentscope/extensions/model/ollama/options/OllamaOptions.java:857–859getStopSequences
public List<String> getStopSequences()
获取 getStopSequences。
Returns the stop sequences.
List<String>io/agentscope/extensions/model/ollama/options/OllamaOptions.java:861–863setStopSequences
public void setStopSequences(List<String> stopSequences)
设置 setStopSequences。
Sets the stop sequences.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
stopSequences | List<String> | 停止 Sequences(类型 `List`)。The stop sequences. |
io/agentscope/extensions/model/ollama/options/OllamaOptions.java:865–867getStop
public List<String> getStop()
获取停止。
Returns the stop.
List<String>io/agentscope/extensions/model/ollama/options/OllamaOptions.java:869–871setStop
public void setStop(List<String> stop)
设置停止。
Sets the stop.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
stop | List<String> | 停止(类型 `List`)。The stop. |
io/agentscope/extensions/model/ollama/options/OllamaOptions.java:873–875getTruncate
public Boolean getTruncate()
获取 getTruncate。
Returns the truncate.
Booleanio/agentscope/extensions/model/ollama/options/OllamaOptions.java:877–879setTruncate
public void setTruncate(Boolean truncate)
设置 setTruncate。
Sets the truncate.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
truncate | Boolean | truncate(类型 `Boolean`)。The truncate. |
io/agentscope/extensions/model/ollama/options/OllamaOptions.java:881–883getThinkOption
public ThinkOption getThinkOption()
获取 getThinkOption。
Returns the think option.
ThinkOptionio/agentscope/extensions/model/ollama/options/OllamaOptions.java:885–887setThinkOption
public void setThinkOption(ThinkOption thinkOption)
设置 setThinkOption。
Sets the think option.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
thinkOption | ThinkOption | think 选项(类型 `ThinkOption`)。The think option. |
io/agentscope/extensions/model/ollama/options/OllamaOptions.java:889–891getExecutionConfig
public ExecutionConfig getExecutionConfig()
获取执行配置。
Returns the execution config.
ExecutionConfigio/agentscope/extensions/model/ollama/options/OllamaOptions.java:893–895setExecutionConfig
public void setExecutionConfig(ExecutionConfig executionConfig)
设置执行配置。
Sets the execution config.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
executionConfig | ExecutionConfig | 执行配置(类型 `ExecutionConfig`)。The execution config. |
io/agentscope/extensions/model/ollama/options/OllamaOptions.java:897–899toMap
public Map<String, Object> toMap()
返回到映射。
Serializes the OllamaOptions into a Map representation.
Map<String, Object>io/agentscope/extensions/model/ollama/options/OllamaOptions.java:905–907copy
public OllamaOptions copy()
返回 copy 结果。
Returns the copy.
OllamaOptionsio/agentscope/extensions/model/ollama/options/OllamaOptions.java:909–911merge
public OllamaOptions merge(GenerateOptions other)
设置该参数。
Merges the given GenerateOptions into a new instance, with the given options taking precedence.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
other | GenerateOptions | other(类型 `GenerateOptions`)。The options to merge (can be null). |
OllamaOptionsio/agentscope/extensions/model/ollama/options/OllamaOptions.java:922–927merge
public OllamaOptions merge(OllamaOptions other)
设置该参数。
Merges the given options into a new instance, with the given options taking precedence.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
other | OllamaOptions | other(类型 `OllamaOptions`)。The options to merge (can be null). |
OllamaOptionsio/agentscope/extensions/model/ollama/options/OllamaOptions.java:935–981toBuilder
public Builder toBuilder()
返回到构建器。
Returns the to builder.
Builderio/agentscope/extensions/model/ollama/options/OllamaOptions.java:983–1021equals
public boolean equals(Object o)
设置该参数。
Performs the equals operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
o | Object | o(类型 `Object`)。The o. |
booleanio/agentscope/extensions/model/ollama/options/OllamaOptions.java:1025–1069hashCode
public int hashCode()
返回 hashCode 结果。
Returns the hash code.
intio/agentscope/extensions/model/ollama/options/OllamaOptions.java:1071–1109嵌套类详情Nested Class Detail
ParamKey
public enum ParamKey定义参数键相关取值的枚举。位于 io.agentscope.extensions.model.ollama.options 包。核心成员包括 getKey、NUMA、NUM_CTX、NUM_BATCH、NUM_GPU、MAIN_GPU。
Keys for Ollama parameters.
Builder
public static final class Builder构建器,用于构建并配置目标实例。位于 io.agentscope.extensions.model.ollama.options 包。核心成员包括 model、format、keepAlive、truncate、executionConfig、useNUMA。
A class in io.agentscope.extensions.model.ollama.options that talks to model services and returns generated or embedded output. Declared in io.agentscope.extensions.model.ollama.options.