A small Perplexity-style web search, scrape and answer toolkit for Elixir.
Perplexed searches the web through a provider you choose, reads the pages it finds, and turns them into a cited answer on any model ReqLLM supports.
- Swappable search - SearXNG, Firecrawl, Cloudflare Web Search (Ceramic,
Linkup, Exa) and DeepSeek built in, or any module implementing
Perplexed.Search, alone or as an ordered fallback chain. - Page reading - fetches pages as Markdown, PDFs included, with hosted scrapers (DeepSeek, Firecrawl, Cloudflare Browser Run) as cheapest-first fallbacks for pages the free tiers cannot read.
- Cited answers - plan, search, rank, read and summarize, returning the sources used and every result considered.
- Cost and telemetry - USD cost on every search, scrape and model call.
Installation
def deps do
[
{:perplexed, "~> 0.3.0"}
]
endStart Perplexed in your supervision tree with the keys you use:
children = [
{Perplexed,
firecrawl_api_key: System.fetch_env!("FIRECRAWL_API_KEY"),
provider: :firecrawl,
model: "anthropic:claude-haiku-4-5"}
]answer/2 also needs your model provider's key, configured the way ReqLLM
expects (for example ANTHROPIC_API_KEY).
Quick start
# Search the web
{:ok, results} = Perplexed.search("elixir release notes")
# Read a page as Markdown
{:ok, document} = Perplexed.scrape("https://example.com/guide")
# Get an answer with cited sources
{:ok, answer} = Perplexed.answer("When did the first Ferris wheel open?")Search providers and page readers support ordered fallback chains. For example,
use provider: [:deepseek, :firecrawl] in your configuration or per call.
PDFs require a module implementing Perplexed.PdfConverter, configured with
pdf_converter: MyApp.PdfConverter. Set a page budget per call:
Perplexed.scrape(url, pdf_max_pages: 20) # Skip PDFs longer than 20 pages
Perplexed.answer(question, pdf_max_pages: 80, pdf_over_limit: :first_pages)The default is unlimited; pdf_max_pages: nil overrides an application limit.
See Perplexed.PdfConverter for counting and bounded-conversion callbacks.
Documentation
- API reference — options, return types, and telemetry.
License
MIT. See LICENSE.