One-shot web answering, in fixed steps:
- Plan - one model call turns the question into a few search
queries (skipped when the caller passes
:queries). - Search - every query runs concurrently; hits are de-duplicated by URL.
- Rank - one model call scores each hit's relevance from 0 to 1,
seeing only its title, URL and description. Hits at or above
:min_relevanceare kept, best first. - Scrape - the best
:max_sourceskept hits are scraped concurrently; an unreadable page is replaced by the next kept hit, and a page another source already covers is skipped. - Summarize - one model call writes the answer from the numbered
sources, as text with
[n]citations or as an object matching:schema.
The result is a Perplexed.Answer carrying the answer, the sources it
was written from, and every hit considered with why it was used or not.
Untrusted content
Search results and page text are written by third parties. They reach the
model inside <result> and <source> tags, with a standing instruction to
treat that text as data, never as instructions. That lowers, but does not
remove, the risk of a page steering its own rank or the answer; treat
answers, and especially structured answers you act on, accordingly.
Summary
Functions
Answers query from the web.
Types
@type t() :: %Perplexed.Pipeline{ answer: term(), candidates: term(), cited: term(), explicit_queries: term(), generate_object: term(), generate_text: term(), hits_per_query: term(), instructions: term(), max_queries: term(), max_sources: term(), min_relevance: term(), model: term(), model_options: term(), object_options: term(), page_chars: term(), provider: term(), queries: term(), query: term(), schema: term(), scrape_options: term(), search_options: term(), sources: term(), task_supervisor: term(), trace: term(), use_search_content: term(), validation_retries: term() }
One run's resolved options and accumulated state.
Functions
@spec run(String.t(), keyword()) :: {:ok, Perplexed.Answer.t()} | {:error, Perplexed.error()}
Answers query from the web.
Options
:model- a ReqLLM model spec, defaultconfig :perplexed, model:. Any provider ReqLLM supports works.:model_options- ReqLLM options for every model call, overriding the built-inmax_tokens: 4000andreceive_timeout:;:object_options- extra options for structured-output calls.:schema- a Zoi schema; the answer becomes a validated object.:instructions- system instructions for the summary call, replacing the built-in ones (the untrusted-content note is always kept).:queries- search queries to run instead of planning them.:max_queries- planned queries, default 3.:provider,:search_options- the search provider spec and its options;:hits_per_querydefaults to 8.:max_sources- pages to read and summarize, default 5.:min_relevance- lowest ranking score kept, default 0.5.:scrape_options- options forPerplexed.Scrape.batch/2, such as:ladder.:page_chars- characters of each page given to the summary, default 12000.:use_search_content- read the page text a search provider returned with a hit (DeepSeek does) instead of scraping it, when that text passesPerplexed.Verdict; defaulttrue. Such a source's tier is:search.:validation_retries- schema-mismatch retries, default 1.:task_supervisor- defaultPerplexed.TaskSupervisor.:generate_object,:generate_text- stand-ins forReqLLM.generate_object/4andReqLLM.generate_text/3, for tests.