Skip to content

Perplexity: answer cites sources that numResults truncates away #340

Description

@schlessera

Ran a search with provider: "perplexity", numResults: 8, workflow: "none" (v0.27.0). The answer cites [9] through [13], but only 8 sources come back.

Looks like perplexity.ts:

const answer = (data.choices as ...)?.[0]?.message?.content || "";
const citations = Array.isArray(data.citations) ? data.citations : [];

const results: SearchResult[] = [];
for (let i = 0; i < Math.min(citations.length, numResults); i++) {

The citations array gets cut to numResults; the answer text doesn't. Sonar numbers its markers against the full list, so everything past numResults ends up pointing at nothing.

Repro — query WebMCP best practices, numResults: 8:

...multiple guides emphasize selecting only the core, repeatable actions of the product.[1][5][9]
...Prefer lazy/contextual registration so agents only see tools that make sense for the current page state.[2][7]
...Use Chrome-supported debugging or inspector workflows...[1][10]
...Use it when the action depends on the current tab state...[11][13]

**Sources:**
1. Source 1
   https://developer.chrome.com/docs/ai/webmcp/best-practices
... (8 total)

Either keep the citations the answer actually references, or renumber the markers to match what survives. Worth considering whether numResults should apply to Perplexity at all — for the link-list providers it means "how many results", but for a synthesis provider it's cutting the answer's own bibliography.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions