AS AgentScopeAPI 手册 / API Reference

Builder

public static final class Builder
源码Source io/agentscope/extensions/model/ollama/options/OllamaOptions.java:1162–1349

构建器,用于构建并配置目标实例。位于 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.

方法摘要Method Summary

方法Method说明Description
public Builder model(String model)
设置模型。
Performs the model operation.
public Builder format(Object format)
设置格式。
Performs the format operation.
public Builder keepAlive(String keepAlive)
设置该配置项。
Performs the keep alive operation.
public Builder truncate(Boolean truncate)
设置该配置项。
Performs the truncate operation.
public Builder executionConfig(ExecutionConfig executionConfig)
设置执行配置。
Performs the execution config operation.
public Builder useNUMA(Boolean useNUMA)
设置使用 NUMA。
Performs the use NUMA operation.
public Builder numCtx(Integer numCtx)
设置该配置项。
Performs the num ctx operation.
public Builder numBatch(Integer numBatch)
设置该配置项。
Performs the num batch operation.
public Builder numGPU(Integer numGPU)
设置该配置项。
Performs the num GPU operation.
public Builder mainGPU(Integer mainGPU)
设置主 GPU。
Performs the main GPU operation.
public Builder lowVRAM(Boolean lowVRAM)
设置该配置项。
Performs the low VRAM operation.
public Builder f16KV(Boolean f16KV)
设置f 16 KV。
Performs the f 16 KV operation.
public Builder logitsAll(Boolean logitsAll)
设置该配置项。
Performs the logits all operation.
public Builder vocabOnly(Boolean vocabOnly)
设置该配置项。
Performs the vocab only operation.
public Builder useMMap(Boolean useMMap)
设置使用 M 映射。
Performs the use m map operation.
public Builder useMLock(Boolean useMLock)
设置使用 M 锁。
Performs the use m lock operation.
public Builder numThread(Integer numThread)
设置该配置项。
Performs the num thread operation.
public Builder numKeep(Integer numKeep)
设置该配置项。
Performs the num keep operation.
public Builder seed(Integer seed)
设置预置。
Performs the seed operation.
public Builder numPredict(Integer numPredict)
设置该配置项。
Performs the num predict operation.
public Builder topK(Integer topK)
设置该配置项。
Performs the top k operation.
public Builder topP(Double topP)
设置该配置项。
Performs the top p operation.
public Builder minP(Double minP)
设置最小 P。
Performs the min p operation.
public Builder tfsZ(Float tfsZ)
设置该配置项。
Performs the tfs z operation.
public Builder typicalP(Float typicalP)
设置该配置项。
Performs the typical p operation.
public Builder repeatLastN(Integer repeatLastN)
设置该配置项。
Performs the repeat last n operation.
public Builder temperature(Double temperature)
设置该配置项。
Performs the temperature operation.
public Builder repeatPenalty(Double repeatPenalty)
设置该配置项。
Performs the repeat penalty operation.
public Builder presencePenalty(Double presencePenalty)
设置该配置项。
Performs the presence penalty operation.
public Builder frequencyPenalty(Double frequencyPenalty)
设置该配置项。
Performs the frequency penalty operation.
public Builder mirostat(Integer mirostat)
设置该配置项。
Performs the mirostat operation.
public Builder mirostatTau(Float mirostatTau)
设置该配置项。
Performs the mirostat tau operation.
public Builder mirostatEta(Float mirostatEta)
设置该配置项。
Performs the mirostat eta operation.
public Builder penalizeNewline(Boolean penalizeNewline)
设置该配置项。
Performs the penalize newline operation.
public Builder stop(List<String> stop)
设置停止。
Performs the stop operation.
public Builder thinkOption(ThinkOption thinkOption)
设置该配置项。
Performs the think option operation.
public OllamaOptions build()
构建并返回最终实例。
Creates and returns an instance.

方法详情Method Detail

model

public Builder model(String model)

设置模型。

Performs the model operation.

参数Parameters
名称Name类型Type说明Description
modelString模型实例(类型 `String`)。The model.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/model/ollama/options/OllamaOptions.java:1166–1169

format

public Builder format(Object format)

设置格式。

Performs the format operation.

参数Parameters
名称Name类型Type说明Description
formatObject格式(类型 `Object`)。The format.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/model/ollama/options/OllamaOptions.java:1171–1174

keepAlive

public Builder keepAlive(String keepAlive)

设置该配置项。

Performs the keep alive operation.

参数Parameters
名称Name类型Type说明Description
keepAliveStringkeep Alive(类型 `String`)。The keep alive.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/model/ollama/options/OllamaOptions.java:1176–1179

truncate

public Builder truncate(Boolean truncate)

设置该配置项。

Performs the truncate operation.

参数Parameters
名称Name类型Type说明Description
truncateBooleantruncate(类型 `Boolean`)。The truncate.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/model/ollama/options/OllamaOptions.java:1181–1184

executionConfig

public Builder executionConfig(ExecutionConfig executionConfig)

