Skip to content

Fix Perplexity Agent API payload field names - #13

Open
dan-s-w wants to merge 1 commit into
mainfrom
fix/perplexity-agent-payload
Open

Fix Perplexity Agent API payload field names#13
dan-s-w wants to merge 1 commit into
mainfrom
fix/perplexity-agent-payload

Conversation

@dan-s-w

@dan-s-w dan-s-w commented Aug 14, 2026

Copy link
Copy Markdown

Problem

PerplexityFinanceSearchSampler builds a request body the Perplexity Agent API rejects. Every call returns HTTP 400 before reaching the model, so both sampler configs are non-functional as merged:

  • perplexity_finance_historical_lookup
  • perplexity_finance_multi_step_research

Not intermittent or degraded — no request from either config can succeed.

Reproduce with:

python src/evals/eval_runner.py \
  --samplers perplexity_finance_historical_lookup \
  --datasets fin_search_comp_t2_global --limit 1

The harness logs only the status line, so the cause isn't visible without probing the endpoint directly. The response bodies are:

invalid request body: json: unknown field "max_tokens"
invalid request body: json: unknown field "reasoning_effort"

Fix

Two field names, confirmed against the live API:

Sent Expected
max_tokens max_output_tokens
reasoning_effort: "low" reasoning: {"effort": "low"}

The second is rejected only after the first is fixed, so a partial fix still 400s.

Verification

Both samplers run clean on fin_search_comp_t2_global after the change (2 problems each, 0 failures). Uber FY2019 R&D returns $4,836,000,000, matching ground truth.

PerplexityDeepSearchSampler is not affected — it posts to /chat/completions, which does accept reasoning_effort as a top-level field. Verified separately.

Note for reviewers

The README's FinSearchComp T2 table lists 72.27% for perplexity_finance_historical_lookup. That figure can't have been produced by this code, since it cannot complete a request — so it either predates a payload change on Perplexity's side or came from a different script. Worth confirming provenance separately; tracked in AIEV-275.

Refs AIEV-275

🤖 Generated with Claude Code

PerplexityFinanceSearchSampler sent two fields the /v1/agent endpoint
rejects, so every request failed with HTTP 400 before reaching the model:

  invalid request body: json: unknown field "max_tokens"
  invalid request body: json: unknown field "reasoning_effort"

Both perplexity_finance_historical_lookup and
perplexity_finance_multi_step_research were affected — no request from
either config could succeed.

  max_tokens       -> max_output_tokens
  reasoning_effort -> reasoning: {"effort": ...}

Verified against the live API: both samplers now return correct answers
on fin_search_comp_t2_global (Uber FY2019 R&D -> $4,836,000,000, matching
ground truth).

PerplexityDeepSearchSampler is unaffected; it uses /chat/completions,
which does accept reasoning_effort as a top-level field.

Refs AIEV-275

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants