Defer OpenAI/Anthropic SDK imports in model factory#348
Merged
Conversation
Lazy-load provider SDKs so a missing SDK for an unused provider can't break startup; raise a friendly install hint when the needed SDK is absent. Cherry-picked from PR #347 (final factory.py state only; runtime-preflight and launcher changes from that PR are left for revision). Co-authored-by: namabeeru <github.body594@passmail.com>
korivi-CraftOS
added a commit
that referenced
this pull request
Jun 29, 2026
This reverts commit a86a437. Holding #347 pending revisions discussed on the PR: the runtime_preflight probe should warn-and-continue (not sys.exit) on an inconclusive result, and craftbot.py BACKEND_URL must derive from --backend-port instead of a hardcoded 7926. The clean model-factory change was taken separately in #348.
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.
Lazy-loads the OpenAI and Anthropic SDKs in the model factory so a missing SDK for an unused provider can no longer break startup. When the needed SDK is genuinely absent, the factory raises a clear install hint.
This is the clean, self-contained portion of #347, taken at its final reviewed state (the abandoned HTTP-fallback client from the first commit is not included). The runtime-preflight and launcher-hardening parts of #347 are intentionally left out pending revisions discussed on that PR.
Credit to @namabeeru (co-authored).