Repository navigation
Fix LM history inspection and cache isolation on client replacement - #131
Open
arthurianresolve wants to merge 3 commits into
Open
arthurianresolve wants to merge 3 commits into
arthurianresolve wants to merge 3 commits into
Conversation
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
arthurianresolve
marked this pull request as ready for review
November 9, 2026 22:42
arthurianresolve
added a commit
to arthurianresolve/DSRs
that referenced
this pull request
Nov 19, 2026
Integrate krypticmouse#131 — Fix LM history inspection and cache isolation on client replacement
This branch has not been deployed
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.
Summary of Fix
inspect_history()from panicking.Predict::build_chat()before sending them.Fixes #130
Fixes #84
Why
Caching defaults to disabled, but history inspection previously unwrapped the optional cache handler. Example 07 could therefore complete its prediction and then crash while reading history.
Separately,
with_client()replaced the provider while retaining its predecessor’s cache. Repeating a request could return the old provider’s response without invoking the replacement. Creating a fresh cache prevents that reuse without clearing caches belonging to existing clones.Related work
#85 asks how to inspect generated prompts when examples fail to produce the expected output format. The documentation now shows the
build_chat()→call_and_parse()flow. This addresses prompt inspection; it does not claim to resolve every reported output-format failure.Testing
cargo test -p dspy-rs --no-default-features --test test_lm— 13 passed, including cache isolation between replacement clients and existing clones.cargo test -p dspy-rs --no-default-features --test test_predict_conversation forward_returns_chat_and_prediction— passed.cargo build -p dspy-rs --no-default-features --example 07-inspect-history— passed after the initial history fix.rustfmt --check --edition 2024 crates/dspy-rs/src/core/lm/mod.rs crates/dspy-rs/tests/test_lm.rs crates/dspy-rs/examples/07-inspect-history.rs— passed.git diff --check— passed.Before the fix, a mocked client-replacement test reproduced the stale response. Tests used mocked providers; live-provider behavior and the full workspace suite were not tested.
AI Disclosure