Skip to content
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

update bullets for documentation in tool.py #247

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions src/agents/tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ class FunctionTool:

on_invoke_tool: Callable[[RunContextWrapper[Any], str], Awaitable[Any]]
"""A function that invokes the tool with the given context and parameters. The params passed
are:
1. The tool run context.
2. The arguments from the LLM, as a JSON string.
are:\n
1. The tool run context.\n
2. The arguments from the LLM, as a JSON string.\n

You must return a string representation of the tool output, or something we can call `str()` on.
In case of errors, you can either raise an Exception (which will cause the run to fail) or
Expand Down Expand Up @@ -182,10 +182,11 @@ def function_tool(
strict_mode: bool = True,
) -> FunctionTool | Callable[[ToolFunction[...]], FunctionTool]:
"""
Decorator to create a FunctionTool from a function. By default, we will:
1. Parse the function signature to create a JSON schema for the tool's parameters.
2. Use the function's docstring to populate the tool's description.
3. Use the function's docstring to populate argument descriptions.
Decorator to create a FunctionTool from a function. By default, we will:\n
1. Parse the function signature to create a JSON schema for the tool's parameters.\n
2. Use the function's docstring to populate the tool's description.\n
3. Use the function's docstring to populate argument descriptions.\n

The docstring style is detected automatically, but you can override it.

If the function takes a `RunContextWrapper` as the first argument, it *must* match the
Expand Down