类class
agentscope.toolRegisteredTool
@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 |
|---|---|---|---|
tool | ToolBase | 工具字段。 | — |
extended_model | Type[BaseModel] | None | `extended_model` 字段。 | field(init=False, default=None) |
group | str | Literal['basic'] | 组字段。 | 'basic' |
original_name | str | 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:29extended_model
Type[BaseModel] | None = field(init=False, default=None)extended_model 字段。声明为 Type[BaseModel] | None。
The extended model field.
源码Source
agentscope/tool/_types.py:33group
str | Literal['basic'] = 'basic'组字段。声明为 str | Literal['basic']。
The group field.
源码Source
agentscope/tool/_types.py:38original_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 None | Type[BaseModel] | None | extended 模型(类型 `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. |
dict
工具函数的`dict`:JSON 模式。`dict`: The JSON schema of the tool function.
源码Source
agentscope/tool/_types.py:56–153