-
Notifications
You must be signed in to change notification settings - Fork 498
Update quickstart.mdx - outdated example for tool call. #192
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
Conversation
The given example doesn’t work anymore because the “parameters” field is now required.
|
seratch
left a comment
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.
Thank you for sending this PR! Left a few comments
| properties: {}, | ||
| required: [], | ||
| additionalProperties: false | ||
| } |
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.
comma is missing:
| } | |
| }, |
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.
If you have more time to tweak this, we prefer a slightly simpler one like:
import { Agent, run, tool } from '@openai/agents';
import { z } from 'zod';
const historyFunFact = tool({
// The name of the tool will be used by the agent to tell what tool to use.
name: 'history_fun_fact',
// The description is used to describe **when** to use the tool by telling it **what** it does.
description: 'Give a fun fact about a historical event',
// This agent takes no parameters, so we provide an empty JSON schema.
parameters: z.object({}),
execute: async () => {
// The output will be returned back to the Agent to use
return 'Sharks are older than trees.';
},
});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.
Hi @seratch, thanks for your response. I had already tried it as you suggested, using an empty Zod object, but I wasn’t able to get it running.
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.
Probably, it is due to #187, which is zod compat issue that we're going to apply workaround soon
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.
Should i then go with the empty zod object or keep the json schema ?
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.
we consistently use zod as the primary option in the docs and examples, so please go ahead with an empty zod object here.
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.
@seratch alright done ! Thank you very much :)
Co-authored-by: Kazuhiro Sera <[email protected]>
seratch
left a comment
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.
LGTM; thank you!
The given example doesn’t work anymore because the “parameters” field is now required.
I wasent able to run it without providing a JSON Schema for parameters.