def METHOD_NAME(top_p_sampler):
    ws = WebSearch(api_key=os.environ.get("SERPERDEV_API_KEY", None))
    pipe = Pipeline()
    pipe.add_node(component=ws, name="ws", inputs=["Query"])
    pipe.add_node(component=top_p_sampler, name="sampler", inputs=["ws"])
    result = pipe.run(query="Who is the boyfriend of Olivia Wilde?")
    assert "documents" in result
    assert len(result["documents"]) > 0
    assert isinstance(result["documents"][0], Document)