-
Couldn't load subscription status.
- Fork 19.5k
refactor(anthropic): remove unnecessary url check #33671
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
Conversation
if "url" in annotation: in Line 15 , already ensures "url" is key in annotation , so no need to check again to set "url" key in out
CodSpeed Performance ReportMerging #33671 will not alter performanceComparing Summary
Footnotes
|
Reduced return and continue statement for readability and simplicity
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.
TY!
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.
Pull Request Overview
This PR refactors code in the Anthropic integration for improved readability and simplicity by removing redundant conditional checks and restructuring control flow.
Key Changes:
- Simplified tool call extraction logic by inverting the condition check from negative to positive
- Removed redundant URL existence check when converting annotations
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
libs/partners/anthropic/langchain_anthropic/output_parsers.py |
Refactored extract_tool_calls to use positive condition checking and consolidated return statement |
libs/partners/anthropic/langchain_anthropic/_compat.py |
Removed redundant if "url" in annotation check since it's already verified in parent condition |
Co-authored-by: Copilot <[email protected]>
if "url" in annotation: in Line 15 , already ensures "url" is key in annotation , so no need to check again to set "url" key in out object