From 3d4f49b460a4ca7696592d701a9113c5702fffee Mon Sep 17 00:00:00 2001 From: Graham White Date: Fri, 30 Aug 2024 11:37:43 +0100 Subject: [PATCH] docs: make references to Tool and DynamicTool more accurate --- docs/tools.md | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/tools.md b/docs/tools.md index 9952f05d..547f67f3 100644 --- a/docs/tools.md +++ b/docs/tools.md @@ -10,7 +10,7 @@ These tools extend the agent's abilities, allowing it to interact with external ### Writing a new tool -To create a tool, the `Tool` or `DynamicTool` class must be implemented from [tools base](../src/tools/base.ts). When starting to write tools, it is recommended to implement the `Tool` class. The `DynamicTool` class is an extension of the `Tool` class that allows for dynamic forms of input. Refer to the list of [examples](#examples) for some simple examples or any of the built-in tools in order to guide the creation of new tools. +To create a tool, the `Tool` class must be extended/ implemented or `DynamicTool` created from [tools base](../src/tools/base.ts). When starting to write tools, it is recommended to implement the `Tool` class. The `DynamicTool` class is an extension of the `Tool` class that allows for dynamic forms of input. Refer to the list of [examples](#examples) for some simple examples or any of the built-in tools in order to guide the creation of new tools. Tools MUST do the following: @@ -53,23 +53,23 @@ Tools MUST do the following: - ```typescript - static { - this.register(); - } - ``` +```typescript +static { + this.register(); +} +``` - Implement the `_run()` method: - ```typescript - protected async _run(input: ToolInput, options?: BaseToolRunOptions) { - // insert custom code here - // MUST: return an instance of the output type specified in the tool class definition - // MAY: throw an instance of ToolError upon unrecoverable error conditions encountered by the tool - } - ``` +```typescript +protected async _run(input: ToolInput, options?: BaseToolRunOptions) { + // insert custom code here + // MUST: return an instance of the output type specified in the tool class definition + // MAY: throw an instance of ToolError upon unrecoverable error conditions encountered by the tool +} +``` ### Using tools with agents