summaryrefslogtreecommitdiff
path: root/collaborativeagents/scripts/test_extractor.py
diff options
context:
space:
mode:
authorYurenHao0426 <blackhao0426@gmail.com>2026-01-27 09:57:37 -0600
committerYurenHao0426 <blackhao0426@gmail.com>2026-01-27 09:57:37 -0600
commitdc801c07cf38b0c495686463e6ca6f871a64440e (patch)
tree599f03114775921dbc472403c701f4a3a8ea188a /collaborativeagents/scripts/test_extractor.py
parente43b3f8aa36c198b95c1e46bea2eaf3893b13dc3 (diff)
Add collaborativeagents module and update gitignore
- Add collaborativeagents subproject with adapters, agents, and evaluation modules - Update .gitignore to exclude large binary files (.whl, .tar), wandb logs, and results Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'collaborativeagents/scripts/test_extractor.py')
-rw-r--r--collaborativeagents/scripts/test_extractor.py46
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)