def _prepare_function_and_params(
        self, function_info: FunctionInfo, parameters: Optional[dict[str, Any]] = None
    ) -> tuple[Callable[..., Any], dict[str, Any]]:
        """
        Extracts or dynamically constructs the function from the FunctionInfo,
        applies parameter defaults, and caches the function for future calls.
        """
        parameters = process_function_parameter_defaults(function_info, parameters)
        if function_info.name in self.func_cache:
            func = self.func_cache[function_info.name]
        else:
            python_function = get_callable_definition(function_info)
            exec(python_function, self.func_cache)
            func = self.func_cache[function_info.name]
            self.func_cache[function_info.name] = lru_cache()(func)
        return func, parameters

        Extracts or dynamically constructs the function from the FunctionInfo,
        applies parameter defaults, and caches the function for future calls.
        
ai/core/src/unitycatalog/ai/core/client.py