def test_prepare_chat_with_tools_tool_required(mock_google_genai: GoogleGenAI) -> None:
    """Test that tool_required is correctly passed to the API request when True."""
    # Test with tool_required=True
    result = mock_google_genai._prepare_chat_with_tools(
        tools=[search_tool], tool_required=True
    )

    assert (
        result["tool_config"].function_calling_config.mode
        == types.FunctionCallingConfigMode.ANY
    )
    assert len(result["tools"]) == 1
    assert result["tools"][0].function_declarations[0].name == "search_tool"
Test that tool_required is correctly passed to the API request when True.
llama-index-integrations/llms/llama-index-llms-google-genai/tests/test_llms_google_genai.py