feat: add LLM configuration to YAML config (#37)#44
Conversation
📝 WalkthroughWalkthroughThis change introduces configurable LLM model selection throughout the system. A new LLMConfig struct is added to manage provider, API key, model, and temperature settings. LLM client initialization is refactored to support configuration-based model selection with environment variable overrides and fallback logic. Configuration files and documentation are updated to reflect the new LLM settings block. Changes
Poem
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@internal/integrations/gemini/llm.go`:
- Around line 105-120: Update the default model string used in NewLLMClient
(which constructs and returns an *LLMClient) to a supported stable model:
replace the current fallback value assigned to the local variable model
("gemini-2.0-flash-lite") with a pinned/stable identifier such as
"gemini-2.0-flash-lite-001" or use a newer model "gemini-2.5-flash-lite" so the
LLMClient.model field is initialized to a non-deprecated model.
🧹 Nitpick comments (1)
internal/core/config/config_test.go (1)
61-84: Consider adding test coverage for theTemperaturefield.The tests cover
ProviderandModelparsing but don't verifyTemperature(a*float64pointer). Since pointer fields have different zero-value semantics, a test ensuring correct parsing and nil-vs-set distinction would strengthen coverage.💡 Suggested test addition
func TestLoadConfigWithLLMTemperature(t *testing.T) { yamlContent := ` llm: provider: gemini model: gemini-2.0-flash-lite temperature: 0.7 ` cfg, err := parseRaw([]byte(yamlContent)) if err != nil { t.Fatalf("Failed to parse YAML: %v", err) } if cfg.LLM.Temperature == nil { t.Error("Expected LLM.Temperature to be set, got nil") } else if *cfg.LLM.Temperature != 0.7 { t.Errorf("Expected LLM.Temperature 0.7, got %f", *cfg.LLM.Temperature) } }
| func NewLLMClient(apiKey, model string) (*LLMClient, error) { | ||
| ctx := context.Background() | ||
| client, err := genai.NewClient(ctx, option.WithAPIKey(apiKey)) | ||
| if err != nil { | ||
| return nil, fmt.Errorf("failed to create Gemini client: %w", err) | ||
| } | ||
|
|
||
| if model == "" { | ||
| model = "gemini-2.0-flash-lite" // Fast and cost-effective | ||
| } | ||
|
|
||
| return &LLMClient{ | ||
| client: client, | ||
| model: "gemini-2.0-flash-lite", // Fast and cost-effective | ||
| model: model, | ||
| }, nil | ||
| } |
There was a problem hiding this comment.
🧩 Analysis chain
🌐 Web query:
Google Gemini API available models 2026 gemini-2.0-flash-lite
💡 Result:
gemini-2.0-flash-lite is (was) a valid Gemini API model, but it’s scheduled for deprecation/shutdown starting February 2026, so in 2026 you should expect it to be at risk of being turned off and plan to migrate. Google lists gemini-2.5-flash-lite as the recommended replacement. [1]
What gemini-2.0-flash-lite is (Gemini API)
- Model code:
gemini-2.0-flash-lite(latest) and stable pinned versiongemini-2.0-flash-lite-001[2] - Context window: 1,048,576 input tokens; 8,192 output tokens [2]
- I/O: audio/images/video/text input → text output [2]
- Not supported (per model doc): Live API, search grounding, image generation, code execution, “thinking” mode [2]
Deprecation status (relevant for 2026)
gemini-2.0-flash-liteandgemini-2.0-flash-lite-001: Shutdown date: “Earliest February 2026” → Replacement:gemini-2.5-flash-lite[1]
How to confirm what’s available right now in your project
Google’s docs recommend using the Gemini API “models” documentation and release/deprecation pages to track what’s supported and what’s being shut down. The deprecations table is the key reference for whether a model may stop working. [1]
Replace the default model with a stable or current version.
The model gemini-2.0-flash-lite is scheduled for shutdown in February 2026 and is at immediate risk of being unavailable. Use the stable pinned version gemini-2.0-flash-lite-001 instead, or migrate to gemini-2.5-flash-lite.
Update line 113:
model = "gemini-2.0-flash-lite-001"
Or migrate to a current model:
model = "gemini-2.5-flash-lite"
🤖 Prompt for AI Agents
In `@internal/integrations/gemini/llm.go` around lines 105 - 120, Update the
default model string used in NewLLMClient (which constructs and returns an
*LLMClient) to a supported stable model: replace the current fallback value
assigned to the local variable model ("gemini-2.0-flash-lite") with a
pinned/stable identifier such as "gemini-2.0-flash-lite-001" or use a newer
model "gemini-2.5-flash-lite" so the LLMClient.model field is initialized to a
non-deprecated model.
|
Regarding the two points:
|
Kavirubc
left a comment
There was a problem hiding this comment.
LGTM — LLM config via YAML is well structured. Approving as code owner. (Deprecation fix for default model will follow in a separate commit on main.)
Summary
Adds LLM provider/model configuration support to the YAML config file (
.simili.yaml), addressing #37.Currently the LLM provider and model are hardcoded. This PR makes them configurable via:
llm.provider,llm.model,llm.api_key,llm.temperature)LLM_MODEL,GEMINI_API_KEY)Changes
Core config
LLMConfigstruct andConfig.LLMfield ininternal/core/config/config.goprovider: gemini,model: gemini-2.0-flash-litemergeConfigs()supports merging LLM fieldsGemini client
NewLLMClientnow accepts(apiKey, model string)parametersCLI + Web wiring
process.go,batch.go,main.go(simili-web)cfg.LLM.APIKey→ embedding key fallback →GEMINI_API_KEYenvcfg.LLM.Model→LLM_MODELenv overrideConfig & docs
llm:section to.simili.yamland example configsLLM_MODELto.env.sampleTests
TestLLMConfigDefaults— verifies defaultsTestMergeConfigsLLM— verifies config mergingTestLoadConfigWithLLM— verifies YAML loadingValidation
Config Example
Summary by CodeRabbit
New Features
Documentation