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 |
|---|---|---|
model | String | 模型实例(类型 `String`)。The model. |
Builder返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source
io/agentscope/extensions/model/ollama/dto/OllamaRequest.java:154–157messages
public Builder messages(List<OllamaMessage> messages)
设置消息。
Performs the messages operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
messages | List<OllamaMessage> | 消息列表(类型 `List`)。The messages. |
Builder返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source
io/agentscope/extensions/model/ollama/dto/OllamaRequest.java:159–162stream
public Builder stream(Boolean stream)
设置流。
Performs the stream operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
stream | Boolean | 流(类型 `Boolean`)。The stream. |
Builder返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source
io/agentscope/extensions/model/ollama/dto/OllamaRequest.java:164–167format
public Builder format(Object format)
设置格式。
Performs the format operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
format | Object | 格式(类型 `Object`)。The format. |
Builder返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source
io/agentscope/extensions/model/ollama/dto/OllamaRequest.java:169–172keepAlive
public Builder keepAlive(String keepAlive)
设置该配置项。
Performs the keep alive operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
keepAlive | String | keep Alive(类型 `String`)。The keep alive. |
Builder返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source
io/agentscope/extensions/model/ollama/dto/OllamaRequest.java:174–177tools
public Builder tools(List<OllamaTool> tools)
设置工具。
Performs the tools operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
tools | List<OllamaTool> | 工具列表(类型 `List`)。The tools. |
Builder返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source
io/agentscope/extensions/model/ollama/dto/OllamaRequest.java:179–182toolChoice
public Builder toolChoice(Object toolChoice)
设置工具选项。
Performs the tool choice operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
toolChoice | Object | 工具选项(类型 `Object`)。The tool choice. |
Builder返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source
io/agentscope/extensions/model/ollama/dto/OllamaRequest.java:184–187think
public Builder think(Object think)
设置该配置项。
Performs the think operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
think | Object | think(类型 `Object`)。The think. |
Builder返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source
io/agentscope/extensions/model/ollama/dto/OllamaRequest.java:189–192options
public Builder options(Map<String, Object> options)
设置选项。
Performs the options operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
options | Map<String, Object> | 选项(类型 `Map`)。The options. |
Builder返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source
io/agentscope/extensions/model/ollama/dto/OllamaRequest.java:194–197build
public OllamaRequest build()
构建并返回最终实例。
Creates and returns an instance.
OllamaRequest返回OllamaRequest。Returns Ollama request.
源码Source
io/agentscope/extensions/model/ollama/dto/OllamaRequest.java:199–201