@@ -751,6 +751,59 @@ async def test_async_streaming(self):
751751 assert len (total_content ) > 0
752752
753753
754+ # =============================================================================
755+ # SiliconFlow Tests
756+ # =============================================================================
757+
758+
759+ @pytest .mark .release
760+ @pytest .mark .skipif (
761+ not os .getenv ("SILICONFLOW_API_KEY" ),
762+ reason = "SILICONFLOW_API_KEY not configured" ,
763+ )
764+ class TestSiliconFlowChat :
765+ """Real integration tests for SiliconFlow chat and model discovery."""
766+
767+ MODEL = "deepseek-ai/DeepSeek-V3.1-Terminus"
768+
769+ def test_sync_chat_complete (self ):
770+ model = AIFactory .create_language ("siliconflow" , self .MODEL )
771+ response = model .chat_complete (messages = MESSAGES )
772+ assert isinstance (response , ChatCompletion )
773+ assert response .choices [0 ].message .content
774+
775+ async def test_async_chat_complete (self ):
776+ model = AIFactory .create_language ("siliconflow" , self .MODEL )
777+ response = await model .achat_complete (messages = MESSAGES )
778+ assert isinstance (response , ChatCompletion )
779+ assert response .choices [0 ].message .content
780+
781+ def test_sync_streaming (self ):
782+ model = AIFactory .create_language ("siliconflow" , self .MODEL )
783+ response = model .chat_complete (messages = MESSAGES , stream = True )
784+ total_content = ""
785+ for chunk in response :
786+ assert isinstance (chunk , ChatCompletionChunk )
787+ if chunk .choices [0 ].delta .content :
788+ total_content += chunk .choices [0 ].delta .content
789+ assert total_content
790+
791+ async def test_async_streaming (self ):
792+ model = AIFactory .create_language ("siliconflow" , self .MODEL )
793+ response = await model .achat_complete (messages = MESSAGES , stream = True )
794+ total_content = ""
795+ async for chunk in response :
796+ assert isinstance (chunk , ChatCompletionChunk )
797+ if chunk .choices [0 ].delta .content :
798+ total_content += chunk .choices [0 ].delta .content
799+ assert total_content
800+
801+ def test_model_discovery (self ):
802+ models = AIFactory .get_provider_models ("siliconflow" )
803+ assert models
804+ assert any (model .id == self .MODEL for model in models )
805+
806+
754807# =============================================================================
755808# MiniMax Tests
756809# =============================================================================
0 commit comments