File size: 1,228 Bytes
7644eac
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import os
import sys
from dotenv import load_dotenv

# Add the project root to sys.path
PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__)))
sys.path.insert(0, PROJECT_ROOT)

# Load environment variables
load_dotenv()

print("Testing ModelOrchestrator...")
try:
    from src.ml.model_orchestrator import ModelOrchestrator
    print("Successfully imported ModelOrchestrator")
    
    # Initialize with API key from environment
    api_key = os.getenv("OPENAI_API_KEY")
    if not api_key:
        print("ERROR: OPENAI_API_KEY not found in environment variables.")
    else:
        print(f"Using API key starting with: {api_key[:10]}...")
        
        try:
            orchestrator = ModelOrchestrator(api_key=api_key)
            print("Successfully initialized ModelOrchestrator")
        except Exception as e:
            print(f"Error initializing ModelOrchestrator: {e}")
            import traceback
            traceback.print_exc()
except ImportError as e:
    print(f"Error importing ModelOrchestrator: {e}")
    import traceback
    traceback.print_exc()

except Exception as e:
    print(f"Unexpected error: {e}")
    import traceback
    traceback.print_exc()

print("Test script finished.")