perplexity_ai / app.py
xd11yggy's picture
Create app.py
32ffa10 verified
raw
history blame
400 Bytes
from smolagents import DuckDuckGoSearchTool
# Initialize the tool
web_search = DuckDuckGoSearchTool()
# Perform search
results = web_search("Pont des Arts length in meters")
# Print results
for i, result in enumerate(results[:3]): # Show top 3 results
print(f"Result {i+1}:")
print(f"Title: {result['title']}")
print(f"URL: {result['href']}")
print(f"Snippet: {result['body']}\n")