-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_rag.py
More file actions
43 lines (36 loc) 路 1.32 KB
/
Copy pathtest_rag.py
File metadata and controls
43 lines (36 loc) 路 1.32 KB
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
from rag import LinRAG
# Mock data mimicking your skills/system JSON structure
mock_skills = {
"media_controls": [
{"intent": "play_music", "description": "Starts playing music or resumes playback."},
{"intent": "stop_music", "description": "Stops the current music stream."}
],
"workspace_management": [
{"intent": "change_workspace", "description": "Switches to a different virtual desktop or workspace number."}
]
}
mock_system = {
"power": [
{"intent": "shutdown", "description": "Powers off the computer immediately."},
{"intent": "reboot", "description": "Restarts the operating system."}
]
}
def run_test():
print("--- Initializing LinRAG Engine ---")
# Initializing with our mock dictionaries
rag = LinRAG(mock_skills, mock_system)
test_queries = [
"stop the song currently playing",
"restart my computer",
"change virtual desktop to 8"
]
print("\n--- Testing Retrieval ---")
for query in test_queries:
print(f"\n馃懁 Query: '{query}'")
results = rag.query(query, top_k=2)
for i, res in enumerate(results):
intent = res.get('intent')
desc = res.get('description')
print(f" [{i+1}] Match: {intent} - {desc}")
if __name__ == "__main__":
run_test()