Repository navigation
Add scoped LM selection and configuration overrides - #133
Open
arthurianresolve wants to merge 17 commits into
Open
arthurianresolve wants to merge 17 commits into
arthurianresolve wants to merge 17 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 |
…ides # Conflicts: # crates/dspy-rs/src/core/lm/mod.rs
This was referenced Nov 10, 2026
arthurianresolve
added a commit
to arthurianresolve/DSRs
that referenced
this pull request
Nov 19, 2026
Integrate krypticmouse#133 — Add scoped LM selection and configuration overrides
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
Includes the resolved #131 and #132 branches. Merge those first, then this PR before #121/#134.
Add explicit call-time LM overrides for predictors, conversations, and modules. Resolve the LM as explicit call override > predictor LM > scoped/module default > global configuration.
Add task-local
with_lmscopes and module defaults throughModule::with_lm. Restore scopes on success, error, panic, and cancellation, while preserving predictor discovery on wrapped modules.Add
LM::copy_withandPredict::call_with_configto merge changes over the resolved configuration. Retain the provider client for generation-only changes, rebuild it when the model, endpoint, or credentials change, and start copies with fresh caches.Honor scoped defaults when generated IR modules bind their default model.
Classify typed HTTP errors before retrying: retry 429/5xx and transient transport failures; fail immediately on permanent HTTP errors and request-construction failures. Preserve bounded exponential backoff and the zero-retry setting.
Document the APIs, precedence, copy semantics, retry behavior, and spawned-task scope boundaries.
Preserve configured token limits on the OpenAI-compatible HTTP transport. The pinned Rig Chat Completions converter drops the generic limit; bridge it into the appropriate wire parameter while preserving explicit provider parameters. This also makes
copy_withtoken budgets effective on local Ollama endpoints.Introduce
CompletionProviderfor built-in, test and third-party providers.LMClient::customaccepts external implementations; all run through the same LM configuration, retry, tool, cache and history wrapper.Expose typed LM failure categories and retryability through
LmError::call_error(). Preserve concrete provider causes through Predict and IR error chains.Fixes #69
Fixes #77
Why
Per-predictor LMs and retry/backoff already exist, but callers cannot temporarily select a different LM or merge configuration changes for one call without constructing their own replacement plumbing. Scoped defaults and explicit overrides provide those choices without mutating the global LM or predictor state.
Changing a config's model or endpoint alone does not replace its initialized client.
copy_withrebuilds the client when provider identity changes, while retaining injected clients for generation-only changes. Each copy has independent cache state.The existing retry classifier also treated every HTTP error as transient. Rig retains the HTTP status in a typed error, allowing 400/401 and other permanent responses to fail immediately while 429/5xx responses remain retryable.
The real-provider profiling work for #23 exposed a transport gap:
max_tokenswas present in the generic request but absent from the HTTP body. The adapter now sendsmax_tokensfor local/legacy model names andmax_completion_tokensfor o-series and GPT models from version 5 onward. Explicit additional-parameter limits remain intact.Related work
LanguageModelhierarchy. Built-in and mock providers implement the same trait; third-party providers can participate without modifying the built-in registry.Testing
2b4590f0174dc05582347b8da75b6b58fbce9ca0passed 209 tests with--no-default-featuresand 247 with defaultdata/cachefeatures (2 live tests ignored in each offline run). These are focused library and integration suites, not the full workspace test suite. Later ancestry-only integration merges preserve the validated source trees.--no-default-features. They inspect actual serialized requests, copied limits, explicit parameter preservation, duplicate-key avoidance and typed invalid-request errors; the model names are endpoint fixtures, not live hosted-model calls.bda64b29974cdd22e4e8004976a7e5c8f4d2263c, eight release integration suites passed 62 tests with--no-default-features(three live tests ignored). Coverage includes the HTTP wire budget, provider contract, native rendering/scalar output, typed special fields, storage, tool-loop limits and trace/replay.git diff --check— passed.AI Disclosure