-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
Context
DSPy Python has a 3-level LM resolution cascade:
- Call-time parameter (
predictor(q="...", lm=other_lm)) - Per-module (
predict.lm = my_lm) - Global (
dspy.configure(lm=...))
Plus lm.copy(**overrides) for creating variant LMs, and dspy.context(lm=...) for thread-local temporary switching.
dspy-rs currently has global-only LM via GLOBAL_SETTINGS.lm. No per-module assignment, no config merging, no context-style overrides, and no retry/backoff on transient failures.
What's needed
Per-module LM
Predict<S>andModuleshould support an optional.lmfield- Resolution order: call param > self.lm > GLOBAL_SETTINGS.lm
Config merging / copy
LM::copy()or similar to create variant LMs with overridden params- Equivalent of DSPy's
Predict.config+ call-time kwargs merge
Retry / backoff
- Configurable
num_retrieson LM - Exponential backoff for transient errors (network, rate limit, 5xx)
- Non-transient errors (4xx except 429) fail immediately
- Currently one-shot: any transient failure is terminal
Context-local LM
- Something like
dspy::context(lm)for temporary overrides (task-local or scope-based)
Related
- LM tool loop treats max_tool_iterations=1 as immediate failure #61 (tool loop off-by-one)
- proper error handling #67 (error handling)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels