diff options
Diffstat (limited to 'collaborativeagents/scripts/test_extractor.py')
| -rw-r--r-- | collaborativeagents/scripts/test_extractor.py | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/collaborativeagents/scripts/test_extractor.py b/collaborativeagents/scripts/test_extractor.py new file mode 100644 index 0000000..a2b4ac1 --- /dev/null +++ b/collaborativeagents/scripts/test_extractor.py @@ -0,0 +1,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) |
