Preheat the oven to 170C.
Put the olive oil and sage leaves in a pan. Fry until crisp and then immediately remove the sage leaves and set aside.
Add the sliced onions to the same pan. Cook over a low to moderate heat for 20-30 minutes, stirring occasionally, until soft and caramelised. Set aside.
Lay the puff pastry out on a lined baking tray and top with the caramelised onions, leaving a border all around. Top with the potatoes and grated gruyère. Bake for 15 minutes.
Remove from the oven when golden-brown, garnish with the crisp sage leaves and serve.