Skip to content

fix pydantic ai changes#1191

Merged
zzstoatzz merged 1 commit into
mainfrom
fix-slackbot-again
Aug 11, 2025
Merged

fix pydantic ai changes#1191
zzstoatzz merged 1 commit into
mainfrom
fix-slackbot-again

Conversation

@zzstoatzz

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings August 11, 2025 15:36
@zzstoatzz zzstoatzz merged commit 31da384 into main Aug 11, 2025
3 checks passed
@zzstoatzz zzstoatzz deleted the fix-slackbot-again branch August 11, 2025 15:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the codebase to align with changes in the PydanticAI library API, specifically addressing breaking changes in the tool execution interface and result object structure.

  • Updates tool wrapping logic to work with the new call_tool method instead of the deprecated run method
  • Changes result attribute access from result.data to result.output to match new API
  • Refactors tool name extraction logic to work with the new method signature

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
examples/slackbot/src/slackbot/wrap.py Updates tool wrapping to use AbstractToolset and call_tool method, refactors tool name extraction
examples/slackbot/src/slackbot/research_agent.py Changes result attribute from data to output
examples/slackbot/src/slackbot/api.py Changes result attribute from data to output

Comment on lines +76 to 80
tool_name = kwargs.get("name", "Unknown Tool")
if not tool_name or tool_name == "Unknown Tool":
if len(args) > 1:
tool_name = args[1]

Copilot AI Aug 11, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The condition checks if tool_name equals "Unknown Tool" but the default value is set to "Unknown Tool" on line 76. This means the condition will always be true when no name is found in kwargs, making the args[1] fallback unreachable when tool_name is "Unknown Tool".

Suggested change
tool_name = kwargs.get("name", "Unknown Tool")
if not tool_name or tool_name == "Unknown Tool":
if len(args) > 1:
tool_name = args[1]
if "name" in kwargs:
tool_name = kwargs["name"]
elif len(args) > 1:
tool_name = args[1]
else:
tool_name = "Unknown Tool"

Copilot uses AI. Check for mistakes.
# The tool name is either in kwargs['name'] or args[1]
tool_name = kwargs.get("name", "Unknown Tool")
if not tool_name or tool_name == "Unknown Tool":
if len(args) > 1:

Copilot AI Aug 11, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accessing args[1] without verifying it exists or has the expected type could cause an IndexError or AttributeError. The code should validate that args[1] is a string before assignment.

Suggested change
if len(args) > 1:
if len(args) > 1 and isinstance(args[1], str):

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants