def test_toolkit_with_invalid_function_input_mocked():
    """
    Test toolkit with invalid input parameters for function conversion using mocks.
    """
    mock_function_info = generate_mock_function_info(has_properties=False)
    mock_fn_schema = mock.Mock()
    mock_fn_schema.pydantic_model = {"x": {"type": "string"}}

    mock_client = mock.create_autospec(BaseFunctionClient, instance=True)
    mock_client.get_function.return_value = mock_function_info
    mock_client.to_dict.return_value = {"mock": "config"}

    with (
        mock.patch(
            "unitycatalog.ai.llama_index.toolkit.validate_or_set_default_client",
            return_value=mock_client,
        ) as mock_validate_client,
    ):
        tool = UCFunctionToolkit.uc_function_to_llama_tool(
            function_name="catalog.schema.test_function", client=mock_client, return_direct=True
        )

        mock_client.execute_function.side_effect = ValueError(
            "Extra parameters provided that are not defined"
        )

        invalid_inputs = {"unexpected_key": "value"}

        with pytest.raises(ValueError, match="Extra parameters provided that are not defined"):
            tool.fn(**invalid_inputs)
        mock_validate_client.assert_called_once()
        mock_client.get_function.assert_called_once_with("catalog.schema.test_function")
        mock_client.to_dict.assert_called_once()
        mock_client.execute_function.assert_called_once_with(
            function_name="catalog.schema.test_function",
            parameters=invalid_inputs,
            enable_retriever_tracing=False,
        )

    Test toolkit with invalid input parameters for function conversion using mocks.
    
ai/integrations/llama_index/tests/test_llama_index_toolkit.py