AS AgentScopeAPI 手册 / API Reference
类class agentscope.tool

RegisteredTool

@dataclass
class RegisteredTool
源码Source agentscope/tool/_types.py:25–153

已注册工具,封装可被智能体调用的能力。位于 agentscope.tool 包。核心成员包括 get_tool_schema。

The registered tool function class, used to store the tool function and its registration information. Declared in agentscope.tool.

属性摘要Attribute Summary

属性Attribute类型Type说明Description值Value
toolToolBase
工具字段。
—
extended_modelType[BaseModel] | None
`extended_model` 字段。
field(init=False, default=None)
groupstr | Literal['basic']
组字段。
'basic'
original_namestr | None
`original_name` 字段。
field(default=None)

方法摘要Method Summary

方法Method说明Description
def get_tool_schema(extended_model: Type[BaseModel] | None = None) -> dict
获取工具模式。
Get the JSON schema of the tool function via the following steps:

属性详情Attribute Detail

tool

ToolBase

工具字段。声明为 ToolBase。

The tool field.

源码Source agentscope/tool/_types.py:29

extended_model

Type[BaseModel] | None = field(init=False, default=None)

extended_model 字段。声明为 Type[BaseModel] | None。

The extended model field.

源码Source agentscope/tool/_types.py:33

group

str | Literal['basic'] = 'basic'

组字段。声明为 str | Literal['basic']。

The group field.

源码Source agentscope/tool/_types.py:38

original_name

str | None = field(default=None)

original_name 字段。声明为 str | None。

The original name field.

源码Source agentscope/tool/_types.py:40

方法详情Method Detail

get_tool_schema

def get_tool_schema(extended_model: Type[BaseModel] | None = None) -> dict

获取工具模式。

1.

参数Parameters
名称Name类型Type说明Description
extended_model默认default NoneType[BaseModel] | Noneextended 模型(类型 `Type[BaseModel] | None`)。The dynamic BaseModel used to extend the original function. If provided, the given BaseModel will be merged into the original function schema instead of the extended_model field.
返回Returns dict
工具函数的`dict`:JSON 模式。`dict`: The JSON schema of the tool function.
源码Source agentscope/tool/_types.py:56–153
基于官方固定版本源码静态生成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.