1818logging .basicConfig (level = logging .INFO )
1919logger = logging .getLogger (__name__ )
2020
21+
2122def test_langchain_adapter ():
2223 """Test LangChain adapter."""
2324 print ("Testing LangChain adapter..." )
2425
2526 try :
26- from a3m_llm_adapter import A3MChatModel
27+ from a3m_adapter import A3MLangChainAdapter
2728
2829 # Initialize
29- llm = A3MChatModel (model = "auto" , temperature = 0.7 )
30- print (f"�� ✅ Initialized: { llm } " )
30+ llm = A3MLangChainAdapter (model = "auto" , temperature = 0.7 )
31+ print (f"✅ Initialized: { llm } " )
3132
3233 # Test simple generation
3334 # Note: This would make actual API calls - we'll skip for now
3435 # In a real test, we'd mock the A3M router
35- print ("�� ✅ LangChain adapter structure OK" )
36- return True
36+ print ("✅ LangChain adapter structure OK" )
37+ assert llm is not None
3738
3839 except Exception as e :
39- print (f"��❌ LangChain adapter failed: { e } " )
40- return False
40+ print (f"❌ LangChain adapter failed: { e } " )
41+ raise
42+
4143
4244def test_llamaindex_adapter ():
4345 """Test LlamaIndex adapter."""
4446 print ("Testing LlamaIndex adapter..." )
4547
4648 try :
47- from a3m_llama_index_adapter import A3MLlamaIndexLLM
49+ from a3m_adapter import A3MLlamaIndexAdapter
4850
4951 # Initialize
50- llm = A3MLlamaIndexLLM (model = "auto" , temperature = 0.5 )
51- print (f"�� ✅ Initialized: { llm } " )
52+ llm = A3MLlamaIndexAdapter (model = "auto" , temperature = 0.5 )
53+ print (f"✅ Initialized: { llm } " )
5254
5355 # Check metadata
5456 metadata = llm .metadata
55- print (f"�� ✅ Metadata: { metadata . model_name } , tokens: { metadata . num_output } " )
56- return True
57+ print (f"✅ Metadata: { metadata } " )
58+ assert metadata is not None
5759
5860 except Exception as e :
59- print (f"��❌ LlamaIndex adapter failed: { e } " )
60- return False
61+ print (f"❌ LlamaIndex adapter failed: { e } " )
62+ raise
63+
6164
6265def test_config ():
6366 """Test configuration."""
6467 print ("Testing configuration..." )
6568
6669 try :
67- from a3m_adapter_config import A3MConfig
70+ from a3m_adapter import A3MConfig
6871
6972 # Test defaults
7073 config = A3MConfig ()
71- print (f"�� ✅ Default config: model={ config .model } " )
74+ print (f"✅ Default config: model={ config .model } " )
7275
7376 # Test to_dict
7477 data = config .to_dict ()
7578 assert 'model' in data
76- print ("�� ✅ Config to_dict works" )
79+ print ("✅ Config to_dict works" )
7780
7881 # Test JSON serialization
7982 json_str = config .to_json ()
8083 assert '"model"' in json_str
81- print ("��✅ Config JSON serialization works" )
82-
83- return True
84+ print ("✅ Config JSON serialization works" )
8485
8586 except Exception as e :
86- print (f"��❌ Config test failed: { e } " )
87- return False
87+ print (f"❌ Config test failed: { e } " )
88+ raise
89+
8890
8991def main ():
9092 """Run all tests."""
@@ -102,19 +104,15 @@ def main():
102104 total = len (tests )
103105
104106 for test in tests :
105- if test ():
106- passed += 1
107+ test ()
108+ passed += 1
107109 print ()
108110
109111 print ("=" * 50 )
110112 print (f"Results: { passed } /{ total } tests passed" )
111-
112- if passed == total :
113- print ("���🎉 All tests passed!" )
114- return 0
115- else :
116- print ("��❌ Some tests failed" )
117- return 1
113+ print ("🎉 All tests passed!" )
114+ return 0
115+
118116
119117if __name__ == "__main__" :
120118 sys .exit (main ())
0 commit comments