-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: initial commit of developer information about tools #7
docs: initial commit of developer information about tools #7
Conversation
f4ed0d8
to
99093e4
Compare
42bd06d
to
9524032
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! 🚀
However, I see some room for improvement, like:
- Provide a better explanation of
Tool
class generics and related generics. - Mention that zod schema is under the hood, converted to JSONSchema, and validated via Ajv. When the input is invalid,
ToolInputError
is thrown. - Mention that if one wants to use zod effects (somehow modify/transport/improve the validation process), it can be achieved via override
validateInput
method (seearxiv
tool where it is done). - Show an example with
DynamicTool
(feel free to seetests
for inspiration). - Clarify content of BaseToolOptions and BaseToolRunOptions interfaces.
- Use
camelCase
in naming files (helloworld.ts
->helloWorld.ts
).
Understanding why a tool must return a class that extendsBaseToolOutput
is crucial. This class provides you with thegetTextContent()
method that the agent/llm can use, ensuring the proper functioning of your tool.
docs/tools.md
Outdated
|
||
- Declare an input schema: | ||
|
||
This is used to define the format of the input to your tool. The agent will formalise the natural language input(s) it has received and structure them into the fields described in the tool's input. The input schema is specified using [Zod](https://github.com/colinhacks/zod). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- You can also use
JSONSchema
(butzod
is recommended). - Mention that
inputSchema
must always be an object and zod effects are not supported (z.object().transform(...)`). (https://github.com/i-am-bee/bee-agent-framework/blob/main/src/internals/helpers/schema.ts#L30-L41) inputSchema
must be a function (eitherasync
orsync
, but it must be a function due to internals).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment contradicts the comment at the top of the review. Would it be preferable to inform the users via this documentation that zod effects are not supported, or that they can be supported by that requires overriding the validateInput
function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've attempted an initial resolution in 3483a55 but this may need to be changed as a result of my above observation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Zod effects are basically some extra "application level" transformations that are not transferable to JSON Schema. But the framework (under the hoods) converts it to a JSON Schema. So to do something like "zod effects" you have to specify inputSchema
without them and do post-validation manually later in validateSchema
method.
The
inputSchema
definition must always be an object and pass validation by thevalidateSchema()
function defined in schema.ts.
This statement may sound like you are forcing the user to implement this feature. Either remove the statement or provide a simple example.
3d4f49b
to
8620cd4
Compare
6b14b98
to
c9b87d1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding a link from README.md
to tools.md
Fixed in ac327b0 (the link will be broken until this PR is merged as the tools file doesn't currently exist on the main branch) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add one of the following secrets to your fork so the GitHub action can pass E2E Tests.
GENAI_API_KEY="..."
WATSONX_API_KEY="..."
OPENAI_API_KEY="..."
One of them should be enough (ideally BAM - GENAI_API_KEY
)
GENAI_API_KEY is now added and the above comments are addressed in f94bea5 |
f94bea5
to
7eb8b65
Compare
924c70a
to
e8e13c5
Compare
No description provided.