Skip to content

fix(tools): correct args validation in langchain tool wrapper#761

Open
markstur wants to merge 1 commit intogenerative-computing:mainfrom
markstur:issue_760
Open

fix(tools): correct args validation in langchain tool wrapper#761
markstur wants to merge 1 commit intogenerative-computing:mainfrom
markstur:issue_760

Conversation

@markstur
Copy link
Copy Markdown

@markstur markstur commented Mar 27, 2026

Misc PR

Type of PR

  • Bug Fix
  • New Feature
  • Documentation
  • Other

Description

  • Link to Issue: Fixes 760

Fixed logic error in MelleaTool.from_langchain() where the condition if args is not None or len(args) != 0: was always True, causing false positive warnings on every tool call.

Changed to if args: which correctly checks for non-empty tuples, since *args is always a tuple (never None) in Python.

Added test_from_langchain_args_handling() to verify:

  • No warning when called with kwargs only (normal case)
  • Warning logged when positional args passed (edge case)

Testing

  • Tests added to the respective file if code was changed
  • New code has 100% coverage if code as added
  • Ensure existing tests and github automation passes (a maintainer will kick off the github automation when the rest of the PR is populated)

Fixed logic error in MelleaTool.from_langchain() where the condition
`if args is not None or len(args) != 0:` was always True, causing
false positive warnings on every tool call.

Changed to `if args:` which correctly checks for non-empty tuples,
since *args is always a tuple (never None) in Python.

Added test_from_langchain_args_handling() to verify:
- No warning when called with kwargs only (normal case)
- Warning logged when positional args passed (edge case)

Closes: generative-computing#760

Signed-off-by: Mark Sturdevant <mark.sturdevant@ibm.com>
@markstur markstur requested a review from a team as a code owner March 27, 2026 22:48
@github-actions
Copy link
Copy Markdown
Contributor

The PR description has been updated. Please fill out the template for your PR to be reviewed.

@github-actions github-actions bot added the bug Something isn't working label Mar 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant