def mock_client_with_user_agent(client_type: str) -> Any:
    """Helper function to create a mock client with user agent configuration."""
    if client_type == "search":
        client = MagicMock(spec=SearchClient)
    else:
        client = MagicMock(spec=SearchIndexClient)

    # Mock the configuration chain
    client._client = MagicMock()
    client._client._config = MagicMock()
    client._client._config.user_agent_policy = MagicMock()
    client._client._config.user_agent_policy.add_user_agent = MagicMock()

    return client
Helper function to create a mock client with user agent configuration.
llama-index-integrations/vector_stores/llama-index-vector-stores-azureaisearch/tests/test_azureaisearch.py