@@ -1212,18 +1212,24 @@ async def _ret(*args, **kwargs):
12121212 assert result [0 ].function .name == "search"
12131213
12141214
1215- def test_validate_call_params_handles_introspection_error ():
1215+ def test_validate_call_params_handles_introspection_error (caplog ):
12161216 """Verify _validate_call_params gracefully handles LiteLLM introspection errors without crashing.
12171217
12181218 When the provider is not in the static list, introspection is attempted.
12191219 An exception during introspection must be caught and treated as supported
1220- so the request can proceed with custom/proxy models.
1220+ so the request can proceed with custom/proxy models. The failure is
1221+ logged at DEBUG level so developers can trace the fallback.
12211222 """
1223+ import logging
1224+
12221225 llm = LLM (model = "custom/unsupported-model" , is_litellm = True , response_format = {"type" : "json_object" })
12231226
1224- with patch ("crewai.llm.supports_response_schema" , side_effect = Exception ("Introspection error" )):
1225- # Should not raise exception -- permissive fallback applies
1226- llm ._validate_call_params ()
1227+ with caplog .at_level (logging .DEBUG , logger = "crewai.llm" ):
1228+ with patch ("crewai.llm.supports_response_schema" , side_effect = Exception ("Introspection error" )):
1229+ # Should not raise exception -- permissive fallback applies
1230+ llm ._validate_call_params ()
1231+
1232+ assert any ("LiteLLM supports_response_schema check failed" in r .message for r in caplog .records )
12271233
12281234
12291235def test_validate_call_params_raises_for_confirmed_unsupported_model ():
0 commit comments