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)