88from litellm .types .utils import ModelResponse , Choices
99from grizabella .core .models import ObjectTypeDefinition , PropertyDefinition , PropertyDataType
1010from scripts .start_mcp_servers import create_clients , MCPClientManager
11+ from dotenv import load_dotenv
12+
13+ load_dotenv ()
1114
1215# Test configuration
1316TEST_DB_PATH = "test_mcp_news_db"
@@ -72,11 +75,12 @@ async def execute_tool_call(tool_call, sessions):
7275 result = await session .call_tool (tool_name , args )
7376 return result
7477
78+ #@pytest.mark.skipif(
79+ #not os.getenv("OPENROUTER_MODEL"),
80+ # reason="OpenRouter model not set"
81+ #)
7582@pytest .mark .asyncio
76- @pytest .mark .skipif (
77- not os .getenv ("OPENROUTER_API_KEY" ) or not os .getenv ("OPENROUTER_MODEL" ),
78- reason = "OpenRouter credentials not set"
79- )
83+ @pytest .mark .skip
8084async def test_news_workflow ():
8185 # Create MCP clients using start_mcp_servers utility
8286 clients = create_clients ()
@@ -92,7 +96,9 @@ async def test_news_workflow():
9296 print ("All client sessions initialized successfully" )
9397
9498 # Set up LiteLLM model
95- model = os .getenv ("LMSTUDIO_MODEL" )
99+ model = os .getenv ("OPENROUTER_MODEL" )
100+ api_base = "https://openrouter.ai/api/v1"
101+ api_key = os .getenv ("OPENROUTER_API_KEY" )
96102
97103 # System message guiding the LLM
98104 system_message = (
@@ -126,8 +132,8 @@ async def test_news_workflow():
126132 tools = tools ,
127133 tool_choice = "auto" ,
128134 max_tokens = MAX_TOKENS ,
129- api_base = "http://localhost:1234/v1" ,
130- api_key = "1234"
135+ api_base = api_base ,
136+ api_key = api_key
131137 )
132138 print (f"Initial LLM response: { response } " )
133139 cast_response = cast (ModelResponse , response )
@@ -220,8 +226,8 @@ async def test_news_workflow():
220226 tools = tools ,
221227 tool_choice = "auto" ,
222228 max_tokens = MAX_TOKENS ,
223- api_base = "http://localhost:1234/v1" ,
224- api_key = "1234"
229+ api_base = api_base ,
230+ api_key = api_key
225231 )
226232
227233 iteration += 1
@@ -243,8 +249,8 @@ async def test_news_workflow():
243249 tools = [], # No tools to prevent further tool calls
244250 tool_choice = "none" ,
245251 max_tokens = MAX_TOKENS ,
246- api_base = "http://localhost:1234/v1" ,
247- api_key = "1234"
252+ api_base = api_base ,
253+ api_key = api_key
248254 )
249255
250256 final_response = get_response_string (cast (ModelResponse , response ))
0 commit comments