Builder
public static class Builder
源码Source
io/agentscope/core/agent/RuntimeContext.java:351–450构建器,用于构建并配置目标实例。位于 io.agentscope.core.agent 包。核心成员包括 sessionId、userId、agentState、put、putAll、from。
A class in io.agentscope.core.agent that drives agent reasoning, tool calls and conversation execution. Declared in io.agentscope.core.agent.
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public Builder sessionId(String sessionId) | 设置会话标识。 Performs the session id operation. |
public Builder userId(String userId) | 设置用户标识。 Performs the user id operation. |
public Builder agentState(AgentState agentState) | 设置智能体状态。 Performs the agent state operation. |
public Builder put(String key, Object value) | 设置该配置项。 Performs the put operation. |
public Builder putAll(Map<String, Object> extras) | 设置该配置项。 Performs the put all operation. |
public T Builder put(Class<T> type, T value) | 设置该配置项。 Performs the put operation. |
public T Builder put(String key, Class<T> type, T value) | 设置该配置项。 Performs the put operation. |
public Builder from(RuntimeContext source) | 创建并返回实例。 Creates and returns an instance. |
public Builder toolExecutionContext(ToolExecutionContext toolExecutionContext) | 设置工具执行上下文。 Nests a `ToolExecutionContext` (e.g. |
public Builder toolRequestConfig(ToolRequestConfig toolRequestConfig) | 设置工具请求配置。 Installs a per-call tool request config. |
public RuntimeContext build() | 构建并返回最终实例。 Creates and returns an instance. |
方法详情Method Detail
sessionId
public Builder sessionId(String sessionId)
设置会话标识。
Performs the session id operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sessionId | String | 会话标识(类型 `String`)。The session id. |
Builder返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source
io/agentscope/core/agent/RuntimeContext.java:360–363userId
public Builder userId(String userId)
设置用户标识。
Performs the user id operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
userId | String | 用户标识(类型 `String`)。The user id. |
Builder返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source
io/agentscope/core/agent/RuntimeContext.java:365–368agentState
public Builder agentState(AgentState agentState)
设置智能体状态。
Performs the agent state operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
agentState | AgentState | 智能体状态(类型 `AgentState`)。The agent state. |
Builder返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source
io/agentscope/core/agent/RuntimeContext.java:370–373put
public Builder put(String key, Object value)
设置该配置项。
Performs the put operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
key | String | 键(类型 `String`)。The key. |
value | Object | 值(类型 `Object`)。The value. |
Builder返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source
io/agentscope/core/agent/RuntimeContext.java:375–381putAll
public Builder putAll(Map<String, Object> extras)
设置该配置项。
Performs the put all operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
extras | Map<String, Object> | extras(类型 `Map`)。The extras. |
Builder返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source
io/agentscope/core/agent/RuntimeContext.java:383–392put
public T Builder put(Class<T> type, T value)
设置该配置项。
Performs the put operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
type | Class<T> | 类型(类型 `Class`)。The type. |
value | T | 值(类型 `T`)。The value. |
Builder返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source
io/agentscope/core/agent/RuntimeContext.java:394–396put
public T Builder put(String key, Class<T> type, T value)
设置该配置项。
Performs the put operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
key | String | 键(类型 `String`)。The key. |
type | Class<T> | 类型(类型 `Class`)。The type. |
value | T | 值(类型 `T`)。The value. |
Builder返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source
io/agentscope/core/agent/RuntimeContext.java:398–404from
public Builder from(RuntimeContext source)
创建并返回实例。
Creates and returns an instance.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
source | RuntimeContext | 来源(类型 `RuntimeContext`)。The source. |
Builder返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source
io/agentscope/core/agent/RuntimeContext.java:406–426toolExecutionContext
public Builder toolExecutionContext(ToolExecutionContext toolExecutionContext)
设置工具执行上下文。
Nests a ToolExecutionContext (e.g.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
toolExecutionContext | ToolExecutionContext | 工具执行上下文(类型 `ToolExecutionContext`)。The tool execution context. |
Builder返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source
io/agentscope/core/agent/RuntimeContext.java:432–435toolRequestConfig
public Builder toolRequestConfig(ToolRequestConfig toolRequestConfig)
设置工具请求配置。
Installs a per-call tool request config.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
toolRequestConfig | ToolRequestConfig | 工具请求配置(类型 `ToolRequestConfig`)。The tool request config. |
Builder返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source
io/agentscope/core/agent/RuntimeContext.java:442–445build
public RuntimeContext build()
构建并返回最终实例。
Creates and returns an instance.
RuntimeContext返回RuntimeContext。Returns runtime context.
源码Source
io/agentscope/core/agent/RuntimeContext.java:447–449