feat: support user-defined model configuration#259
feat: support user-defined model configuration#259Syspretor merged 3 commits intosgl-project:mainfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces the ability to load user-defined model configurations from a local directory, merging them with built-in models and allowing user overrides. It also updates documentation and CLI examples to reflect a new model naming convention. The review feedback suggests addressing non-deterministic map iteration in conflict warnings to ensure consistent CLI output, explicitly verifying that the model configuration path is a directory, and making the YAML file extension check case-insensitive for better robustness.
There was a problem hiding this comment.
Pull request overview
Adds support in the CLI for loading user-provided model configuration YAMLs from a local directory and merging them with the embedded built-in model configs (user definitions take precedence). Also updates documentation examples for kubectl rbg llm generate.
Changes:
- Add model config directory discovery via
RBG_MODEL_CONFIG(default~/.rbg/models) and merge user configs ahead of built-ins. - Add duplicate model-ID detection with aggregated warning output.
- Update
llm runto use the merged model loader and add unit tests for user-model loading scenarios.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
cmd/cli/cmd/llm/run/model_config.go |
Implements merged model loading (user dir + embedded), plus conflict detection/warnings. |
cmd/cli/cmd/llm/run/model_config_test.go |
Adds unit tests covering user model directory loading, overrides, duplicates, invalid files. |
cmd/cli/config/config.go |
Introduces constants and GetModelConfigDir() to locate the user model config directory. |
cmd/cli/cmd/llm/run.go |
Switches resolution logic to use LoadAllModels() instead of built-ins only. |
cmd/cli/README.md |
Updates generate examples (but currently has filename/PVC mismatches vs actual CLI output). |
doc/features/kubectl-rbg-llm-generate.md |
Updates generate docs/examples (but currently has filename/PVC + troubleshooting pattern mismatches vs actual CLI behavior). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
021eb52 to
4f6c835
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Support User-Defined Model Configuration
Summary
Add support for loading user-defined model configurations from local directory, merging with built-in models. User models take precedence.
Additionally, fix incorrect examples for the llm generate command found in the documentation.
Changes
Model Loading Mechanism
~/.rbg/models/RBG_MODEL_CONFIGenvironment variable.yamland.ymlfilesDuplicate Detection
New Constants/Functions
DefaultModelConfigDir,EnvModelConfigPathGetModelConfigDir()Environment Variables
RBG_CONFIG~/.rbg/configRBG_MODEL_CONFIG~/.rbg/modelsFiles Changed
cmd/cli/cmd/llm/run/model_config.go- New loading logiccmd/cli/cmd/llm/run/model_config_test.go- Unit tests (7 cases)cmd/cli/config/config.go- New constants/functionscmd/cli/cmd/llm/run.go- Switch to new loadercmd/cli/README.md,doc/features/kubectl-rbg-llm-generate.md- Docs update