Skip to content

Conversation

@ads2280
Copy link
Contributor

@ads2280 ads2280 commented Oct 8, 2025

Description:

currently mustache_schema("{{x.y}} {{x}}") will error. pr fixes

Issue: na
**Dependencies:**na

@ads2280 ads2280 requested a review from eyurtsev as a code owner October 8, 2025 00:54
@github-actions github-actions bot added fix core Related to the package `langchain-core` and removed fix labels Oct 8, 2025
@ads2280 ads2280 requested a review from mdrxy October 8, 2025 00:54
@codspeed-hq
Copy link

codspeed-hq bot commented Oct 8, 2025

CodSpeed Performance Report

Merging #33346 will improve performances by 29.4%

Comparing anika/v03_mustache_schema_fix (2cf8f28) with master (cda3362)1

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

⚡ 1 improvement
✅ 12 untouched
⏩ 21 skipped2

Benchmarks breakdown

Mode Benchmark BASE HEAD Change
WallTime test_import_time[HumanMessage] 273.8 ms 211.6 ms +29.4%

Footnotes

  1. No successful run was found on v0.3 (809a021) during the generation of this report, so master (cda3362) was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

  2. 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.

@github-actions github-actions bot added the fix label Oct 8, 2025
@mdrxy mdrxy requested a review from Copilot October 8, 2025 01:48
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a bug in the mustache_schema function where having both parent and child mustache variables (e.g., {{x.y}} and {{x}}) in the same template would cause an error. The fix filters out child variables when their parent is also present.

  • Added logic to detect and handle parent/child variable conflicts in mustache templates
  • Implemented a helper function to check if one sequence is a subsequence of another
  • Added comprehensive test coverage for the parent/child variable scenario

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
libs/core/langchain_core/prompts/string.py Added parent/child conflict resolution logic and is_subsequence helper function
libs/core/tests/unit_tests/prompts/test_string.py Added test case for parent/child mustache variable handling

@baskaryan baskaryan merged commit dd4de69 into v0.3 Oct 9, 2025
75 checks passed
@baskaryan baskaryan deleted the anika/v03_mustache_schema_fix branch October 9, 2025 15:52
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants