@@ -27,31 +27,39 @@ def check_llama_version(context: Context, llama_version: str) -> None:
2727 ), f"llama-stack version is { response_json ["llama_stack_version" ]} "
2828
2929
30- @then ("The body of the response for model {model} has proper structure" )
31- def check_model_structure (context : Context , model : str ) -> None :
32- """Check that the gpt-4o-mini model has the correct structure and required fields."""
30+ @then ("The body of the response has proper model structure" )
31+ def check_model_structure (context : Context ) -> None :
32+ """Check that the first LLM model has the correct structure and required fields."""
3333 response_json = context .response .json ()
3434 assert response_json is not None , "Response is not valid JSON"
3535
3636 assert "models" in response_json , "Response missing 'models' field"
3737 models = response_json ["models" ]
38- assert len (models ) > 0 , "Models list should not be empty "
38+ assert len (models ) > 0 , "Response has empty list of models "
3939
40- gpt_model = None
41- for model_id in models :
42- if "gpt-4o-mini" in model_id .get ("identifier" , "" ):
43- gpt_model = model_id
40+ # Find first LLM model (same logic as environment.py)
41+ llm_model = None
42+ for model in models :
43+ if model .get ("api_model_type" ) == "llm" :
44+ llm_model = model
4445 break
4546
46- assert gpt_model is not None
47+ assert llm_model is not None , "No LLM model found in response"
4748
48- assert gpt_model ["type" ] == "model" , "type should be 'model'"
49- assert gpt_model ["api_model_type" ] == "llm" , "api_model_type should be 'llm'"
50- assert gpt_model ["model_type" ] == "llm" , "model_type should be 'llm'"
51- assert gpt_model ["provider_id" ] == "openai" , "provider_id should be 'openai'"
49+ # Get expected values from context
50+ expected_model = context .default_model
51+ expected_provider = context .default_provider
52+
53+ # Validate structure and values
54+ assert llm_model ["type" ] == "model" , "type should be 'model'"
55+ assert llm_model ["api_model_type" ] == "llm" , "api_model_type should be 'llm'"
56+ assert llm_model ["model_type" ] == "llm" , "model_type should be 'llm'"
57+ assert (
58+ llm_model ["provider_id" ] == expected_provider
59+ ), f"provider_id should be '{ expected_provider } '"
5260 assert (
53- gpt_model ["provider_resource_id" ] == model
54- ), "provider_resource_id should be 'gpt-4o-mini '"
61+ llm_model ["provider_resource_id" ] == expected_model
62+ ), f "provider_resource_id should be '{ expected_model } '"
5563 assert (
56- gpt_model ["identifier" ] == f"openai/ { model } "
57- ), "identifier should be 'openai/gpt-4o-mini '"
64+ llm_model ["identifier" ] == f"{ expected_provider } / { expected_model } "
65+ ), f "identifier should be '{ expected_provider } / { expected_model } '"
0 commit comments