refactor: Include Missing Field in Tool Status (#2118)

Modified the status to include args_schema when the tool has it.

You can use this translation in your commit message.
This commit is contained in:
YAMON.IO 2024-06-10 10:01:27 +09:00 committed by GitHub
commit b40bb95909
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -9,7 +9,7 @@ def build_status_from_tool(tool: Tool):
tool (Tool): The tool object to build the status for.
Returns:
str: The status string representation of the tool, including its name, description, and arguments (if any).
str: The status string representation of the tool, including its name, description, arguments (if any), and args_schema (if any).
"""
description_repr = repr(tool.description).strip("'")
args_str = "\n".join(
@ -19,5 +19,8 @@ def build_status_from_tool(tool: Tool):
if "description" in arg_data
]
)
# Include args_schema information
args_schema_str = repr(tool.args_schema) if tool.args_schema else "None"
status = f"Name: {tool.name}\nDescription: {description_repr}"
status += f"\nArgs Schema: {args_schema_str}"
return status + (f"\nArguments:\n{args_str}" if args_str else "")