Skip to content

Include instruction state in predictor cache keys - #107

Open
arthurianresolve wants to merge 4 commits into
krypticmouse:mainfrom
arthurianresolve:fix-predictor-cache-key
Open

arthurianresolve wants to merge 4 commits into
krypticmouse:mainfrom
arthurianresolve:fix-predictor-cache-key

Conversation

@arthurianresolve

Copy link
Copy Markdown

Summary of Fix

  • Hash the instruction override as an Option, so an absent override and an explicitly empty override produce different cache keys.
  • Include serialized demonstrations and the relevant instruction and demonstration flags in the key. This prevents reuse of a cached predictor with different effective state ([BUG][Medium]- Predictor cache conflates empty and absent instructions #100).

Fixes #100

Related work

Shared support commit: f5815bc normalizes .dsrs fixture line endings for Windows and is present in the companion fix branches.

Testing

  • cargo test -p dspy-rs --test test_fx predictor_cache_distinguishes_absent_and_empty_instruction --quiet — passed.
  • git diff --check origin/main...HEAD — passed.

AI Disclosure

  • OpenAI Codex assisted with implementation, tests, and PR drafting.
  • all fixes and drafts have been human-architected, human-directed and human-reviewed before publication of PR requests.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG][Medium]- Predictor cache conflates empty and absent instructions

1 participant