This commit is contained in:
Timothy Jaeryang Baek committed 2026-06-18 10:45:35 +02:00
1 parent 86ffe37cd8
commit c152eac632
13 files changed
+43 -5

No files matched your search

+7 -2
View File
@@ -9,11 +9,16 @@ from __future__ import annotations
import httpx
async def search(query: str, api_key: str, count: int = 5) -> str:
async def search(
query: str,
api_key: str,
count: int = 5,
base_url: str = "https://api.perplexity.ai",
) -> str:
"""Search using Perplexity's dedicated search API."""
async with httpx.AsyncClient(timeout=10) as client:
resp = await client.post(
"https://api.perplexity.ai/search",
f"{base_url.rstrip('/')}/search",
json={"query": query},
headers={
"Authorization": f"Bearer {api_key}",