Skip to content

fix: use Optional[list[str]] instead of list[str] | None in cleanup_unused_files to fix schema parsing error - #6536

Open
guptaishaan wants to merge 1 commit into
google:mainfrom
guptaishaan:fix/issue-3591-8613
Open

fix: use Optional[list[str]] instead of list[str] | None in cleanup_unused_files to fix schema parsing error#6536
guptaishaan wants to merge 1 commit into
google:mainfrom
guptaishaan:fix/issue-3591-8613

Conversation

@guptaishaan

Copy link
Copy Markdown

The cleanup_unused_files tool function used the X | None union type syntax (PEP 604) for the file_patterns and exclude_patterns parameters. The ADK automatic function calling schema generator fails to parse this syntax, causing the error:

Failed to parse the parameter file_patterns: List[str] | None = None of function cleanup_unused_files for automatic function calling.

This error was triggered when opening the agent builder in adk web, making the assistant chat non-functional. The fix replaces list[str] | None with Optional[list[str]] from the typing module, which the schema generator handles correctly.

Fixes #3591.

…nused_files to fix schema parsing error

The `cleanup_unused_files` tool function used the `X | None` union type syntax (PEP 604) for the `file_patterns` and `exclude_patterns` parameters. The ADK automatic function calling schema generator fails to parse this syntax, causing the error:

Signed-off-by: Ishaan <ishaangupta0408@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tools [Component] This issue is related to tools

Projects

None yet

3 participants