Skip to content

fix(core): filter v__args field when function has args parameter#1

Open
LincolnBurrows2017 wants to merge 3 commits intomasterfrom
fix/vargs-filter-for-args-param
Open

fix(core): filter v__args field when function has args parameter#1
LincolnBurrows2017 wants to merge 3 commits intomasterfrom
fix/vargs-filter-for-args-param

Conversation

@LincolnBurrows2017
Copy link
Owner

Summary

When a function parameter is named args, Pydantic v2 adds a virtual field called v__args to handle the naming conflict. This field was not being filtered out, causing spurious fields to appear in the tool's args schema.

This PR adds filtering for the v__args field in create_schema_from_function, similar to how v__duplicate_kwargs is already handled.

Changes

  • Added filtering for v__args field in libs/core/langchain_core/tools/base.py
  • Added test case to verify the fix in libs/core/tests/unit_tests/test_tools.py

Disclaimer: This contribution was made with assistance from an AI agent.

mdrxy and others added 3 commits March 11, 2026 11:20
When a function parameter is named 'args', Pydantic v2 adds a virtual
field called 'v__args' to handle the naming conflict. This field
was not being filtered out, causing spurious fields to appear in
the tool's args schema.

This commit adds filtering for the 'v__args' field in
create_schema_from_function, similar to how 'v__duplicate_kwargs'
is already handled.

Also adds a test case to verify the fix.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants