def test_prepare_chat_with_tools_tool_not_required():
    """Test that tool_required is correctly passed to the API request when False."""
    llm = LiteLLM(model="gpt-3.5-turbo")

    # Test with tool_required=False (default)
    result = llm._prepare_chat_with_tools(
        tools=[search_tool],
    )

    assert result["tool_choice"] == "auto"
    assert len(result["tools"]) == 1
    assert result["tools"][0]["function"]["name"] == "search_tool"
Test that tool_required is correctly passed to the API request when False.
llama-index-integrations/llms/llama-index-llms-litellm/tests/test_llms_litellm.py