fix(core): remove str() cast in get_from_dict_or_env to preserve original types#35289
Open
nightcityblade wants to merge 1 commit intolangchain-ai:masterfrom
Open
fix(core): remove str() cast in get_from_dict_or_env to preserve original types#35289nightcityblade wants to merge 1 commit intolangchain-ai:masterfrom
nightcityblade wants to merge 1 commit intolangchain-ai:masterfrom
Conversation
6aaa665 to
1afbeb2
Compare
Christophe Bornet (cbornet)
approved these changes
Feb 18, 2026
Contributor
Author
|
Gentle ping — this has been approved by Christophe Bornet (@cbornet) for 3 days. The only CI failure is CodSpeed Benchmarks which appears to be a flaky infrastructure issue (all actual tests pass). Would appreciate a merge when convenient. Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #35285.
get_from_dict_or_envacceptsdict[str, Any]but was casting all dictionary values tostrviastr(), which breaks code storing non-string types (e.g., enums) as dict values.Changes
str()wrapping when returning values from the dictionarystrtoAnyto match the input typeget_from_env)Testing
The change is backwards-compatible: string values remain strings, but non-string types (enums, ints, etc.) are no longer incorrectly cast.