From 75b5175590aca8c5ae215a96c54ebc4db5229291 Mon Sep 17 00:00:00 2001 From: FSSCoding Date: Fri, 15 Aug 2025 22:10:21 +1000 Subject: [PATCH] Fix critical model configuration bug CRITICAL FIX for beginners: User config model changes now work correctly Issues Fixed: - rag-mini.py synthesis mode ignored config completely (used hardcoded models) - LLMSynthesizer fallback ignored config preferences - Users changing model in config saw no effect in synthesis mode Changes: - rag-mini.py now loads config and passes synthesis_model to LLMSynthesizer - LLMSynthesizer _select_best_model() respects config model_rankings for fallback - All modes (synthesis and explore) now properly use config settings Tested: Model config changes now work correctly in both synthesis and explore modes --- mini_rag/llm_synthesizer.py | 5 ++++- rag-mini.py | 11 ++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/mini_rag/llm_synthesizer.py b/mini_rag/llm_synthesizer.py index bcd981b..60a622a 100644 --- a/mini_rag/llm_synthesizer.py +++ b/mini_rag/llm_synthesizer.py @@ -64,7 +64,10 @@ class LLMSynthesizer: def _select_best_model(self) -> str: """Select the best available model based on configuration rankings.""" if not self.available_models: - return "qwen2.5:1.5b" # Fallback preference + # Use config fallback if available, otherwise use default + if self.config and hasattr(self.config, 'llm') and hasattr(self.config.llm, 'model_rankings') and self.config.llm.model_rankings: + return self.config.llm.model_rankings[0] # First preferred model + return "qwen2.5:1.5b" # System fallback only if no config # Get model rankings from config or use defaults if self.config and hasattr(self.config, 'llm') and hasattr(self.config.llm, 'model_rankings'): diff --git a/rag-mini.py b/rag-mini.py index a045eed..de83aeb 100644 --- a/rag-mini.py +++ b/rag-mini.py @@ -192,7 +192,16 @@ def search_project(project_path: Path, query: str, top_k: int = 10, synthesize: # LLM Synthesis if requested if synthesize: print("🧠 Generating LLM synthesis...") - synthesizer = LLMSynthesizer() + + # Load config to respect user's model preferences + from mini_rag.config import ConfigManager + config_manager = ConfigManager(project_path) + config = config_manager.load_config() + + synthesizer = LLMSynthesizer( + model=config.llm.synthesis_model if config.llm.synthesis_model != "auto" else None, + config=config + ) if synthesizer.is_available(): synthesis = synthesizer.synthesize_search_results(query, results, project_path)