File size: 1,834 Bytes
ad06665
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import sys
from pathlib import Path

# Add project root to path
sys.path.append(str(Path(__file__).parent))

from src.rag_engine import SatelliteRAG
import time

def evaluate_rag():
    print("Initializing Satellite RAG Engine for Evaluation...")
    try:
        engine = SatelliteRAG()
    except Exception as e:
        print(f"Failed to initialize engine: {e}")
        return

    test_questions = [
        "1. What is the spatial resolution of Gaofen 1?",
        "2. Who operates the Tianhui 1 satellite?",
        "3. When was the first Yaogan satellite launched?",
        "4. Which satellites are equipped with SAR (Synthetic Aperture Radar)?",
        "5. What is the difference between Gaofen 4 and Gaofen 5?",
        "6. List the instruments on board the Ziyuan 3 satellite.",
        "7. Tell me about the orbit of the Shijian 11 series.",
        "8. What is the purpose of the Chuangxin 1 satellite?",
        "9. How many spectral bands does the WFI on CBERS-4 have?",
        "10. Which launch vehicle was used for the Jilin-1 Gaofen 03 satellites?"
    ]

    print(f"\nStarting Evaluation with {len(test_questions)} Questions...\n")
    print("-" * 60)

    for i, question in enumerate(test_questions):
        print(f"\n[?] Question: {question}")
        start_time = time.time()
        
        try:
            response, docs = engine.query(question)
            end_time = time.time()
            duration = end_time - start_time
            
            print(f"[Time]: {duration:.2f}s")
            print(f"[Docs Retrieved]: {len(docs)}")
            print(f"[Answer]:")
            print(f"{response}")
            print("-" * 60)
            
        except Exception as e:
            print(f"Error processing question: {e}")
            print("-" * 60)

if __name__ == "__main__":
    evaluate_rag()