-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_classification.py
More file actions
53 lines (43 loc) · 1.58 KB
/
Copy pathtest_classification.py
File metadata and controls
53 lines (43 loc) · 1.58 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
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env python
"""Quick classification test"""
import sys
import os
from pathlib import Path
# Add current directory to path
sys.path.insert(0, '.')
# Load .env file
from dotenv import load_dotenv
load_dotenv()
print("🔍 Testing Classification System...\n")
# Check API key
api_key = os.getenv('SCIBOX_API_KEY')
if not api_key or api_key == 'your_api_key_here':
print("❌ SCIBOX_API_KEY not configured in .env file")
print(" Edit .env and set your actual API key")
sys.exit(1)
print(f"✅ API Key loaded from .env ({len(api_key)} chars)")
# Test classification
try:
from src.classification.classifier import classify
print("\n🚀 Classifying: 'Как открыть счет?'")
print(" (This may take 1-2 seconds on first call...)\n")
result = classify("Как открыть счет?")
print("=" * 70)
print("✅ CLASSIFICATION SUCCESS")
print("=" * 70)
print(f"Inquiry: {result.inquiry}")
print(f"Category: {result.category}")
print(f"Subcategory: {result.subcategory}")
print(f"Confidence: {result.confidence:.2f}")
print(f"Processing Time: {result.processing_time_ms}ms")
print("=" * 70)
print("\n✅ System is working correctly!")
except Exception as e:
print(f"\n❌ Classification failed: {e}")
import traceback
traceback.print_exc()
print("\nTroubleshooting:")
print("1. Check API key is valid at https://llm.t1v.scibox.tech/")
print("2. Check internet connectivity: ping llm.t1v.scibox.tech")
print("3. Try increasing timeout: Add API_TIMEOUT=5.0 to .env")
sys.exit(1)