#!/usr/bin/env python3
"""
Quick import test to verify components are loadable
"""
import sys
import os
from pathlib import Path
# Add paths
current_dir = Path(__file__).parent
kb_path = current_dir / "knowledge-base"
src_path = current_dir / "src"
sys.path.insert(0, str(kb_path))
sys.path.insert(0, str(src_path))
print("π§ Testing component imports...")
try:
from llm_statistical_advisor import create_llm_statistical_advisor, LLMStatisticalAdvisor
print("β
LLM Statistical Advisor imports")
except Exception as e:
print(f"β LLM Statistical Advisor import failed: {e}")
try:
from kb_search import create_search_engine, CensusSearchEngine
print("β
Search engine imports")
except Exception as e:
print(f"β Search engine import failed: {e}")
try:
from geographic_parsing import GeographicContext, create_geographic_parser
print("β
Geographic parsing imports")
except Exception as e:
print(f"β Geographic parsing import failed: {e}")
try:
from variable_search import create_variables_search, VariablesSearch
print("β
Variable search imports")
except Exception as e:
print(f"β Variable search import failed: {e}")
# Check environment
openai_key = os.getenv('OPENAI_API_KEY')
print(f"π OpenAI API Key: {'Present' if openai_key else 'Missing'}")
# Check critical directories
kb_dirs = [
kb_path / "variables-db",
kb_path / "table-catalog",
kb_path / "methodology-db",
kb_path / "geo-db" / "geography.db"
]
for dir_path in kb_dirs:
exists = dir_path.exists()
print(f"π {dir_path.name}: {'β
' if exists else 'β'}")
print("\nπ― Component availability summary:")
print("- All critical Python modules should import successfully")
print("- OpenAI API key should be present for embeddings")
print("- Knowledge base directories should exist")
print("\nIf all show β
, the wiring should work!")