Skip to content

[tools]: Correct type casting of annotations in _infer_arg_descriptions #31181

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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

keenborder786
Copy link
Contributor

@keenborder786 keenborder786 commented May 11, 2025

  • Description:

    • In _infer_arg_descriptions, the annotations dictionary contains string representations of types instead of actual typing objects. This causes _is_annotated_type to fail, preventing the correct description from being generated.
    • This is a simple fix using the get_type_hints method, which resolves the annotations properly and is supported across all Python versions.
  • Issue: tool args descriptions inference cannot handle PEP 563 stringized annotations #31051

Copy link

vercel bot commented May 11, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
langchain ⬜️ Ignored (Inspect) Visit Preview May 31, 2025 1:24pm

@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. langchain Related to the langchain package 🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature labels May 11, 2025
@keenborder786 keenborder786 marked this pull request as draft May 11, 2025 00:45
@keenborder786 keenborder786 marked this pull request as ready for review May 11, 2025 01:16
@keenborder786 keenborder786 changed the title [tools]: Annotationg Type Casting Fix in _infer_arg_descriptions [tools]: Correct type casting of annotations in _infer_arg_descriptions May 11, 2025
@keenborder786
Copy link
Contributor Author

@ccurme @efriis

@eyurtsev eyurtsev self-assigned this May 15, 2025
@keenborder786
Copy link
Contributor Author

@eyurtsev

@keenborder786
Copy link
Contributor Author

@eyurtsev

@keenborder786
Copy link
Contributor Author

@ccurme

Copy link

codspeed-hq bot commented May 31, 2025

CodSpeed Walltime Performance Report

Merging #31181 will not alter performance

Comparing keenborder786:fix/annotation_type_casting (45a2368) with master (38c19d2)

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

Summary

✅ 13 untouched benchmarks

Copy link

codspeed-hq bot commented May 31, 2025

CodSpeed Instrumentation Performance Report

Merging #31181 will not alter performance

Comparing keenborder786:fix/annotation_type_casting (45a2368) with master (38c19d2)

Summary

✅ 13 untouched benchmarks

@keenborder786
Copy link
Contributor Author

@ccurme can you please check?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature langchain Related to the langchain package size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants