Skip to content

fix: normalize runtime lm objects and retries - #10

Merged
magix022 merged 3 commits into
mainfrom
9-adapter-jsonadapter-failed-to-parse-the-lm-response
Jul 3, 2026
Merged

fix: normalize runtime lm objects and retries#10
magix022 merged 3 commits into
mainfrom
9-adapter-jsonadapter-failed-to-parse-the-lm-response

Conversation

@magix022

@magix022 magix022 commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

Rationale

Fractal resolves provider configuration into the language models passed to PredictRLM. Those runtime LMs need to be concrete dspy.LM instances so credentials, model labels, retry behavior, and downstream DSPy/PredictRLM behavior are consistent across configured providers, explicit --lm values, and interactive model/provider changes.

This change also adds a configurable LM retry default so transient provider failures can be retried consistently without leaking retry settings into RLM inputs or requiring users to pass lower-level DSPy options manually.

Summary

  • Normalize runtime model strings and provider selections into concrete dspy.LM objects.
  • Build API-backed provider LMs with resolved API keys instead of relying on provider env lookup later in the call path.
  • Add defaults.num_retries and FRACTAL_LM_NUM_RETRIES support.
  • Preserve configured retry counts on startup, explicit --lm, configured sub-models, and interactive /model or /provider swaps.
  • Update config documentation and focused tests for LM construction, retry propagation, and runtime labels.

Test Plan

  • Run uv run pytest.
  • Confirm full suite passes: 283 passed, 1 deselected.
  • Confirm defaults.num_retries reaches the underlying DSPy completion retry budget.
  • Confirm retry settings are not passed as PredictRLM input fields.

@magix022 magix022 linked an issue Jul 2, 2026 that may be closed by this pull request
@codecov

codecov Bot commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 81.94444% with 13 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/fractal/config.py 66.66% 6 Missing ⚠️
src/fractal/runtime.py 78.94% 4 Missing ⚠️
src/fractal/runtime_lms.py 91.30% 2 Missing ⚠️
src/fractal/providers.py 91.66% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@magix022
magix022 merged commit a7482bc into main Jul 3, 2026
4 of 5 checks passed
@magix022
magix022 deleted the 9-adapter-jsonadapter-failed-to-parse-the-lm-response branch July 3, 2026 16:46
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.

Adapter JSONAdapter failed to parse the LM response.

1 participant