def test_to_azure_tool_choice():
    """Test that tool_required is correctly mapped to Azure's tool_choice parameter."""
    llm = AzureAICompletionsModel(
        endpoint="https://my-endpoint.inference.ai.azure.com",
        credential="my-api-key",
    )

    # Test with tool_required=True
    tool_choice = llm._to_azure_tool_choice(tool_required=True)
    assert tool_choice == ChatCompletionsToolChoicePreset.REQUIRED

    # Test with tool_required=False
    tool_choice = llm._to_azure_tool_choice(tool_required=False)
    assert tool_choice == ChatCompletionsToolChoicePreset.AUTO
Test that tool_required is correctly mapped to Azure's tool_choice parameter.
llama-index-integrations/llms/llama-index-llms-azure-inference/tests/test_llms_azure_inference.py