Skip to content

Conversation

@npage902
Copy link
Contributor

Description: Fixes the bug in the load() function where secret placeholders in plain dicts were not replaced, even if they match a key in secrets_map, and adds a test case.

Example:

obj = {"api_key": "__SECRET_API_KEY__"}
secret_key = "secret_key_1234"
secrets_map = {"__SECRET_API_KEY__": secret_key}
result = load(obj, secrets_map=secrets_map)

Before this change, printing api_key in result would output "__SECRET_API_KEY__". Now, it will properly output "secret_key_1234".

Issue: Fixes #31804

Dependencies: None

make format, make lint, and make test have all passed on my machine.

@npage902 npage902 requested a review from eyurtsev as a code owner October 20, 2025 23:18
@github-actions github-actions bot added core Related to the package `langchain-core` langchain Related to the package `langchain` fix labels Oct 20, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented Oct 20, 2025

CodSpeed Performance Report

Merging #33618 will improve performances by 12.5%

Comparing npage902:npage902/fix-load-secrets-map (2ea2e99) with master (e731ba1)

⚠️ 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

⚡ 2 improvements
✅ 11 untouched
⏩ 21 skipped1

Benchmarks breakdown

Mode Benchmark BASE HEAD Change
WallTime test_import_time[InMemoryRateLimiter] 198.4 ms 176.4 ms +12.5%
WallTime test_import_time[LangChainTracer] 482.6 ms 435.7 ms +10.77%

Footnotes

  1. 21 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@npage902
Copy link
Contributor Author

Things seem to be scuffed on my end in regards to makefile testing. I'll need to look into this, but I'll just close this up for now. Apologies for any inconvenience.

@npage902 npage902 closed this Oct 20, 2025
mdrxy added a commit that referenced this pull request Nov 7, 2025
…3678)

Replaces #33618 

**Description:** Fixes the bug in the `load()` function where secret
placeholders in plain dicts were not replaced, even if they match a key
in `secrets_map`, and adds a test case.

Example:
```py
obj = {"api_key": "__SECRET_API_KEY__"}
secret_key = "secret_key_1234"
secrets_map = {"__SECRET_API_KEY__": secret_key}
result = load(obj, secrets_map=secrets_map)
```
Before this change, printing `api_key` in `result` would output
`"__SECRET_API_KEY__"`. Now, it will properly output
`"secret_key_1234"`.

**Issue:** Fixes #31804 

**Dependencies:** None

`make format`, `make lint`, and `make test` have all passed on my
machine.

---------

Co-authored-by: Mason Daugherty <[email protected]>
Co-authored-by: Mason Daugherty <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Related to the package `langchain-core` fix langchain Related to the package `langchain`

Projects

None yet

Development

Successfully merging this pull request may close these issues.

load() does not apply secrets_map to plain string values

1 participant