Adds structured tool chat agent and DynamicStructuredTool class (#1103)

* [WIP] Structured tool input agent

* Clean up typing

* Update StructuredChatAgent prompt, adds integration test and validation preventing StructuredTools being passed into existing agents

* Undo change to make existing agents less strictly typed, use overload signatures for initialize

* Update parsing logic for retries

* Update test cases

* Progress on structured chat agent

* Pass tool names into structured chat output fixing parser for more reliability

* Revert output parser getFormatInstructions method signature change

* Adds StructuredDynamicTool, docs

* add renderTemplate call to format instructions, change StructuredDynamicTool to DynamicStructuredTool

* Formatting

---------

Co-authored-by: vowelparrot <130414180+vowelparrot@users.noreply.github.com>
Co-authored-by: Jacob Lee <jacob@autocode.com>
Co-authored-by: Nuno Campos <nuno@boringbits.io>
This commit is contained in:
Jacob Lee
2023-05-19 07:48:09 -07:00
committed by GitHub
parent 7d09e9d395
commit c8d4e6bf7e
18 changed files with 656 additions and 30 deletions
@@ -0,0 +1,16 @@
---
hide_table_of_contents: true
sidebar_position: 4
---
import CodeBlock from "@theme/CodeBlock";
import Example from "@examples/agents/structured_chat.ts";
# Structured Tool Chat Agent
Structured Tool Chat Agents are designed to work with tools that take an input conforming to an arbitrary object schema, in contrast to other agents that only support tools that take a single string as input.
This makes it easier to create and use tools that require multiple input values - rather than prompting for a stringified object or comma separated list, you can specify an object with multiple keys.
Here's an example with a `DynamicStructuredTool`:
<CodeBlock language="typescript">{Example}</CodeBlock>