Fix Perplexity Agent API payload field names - #13
Open
dan-s-w wants to merge 1 commit into
Open
Conversation
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>
zairahms
approved these changes
Aug 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
PerplexityFinanceSearchSamplerbuilds 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_lookupperplexity_finance_multi_step_researchNot intermittent or degraded — no request from either config can succeed.
Reproduce with:
The harness logs only the status line, so the cause isn't visible without probing the endpoint directly. The response bodies are:
Fix
Two field names, confirmed against the live API:
max_tokensmax_output_tokensreasoning_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_globalafter the change (2 problems each, 0 failures). Uber FY2019 R&D returns$4,836,000,000, matching ground truth.PerplexityDeepSearchSampleris not affected — it posts to/chat/completions, which does acceptreasoning_effortas 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