blob: a2b4ac1672657d049ea69c21fa9def5028102a68 (
plain)
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
|
#!/usr/bin/env python3
"""Quick test for the preference extractor."""
import sys
sys.path.insert(0, "/projects/bfqt/users/yurenh2/ml-projects/personalization-user-model/src")
from personalization.config.registry import get_preference_extractor
print("="*60)
print("PREFERENCE EXTRACTOR TEST")
print("="*60)
print("\nLoading extractor (qwen3_0_6b_sft)...")
extractor = get_preference_extractor("qwen3_0_6b_sft")
print("Extractor loaded successfully!")
# Test extraction with various queries
test_queries = [
"I prefer Python over Java for scripting tasks",
"Please use bullet points instead of numbered lists",
"Can you explain this in simpler terms? I'm a beginner.",
"I like concise answers, not long explanations",
"Always show code examples when explaining programming concepts",
]
print("\n" + "="*60)
print("EXTRACTION TESTS")
print("="*60)
for i, query in enumerate(test_queries, 1):
print(f"\n--- Test {i} ---")
print(f"Query: {query}")
result = extractor.extract_preferences(query)
print(f"Extracted: {result}")
if result.get("preferences"):
for pref in result["preferences"]:
print(f" - condition: {pref.get('condition', 'N/A')}")
print(f" action: {pref.get('action', 'N/A')}")
print(f" confidence: {pref.get('confidence', 'N/A')}")
else:
print(" (No preferences extracted)")
print("\n" + "="*60)
print("TEST COMPLETE")
print("="*60)
|