设置执行配置。

Performs the execution config operation.

参数Parameters
名称Name类型Type说明Description
executionConfigExecutionConfig执行配置(类型 `ExecutionConfig`)。The execution config.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/model/ollama/options/OllamaOptions.java:1186–1189

useNUMA

public Builder useNUMA(Boolean useNUMA)

设置使用 NUMA。

Performs the use NUMA operation.

参数Parameters
名称Name类型Type说明Description
useNUMABoolean使用 NUMA(类型 `Boolean`)。The use NUMA.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/model/ollama/options/OllamaOptions.java:1191–1194

numCtx

public Builder numCtx(Integer numCtx)

设置该配置项。

Performs the num ctx operation.

参数Parameters
名称Name类型Type说明Description
numCtxIntegernum Ctx(类型 `Integer`)。The num ctx.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/model/ollama/options/OllamaOptions.java:1196–1199

numBatch

public Builder numBatch(Integer numBatch)

设置该配置项。

Performs the num batch operation.

参数Parameters
名称Name类型Type说明Description
numBatchIntegernum Batch(类型 `Integer`)。The num batch.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/model/ollama/options/OllamaOptions.java:1201–1204

numGPU

public Builder numGPU(Integer numGPU)

设置该配置项。

Performs the num GPU operation.

参数Parameters
名称Name类型Type说明Description
numGPUIntegernum GPU(类型 `Integer`)。The num GPU.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/model/ollama/options/OllamaOptions.java:1206–1209

mainGPU

public Builder mainGPU(Integer mainGPU)

设置主 GPU。

Performs the main GPU operation.

参数Parameters
名称Name类型Type说明Description
mainGPUInteger主 GPU(类型 `Integer`)。The main GPU.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/model/ollama/options/OllamaOptions.java:1211–1214

lowVRAM

public Builder lowVRAM(Boolean lowVRAM)

设置该配置项。

Performs the low VRAM operation.

参数Parameters
名称Name类型Type说明Description
lowVRAMBooleanlow VRAM(类型 `Boolean`)。The low VRAM.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/model/ollama/options/OllamaOptions.java:1216–1219

f16KV

public Builder f16KV(Boolean f16KV)

设置f 16 KV。

Performs the f 16 KV operation.

参数Parameters
名称Name类型Type说明Description
f16KVBooleanf 16 KV(类型 `Boolean`)。The f 16 KV.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/model/ollama/options/OllamaOptions.java:1221–1224

logitsAll

public Builder logitsAll(Boolean logitsAll)

设置该配置项。

Performs the logits all operation.

参数Parameters
名称Name类型Type说明Description
logitsAllBooleanlogits 所有(类型 `Boolean`)。The logits all.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/model/ollama/options/OllamaOptions.java:1226–1229

vocabOnly

public Builder vocabOnly(Boolean vocabOnly)

设置该配置项。

Performs the vocab only operation.

参数Parameters
名称Name类型Type说明Description
vocabOnlyBooleanvocab Only(类型 `Boolean`)。The vocab only.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/model/ollama/options/OllamaOptions.java:1231–1234

useMMap

public Builder useMMap(Boolean useMMap)

设置使用 M 映射。

Performs the use m map operation.

参数Parameters
名称Name类型Type说明Description
useMMapBoolean使用 M 映射(类型 `Boolean`)。The use m map.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/model/ollama/options/OllamaOptions.java:1236–1239

useMLock

public Builder useMLock(Boolean useMLock)

设置使用 M 锁。

Performs the use m lock operation.

参数Parameters
名称Name类型Type说明Description
useMLockBoolean使用 M 锁(类型 `Boolean`)。The use m lock.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/model/ollama/options/OllamaOptions.java:1241–1244

numThread

public Builder numThread(Integer numThread)

设置该配置项。

Performs the num thread operation.

参数Parameters
名称Name类型Type说明Description
numThreadIntegernum 会话线程(类型 `Integer`)。The num thread.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/model/ollama/options/OllamaOptions.java:1246–1249

numKeep

public Builder numKeep(Integer numKeep)

设置该配置项。

Performs the num keep operation.

参数Parameters
名称Name类型Type说明Description
numKeepIntegernum Keep(类型 `Integer`)。The num keep.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/model/ollama/options/OllamaOptions.java:1251–1254

seed

public Builder seed(Integer seed)

设置预置。

Performs the seed operation.

参数Parameters
名称Name类型Type说明Description
seedInteger预置(类型 `Integer`)。The seed.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/model/ollama/options/OllamaOptions.java:1256–1259

numPredict

public Builder numPredict(Integer numPredict)

设置该配置项。

Performs the num predict operation.

参数Parameters
名称Name类型Type说明Description
numPredictIntegernum Predict(类型 `Integer`)。The num predict.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/model/ollama/options/OllamaOptions.java:1261–1264

topK

public Builder topK(Integer topK)

设置该配置项。

Performs the top k operation.

