feat(cli): persistent default_model via gaia config (#98)#1863
feat(cli): persistent default_model via gaia config (#98)#1863kovtcharov wants to merge 5 commits into
Conversation
|
Verdict: Approve This PR does two well-scoped things: it adds a persistent Nothing blocking. Two minor things worth a glance before merge, both non-blocking: 🔍 Technical details🟢 Minor
Notes (no action needed)
Strengths
|
Users had to pass --model on every `gaia chat` / `gaia llm` / `gaia prompt` to override the built-in default. Now they can set it once in ~/.gaia/config.json and skip the flag entirely. Extends the existing GaiaConfig with a default_model field and a new `gaia config show|get|set` subcommand. Model resolution is highest-wins: explicit --model flag > config default_model > each command's built-in default. `gaia chat --device` still selects a device-specific model and keeps precedence over the config default. Per the no-silent-fallbacks rule, a missing config file falls back to built-in defaults (correct), but a corrupt/unreadable file now fails loudly with the file path and recovery steps instead of silently reverting. `gaia init` load-then-updates so a user-set default_model survives re-running setup. Config file location is overridable via GAIA_CONFIG_DIR / GAIA_CONFIG_FILE.
ed94640 to
67e401d
Compare
…fig at a custom file
Why this matters
Before, you had to type
--model <id>on everygaia chat/gaia llm/gaia promptto use anything other than the built-in default — tedious and easy to forget. After, you set it once and forget it:Model resolution is documented and highest-wins: explicit
--modelflag >default_modelfrom the config file > each command's built-in default. A missing config file correctly falls back to defaults; a corrupt one fails loudly (with the file path + how to recover) instead of silently reverting — per the repo's no-silent-fallbacks rule.gaia initpreserves a user-setdefault_modelacross re-runs (and repairs a corrupt file).gaia config set/get/showare generic over theGaiaConfigdataclass fields, so future config keys need no new plumbing.Using a custom config file
Point GAIA at a config file anywhere on disk (per-project configs, separate work/personal defaults) — via the
--configflag or theGAIA_CONFIG_FILEenv var. Both are honored bygaia config,gaia chat,gaia llm, andgaia prompt:Precedence:
--config>GAIA_CONFIG_FILE> default~/.gaia/config.json.Closes #98
Test plan
python -m pytest tests/unit/test_cli_config.py tests/unit/test_npu_device_support.py -q— passing (round-trip, missing→defaults, corrupt/non-object/unreadable→loud error, precedence incl. empty-string, CLIshow/get/set+ unknown-key + no-subcommand, model injection forprompt/chat/llm,chat --deviceskip,--configflag, andGAIA_CONFIG_FILE/GAIA_CONFIG_DIRoverrides)gaia config set default_model Xthengaia config get default_model/gaia config show→ value + resolved file pathgaia config set bogus x/gaia config get bogus→ exit non-zero, actionable "Unknown config key"gaia llm "hi"withdefault_modelset uses it;--model Xoverrides itgaia config set default_model M --config ./p.jsonwrites to that file (not~/.gaia);gaia llm "hi" --config ./p.jsonreads it;--configoverridesGAIA_CONFIG_FILEpython util/lint.py --black --isort --flake8clean on the changed files