AS AgentScopeAPI 手册 / API Reference

Builder

public static class Builder
源码Source io/agentscope/core/tool/ToolExecutionContext.java:205–309

ToolExecutionContext的构建器。位于 io.agentscope.core.tool 包。核心成员包括 register、addStore、build。

Builder for ToolExecutionContext.

方法摘要Method Summary

方法Method说明Description
public Builder register(Object object)
设置注册。
Registers an object by its runtime type (singleton pattern).
public T Builder register(Class<T> type, T object)
执行注册相关操作。
Registers an object with explicit type (e.g., by interface).
public T Builder register(String key, Class<T> type, T object)
执行注册相关操作。
Registers an object with key and type (multi-instance pattern).
public Builder register(String key, Object object)
执行注册相关操作。
Registers an object with key (type inferred from runtime).
public Builder addStore(ContextStore store)
添加存储。
Adds a single store to the store list.
public ToolExecutionContext build()
构建ToolExecutionContext。
Builds the ToolExecutionContext.

方法详情Method Detail

register

public Builder register(Object object)

设置注册。

Registers an object by its runtime type (singleton pattern).

参数Parameters
名称Name类型Type说明Description
objectObject对象到注册。The object to register
返回Returns Builder
返回当前实例,以支持链式调用。This builder
源码Source io/agentscope/core/tool/ToolExecutionContext.java:217–220

register

public T Builder register(Class<T> type, T object)

执行注册相关操作。

Registers an object with explicit type (e.g., by interface).

参数Parameters
名称Name类型Type说明Description
typeClass<T>类型密钥。The type key
objectT对象到注册。The object to register
返回Returns Builder
返回当前实例,以支持链式调用。This builder
源码Source io/agentscope/core/tool/ToolExecutionContext.java:230–233

register

public T Builder register(String key, Class<T> type, T object)

执行注册相关操作。

Registers an object with key and type (multi-instance pattern).

参数Parameters
名称Name类型Type说明Description
keyString键(类型 `String`)。The key identifying this instance
typeClass<T>类型密钥。The type key
objectT对象到注册。The object to register
返回Returns Builder
返回当前实例,以支持链式调用。This builder
源码Source io/agentscope/core/tool/ToolExecutionContext.java:244–247

register

public Builder register(String key, Object object)

执行注册相关操作。

Registers an object with key (type inferred from runtime).

参数Parameters
名称Name类型Type说明Description
keyString键(类型 `String`)。The key identifying this instance
objectObject对象到注册。The object to register
返回Returns Builder
返回当前实例,以支持链式调用。This builder
源码Source io/agentscope/core/tool/ToolExecutionContext.java:256–259

addStore

public Builder addStore(ContextStore store)

添加存储。

Adds a single store to the store list.

参数Parameters
名称Name类型Type说明Description
storeContextStore上下文存储到添加。The context store to add
返回Returns Builder
返回当前实例,以支持链式调用。This builder
源码Source io/agentscope/core/tool/ToolExecutionContext.java:283–289

build

public ToolExecutionContext build()

构建ToolExecutionContext。

Builds the ToolExecutionContext.

返回Returns ToolExecutionContext
一种新的ToolExecutionContext。A new ToolExecutionContext
源码Source io/agentscope/core/tool/ToolExecutionContext.java:296–308
基于官方固定版本源码静态生成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.