#!/usr/bin/env python3
"""
Script to verify LLM analysis results
"""
import json
import sys

def verify_results():
    try:
        with open("llm_analysis_results.json", "r") as f:
            results = json.load(f)
        
        summary = results.get("summary", {})
        print("📊 Analysis Summary:")
        print("  Files retrieved: {}".format(summary.get("total_files_retrieved", 0)))
        print("  Batches processed: {}".format(summary.get("batches_processed", 0)))
        print("  Successful LLM batches: {}".format(summary.get("successful_llm_batches", 0)))
        print("  Documents analyzed: {}".format(summary.get("total_documents_analyzed", 0)))
        
        llm_results = results.get("llm_results", {})
        batch_results = llm_results.get("batch_results", [])
        
        successful_analyses = sum(1 for batch in batch_results if batch.get("llm_response", {}).get("success", False))
        print("  Successful analyses: {}/{}".format(successful_analyses, len(batch_results)))
        
        return True
        
    except Exception as e:
        print("❌ Error reading results: {}".format(e))
        return False

if __name__ == "__main__":
    success = verify_results()
    sys.exit(0 if success else 1)
