fix(config): add default LLM model fallbacks for cloud providers#1239
Open
D4rk-Pho3nix wants to merge 1 commit into
Open
fix(config): add default LLM model fallbacks for cloud providers#1239D4rk-Pho3nix wants to merge 1 commit into
D4rk-Pho3nix wants to merge 1 commit into
Conversation
|
@D4rk-Pho3nix is attempting to deploy a commit to the shashankss1205's projects Team on Vercel. A member of the Team first needs to authorize it. |
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.
closes #1103
Summary (program: gssoc)
Fixes a crash when
OPENAI_MODELorANTHROPIC_MODELis missing from config. The change adds provider defaults directly toDEFAULT_CONFIG, so graph queries have a model to use without any extra setup.What's New
OPENAI_MODEL(gpt-4o) andANTHROPIC_MODEL(claude-3-5-sonnet-20241022) toDEFAULT_CONFIGinconfig_manager.py, so graph queries always have a model to fall back on.To test: Remove
OPENAI_MODELorANTHROPIC_MODELfrom~/.codegraphcontext/.envand run a graph query. It should complete without error.resolve_model_namehelper: Addedresolve_model_name(provider, configured_value), a function that returns the configured model when set, or the provider default when the value is empty,None, or absent.To test:
from codegraphcontext.cli.config_manager import resolve_model_name; resolve_model_name("openai", "")returns"gpt-4o"tests/unit/cli/test_model_defaults.pyhas 12 unit tests covering default values, fallback behavior, whitespace stripping, case-insensitive provider names, and unknown providers.Feature Implementation
Testing Edge Cases 👇
1103.1.mp4
Files Changed
src/codegraphcontext/cli/config_manager.py- addedOPENAI_MODELandANTHROPIC_MODELtoDEFAULT_CONFIGandCONFIG_DESCRIPTIONS, addedresolve_model_name()helpertests/unit/cli/test_model_defaults.py- new file, 12 unit testsEdge Cases Covered
None-> falls back to provider default ✅""-> falls back to provider default ✅" gpt-4o ") -> stripped before returning ✅"OpenAI","ANTHROPIC") -> resolved case-insensitively ✅"mistral") -> returns"", no crash ✅Type of Change