参数Parameters
名称Name类型Type说明Description
topKIntegertop K(类型 `Integer`)。The top k.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/model/ollama/options/OllamaOptions.java:1266–1269

topP

public Builder topP(Double topP)

设置该配置项。

Performs the top p operation.

参数Parameters
名称Name类型Type说明Description
topPDoubletop P(类型 `Double`)。The top p.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/model/ollama/options/OllamaOptions.java:1271–1274

minP

public Builder minP(Double minP)

设置最小 P。

Performs the min p operation.

参数Parameters
名称Name类型Type说明Description
minPDouble最小 P(类型 `Double`)。The min p.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/model/ollama/options/OllamaOptions.java:1276–1279

tfsZ

public Builder tfsZ(Float tfsZ)

设置该配置项。

Performs the tfs z operation.

参数Parameters
名称Name类型Type说明Description
tfsZFloattfs Z(类型 `Float`)。The tfs z.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/model/ollama/options/OllamaOptions.java:1281–1284

typicalP

public Builder typicalP(Float typicalP)

设置该配置项。

Performs the typical p operation.

参数Parameters
名称Name类型Type说明Description
typicalPFloattypical P(类型 `Float`)。The typical p.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/model/ollama/options/OllamaOptions.java:1286–1289

repeatLastN

public Builder repeatLastN(Integer repeatLastN)

设置该配置项。

Performs the repeat last n operation.

参数Parameters
名称Name类型Type说明Description
repeatLastNIntegerrepeat 最后 N(类型 `Integer`)。The repeat last n.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/model/ollama/options/OllamaOptions.java:1291–1294

temperature

public Builder temperature(Double temperature)

设置该配置项。

Performs the temperature operation.

参数Parameters
名称Name类型Type说明Description
temperatureDoubletemperature(类型 `Double`)。The temperature.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/model/ollama/options/OllamaOptions.java:1296–1299

repeatPenalty

public Builder repeatPenalty(Double repeatPenalty)

设置该配置项。

Performs the repeat penalty operation.

参数Parameters
名称Name类型Type说明Description
repeatPenaltyDoublerepeat Penalty(类型 `Double`)。The repeat penalty.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/model/ollama/options/OllamaOptions.java:1301–1304

presencePenalty

public Builder presencePenalty(Double presencePenalty)

设置该配置项。

Performs the presence penalty operation.

参数Parameters
名称Name类型Type说明Description
presencePenaltyDouble在线状态 Penalty(类型 `Double`)。The presence penalty.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/model/ollama/options/OllamaOptions.java:1306–1309

frequencyPenalty

public Builder frequencyPenalty(Double frequencyPenalty)

设置该配置项。

Performs the frequency penalty operation.

参数Parameters
名称Name类型Type说明Description
frequencyPenaltyDoublefrequency Penalty(类型 `Double`)。The frequency penalty.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/model/ollama/options/OllamaOptions.java:1311–1314

mirostat

public Builder mirostat(Integer mirostat)

设置该配置项。

Performs the mirostat operation.

参数Parameters
名称Name类型Type说明Description
mirostatIntegermirostat(类型 `Integer`)。The mirostat.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/model/ollama/options/OllamaOptions.java:1316–1319

mirostatTau

public Builder mirostatTau(Float mirostatTau)

设置该配置项。

Performs the mirostat tau operation.

参数Parameters
名称Name类型Type说明Description
mirostatTauFloatmirostat Tau(类型 `Float`)。The mirostat tau.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/model/ollama/options/OllamaOptions.java:1321–1324

mirostatEta

public Builder mirostatEta(Float mirostatEta)

设置该配置项。

Performs the mirostat eta operation.

参数Parameters
名称Name类型Type说明Description
mirostatEtaFloatmirostat Eta(类型 `Float`)。The mirostat eta.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/model/ollama/options/OllamaOptions.java:1326–1329

penalizeNewline

public Builder penalizeNewline(Boolean penalizeNewline)

设置该配置项。

Performs the penalize newline operation.

参数Parameters
名称Name类型Type说明Description
penalizeNewlineBooleanpenalize Newline(类型 `Boolean`)。The penalize newline.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/model/ollama/options/OllamaOptions.java:1331–1334

stop

public Builder stop(List<String> stop)

设置停止。

Performs the stop operation.

参数Parameters
名称Name类型Type说明Description
stopList<String>停止(类型 `List`)。The stop.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/model/ollama/options/OllamaOptions.java:1336–1339

thinkOption

public Builder thinkOption(ThinkOption thinkOption)

设置该配置项。

Performs the think option operation.

参数Parameters
名称Name类型Type说明Description
thinkOptionThinkOptionthink 选项(类型 `ThinkOption`)。The think option.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/model/ollama/options/OllamaOptions.java:1341–1344

build

public OllamaOptions build()

构建并返回最终实例。

Creates and returns an instance.

返回Returns OllamaOptions
返回OllamaOptions。Returns Ollama options.
源码Source io/agentscope/extensions/model/ollama/options/OllamaOptions.java:1346–1348
基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.