Integrate LLM synthesis across all interfaces and update demo

🔧 Integration Updates
- Added --synthesize flag to main rag-mini CLI
- Updated README with synthesis examples and 10 result default
- Enhanced demo script with 8 complete results (was cutting off at 5)
- Updated rag-tui default from 5 to 10 results
- Updated rag-mini-enhanced script defaults

📈 User Experience Improvements
- All components now consistently default to 10 results
- Demo shows complete 8-result workflow with multi-line previews
- Documentation reflects new AI analysis capabilities
- Seamless integration preserves existing workflows

Users get more comprehensive results by default and can optionally
add intelligent AI analysis with a simple --synthesize flag!
This commit is contained in:
BobAi 2025-08-12 17:13:21 +10:00
parent ba28246178
commit 55500a2977
5 changed files with 49 additions and 11 deletions

View File

@ -39,7 +39,8 @@ FSS-Mini-RAG is a distilled, lightweight implementation of a production-quality
./rag-tui # Friendly interface for beginners
# OR
./rag-mini index ~/my-project # Direct CLI for developers
./rag-mini search ~/my-project "authentication logic"
./rag-mini search ~/my-project "authentication logic" # 10 results
./rag-mini search ~/my-project "error handling" --synthesize # AI analysis
```
That's it. No external dependencies, no configuration required, no PhD in computer science needed.

View File

@ -156,6 +156,24 @@ class DemoSimulator:
"function": "User.authenticate()",
"preview": "User model authentication method.\nQueries database for user credentials\nand handles account status checks.",
"score": "0.82"
},
{
"file": "auth/tokens.py",
"function": "generate_jwt_token()",
"preview": "Generate JWT authentication tokens.\nIncludes expiration, claims, and signature.\nSupports refresh and access token types.",
"score": "0.79"
},
{
"file": "utils/security.py",
"function": "hash_password()",
"preview": "Secure password hashing utility.\nUses bcrypt with configurable rounds.\nProvides salt generation and validation.",
"score": "0.76"
},
{
"file": "config/auth_settings.py",
"function": "load_auth_config()",
"preview": "Load authentication configuration.\nHandles JWT secrets, token expiration,\nand authentication provider settings.",
"score": "0.73"
}
]

View File

@ -60,7 +60,7 @@ similar_search() {
echo "🔄 Finding similar patterns to: '$query'"
# Use semantic search with pattern-focused terms
pattern_query="similar to $query OR like $query OR pattern $query"
"$PYTHON" "$SCRIPT_DIR/rag-mini.py" search "$project_path" "$pattern_query" --limit 5
"$PYTHON" "$SCRIPT_DIR/rag-mini.py" search "$project_path" "$pattern_query" --limit 10
}
# Smart indexing with optimizations

View File

@ -18,6 +18,7 @@ sys.path.insert(0, str(Path(__file__).parent))
from claude_rag.indexer import ProjectIndexer
from claude_rag.search import CodeSearcher
from claude_rag.ollama_embeddings import OllamaEmbedder
from claude_rag.llm_synthesizer import LLMSynthesizer
# Configure logging for user-friendly output
logging.basicConfig(
@ -71,7 +72,7 @@ def index_project(project_path: Path, force: bool = False):
print(f" Use --verbose for details")
sys.exit(1)
def search_project(project_path: Path, query: str, limit: int = 5):
def search_project(project_path: Path, query: str, limit: int = 10, synthesize: bool = False):
"""Search a project directory."""
try:
# Check if indexed first
@ -123,6 +124,21 @@ def search_project(project_path: Path, query: str, limit: int = 5):
print()
# LLM Synthesis if requested
if synthesize:
print("🧠 Generating LLM synthesis...")
synthesizer = LLMSynthesizer()
if synthesizer.is_available():
synthesis = synthesizer.synthesize_search_results(query, results, project_path)
print()
print(synthesizer.format_synthesis_output(synthesis, query))
else:
print("❌ LLM synthesis unavailable")
print(" • Ensure Ollama is running: ollama serve")
print(" • Install a model: ollama pull llama3.2")
print(" • Check connection to http://localhost:11434")
# Save last search for potential enhancements
try:
(rag_dir / 'last_search').write_text(query)
@ -222,9 +238,10 @@ def main():
formatter_class=argparse.RawDescriptionHelpFormatter,
epilog="""
Examples:
rag-mini index /path/to/project # Index a project
rag-mini search /path/to/project "query" # Search indexed project
rag-mini status /path/to/project # Show status
rag-mini index /path/to/project # Index a project
rag-mini search /path/to/project "query" # Search indexed project
rag-mini search /path/to/project "query" -s # Search with LLM synthesis
rag-mini status /path/to/project # Show status
"""
)
@ -236,10 +253,12 @@ Examples:
help='Search query (for search command)')
parser.add_argument('--force', action='store_true',
help='Force reindex all files')
parser.add_argument('--limit', type=int, default=5,
parser.add_argument('--limit', type=int, default=10,
help='Maximum number of search results')
parser.add_argument('--verbose', '-v', action='store_true',
help='Enable verbose logging')
parser.add_argument('--synthesize', '-s', action='store_true',
help='Generate LLM synthesis of search results (requires Ollama)')
args = parser.parse_args()
@ -263,7 +282,7 @@ Examples:
if not args.query:
print("❌ Search query required")
sys.exit(1)
search_project(args.project_path, args.query, args.limit)
search_project(args.project_path, args.query, args.limit, args.synthesize)
elif args.command == 'status':
status_check(args.project_path)

View File

@ -285,14 +285,14 @@ class SimpleTUI:
# Get result limit
try:
limit = int(self.get_input("Number of results", "5"))
limit = int(self.get_input("Number of results", "10"))
limit = max(1, min(20, limit)) # Clamp between 1-20
except ValueError:
limit = 5
limit = 10
# Show CLI command
cli_cmd = f"./rag-mini search {self.project_path} \"{query}\""
if limit != 5:
if limit != 10:
cli_cmd += f" --limit {limit}"
self.print_cli_command(cli_cmd, "Search for semantic matches")