def test_convert_llama_index_schema_to_gemini_function_declaration_nested_case(
    llm: GoogleGenAI,
) -> None:
    """Test conversion of a llama_index fn_schema to a gemini function declaration."""
    function_tool = get_function_tool(Schema)

    llama_index_model_json_schema = function_tool.metadata.fn_schema.model_json_schema()
    # check that the model_json_schema contains a $defs key, which is not supported by Gemini
    assert "$defs" in llama_index_model_json_schema

    converted = convert_schema_to_function_declaration(llm._client, function_tool)

    assert converted.name == "Schema"
    assert converted.description is not None
    assert converted.parameters.required is not None

    assert converted.parameters
    assert list(converted.parameters.properties) == [
        "schema_name",
        "tables",
    ]

    assert converted.parameters.required == ["schema_name", "tables"]
Test conversion of a llama_index fn_schema to a gemini function declaration.
llama-index-integrations/llms/llama-index-llms-google-genai/tests/test_llms_google_genai.py