AS AgentScopeAPI 手册 / API Reference

Builder

public static class Builder
源码Source io/agentscope/extensions/model/ollama/dto/OllamaRequest.java:151–202

构建器,用于构建并配置目标实例。位于 io.agentscope.extensions.model.ollama.dto 包。核心成员包括 model、messages、stream、format、keepAlive、tools。

A class in io.agentscope.extensions.model.ollama.dto that talks to model services and returns generated or embedded output. Declared in io.agentscope.extensions.model.ollama.dto.

方法摘要Method Summary

方法Method说明Description
public Builder model(String model)
设置模型。
Performs the model operation.
public Builder messages(List<OllamaMessage> messages)
设置消息。
Performs the messages operation.
public Builder stream(Boolean stream)
设置流。
Performs the stream operation.
public Builder format(Object format)
设置格式。
Performs the format operation.
public Builder keepAlive(String keepAlive)
设置该配置项。
Performs the keep alive operation.
public Builder tools(List<OllamaTool> tools)
设置工具。
Performs the tools operation.
public Builder toolChoice(Object toolChoice)
设置工具选项。
Performs the tool choice operation.
public Builder think(Object think)
设置该配置项。
Performs the think operation.
public Builder options(Map<String, Object> options)
设置选项。
Performs the options operation.
public OllamaRequest 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/dto/OllamaRequest.java:154–157

messages

public Builder messages(List<OllamaMessage> messages)

设置消息。

Performs the messages operation.

参数Parameters
名称Name类型Type说明Description
messagesList<OllamaMessage>消息列表(类型 `List`)。The messages.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/model/ollama/dto/OllamaRequest.java:159–162

stream

public Builder stream(Boolean stream)

设置流。

Performs the stream operation.

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

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/dto/OllamaRequest.java:169–172

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/dto/OllamaRequest.java:174–177

tools

public Builder tools(List<OllamaTool> tools)

设置工具。

Performs the tools operation.

参数Parameters
名称Name类型Type说明Description
toolsList<OllamaTool>工具列表(类型 `List`)。The tools.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/model/ollama/dto/OllamaRequest.java:179–182

toolChoice

public Builder toolChoice(Object toolChoice)

设置工具选项。

Performs the tool choice operation.

参数Parameters
名称Name类型Type说明Description
toolChoiceObject工具选项(类型 `Object`)。The tool choice.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/model/ollama/dto/OllamaRequest.java:184–187

think

public Builder think(Object think)

设置该配置项。

Performs the think operation.

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

options

public Builder options(Map<String, Object> options)

设置选项。

Performs the options operation.

参数Parameters
名称Name类型Type说明Description
optionsMap<String, Object>选项(类型 `Map`)。The options.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/model/ollama/dto/OllamaRequest.java:194–197

build

public OllamaRequest build()

构建并返回最终实例。

Creates and returns an instance.

返回Returns OllamaRequest
返回OllamaRequest。Returns Ollama request.
源码Source io/agentscope/extensions/model/ollama/dto/OllamaRequest.java:199–201
基于官方固定版本源码静态生成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.