-
Notifications
You must be signed in to change notification settings - Fork 897
Add builtin_tools
to Agent
#1722
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
base: main
Are you sure you want to change the base?
Conversation
for tool in builtin_tools: | ||
if tool == 'web-search': | ||
self._builtin_tools.append(WebSearchTool()) | ||
else: | ||
self._builtin_tools.append(tool) |
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.
It's easier to not have to handle string on the models, so we already do the transformation here.
""" | ||
|
||
|
||
class UserLocation(TypedDict, total=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.
It's easier to handle this in the models if it's a TypedDict
, since it matches the type.
@dataclass | ||
class WebSearchTool(AbstractBuiltinTool): |
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.
From the DX POV, it's nicer for it to be a BaseModel
or dataclass
.
Docs Preview
|
tools = list(model_settings.get('openai_builtin_tools', [])) + tools | ||
tools = self._get_builtin_tools(model_request_parameters) + tools |
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 should deprecate the openai_builtin_tools
in this PR.
class AbstractBuiltinTool(ABC): | ||
"""A builtin tool that can be used by an agent. | ||
|
||
This class is abstract and cannot be instantiated directly. |
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 think worth including a sentence here explaining how the code execution works to make use of them — something like "these are passed to the model as part of the ModelRequestParameters" or whatever. (Not sure if that's true, haven't gotten there yet ..). But I imagine it helping someone who is trying to figure out how they are different from normal tools.
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 other than tests and docs
No description provided.