Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions src/server/providers/adapters/perplexity.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,59 @@ describe('parsePerplexityEffortLevels', () => {
])
})

// Served since 2026-11-19: xhigh's Model bullet names one id and states
// there is no fallback. ultra still has no frozen configuration and names
// its runtime model only in that sentence. Trimmed to the bullets the
// parser reads, from https://docs.perplexity.ai/docs/agent-api/effort.md.
const NO_FALLBACK_DOC = [
'## Current effort level values',
'',
'> [accordion] fast — current effort level values',
'>',
'> * **Models:** `openai/gpt-6-luna`, with `openai/gpt-5.6-luna` as the [fallback model](https://docs.perplexity.ai/docs/agent-api/model-fallback.md)',
'> * **Reasoning effort:** `none`',
'> * **Tools:** `web_search`',
'',
'> [accordion] low — current effort level values',
'>',
'> * **Model:** `openai/gpt-6-luna`',
'> * **Reasoning effort:** `minimal`',
'> * **Tools:** `web_search`, `fetch_url` (`max_urls: 1`)',
'',
'> [accordion] medium — current effort level values',
'>',
'> * **Model:** `openai/gpt-6-luna`',
'> * **Reasoning effort:** `medium`',
'> * **Tools:** `web_search`, `fetch_url` (`max_urls: 1`)',
'',
'> [accordion] high — current effort level values',
'>',
'> * **Model:** `openai/gpt-6.1-terra`',
'> * **Reasoning effort:** `medium`',
'> * **Tools:** `web_search`, `fetch_url` (`max_urls: 1`)',
'',
'> [accordion] xhigh — current effort level values',
'>',
'> * **Model:** `openai/gpt-6.2-sol` (no fallback model)',
'> * **Reasoning effort:** `high`',
'> * **Tools:** `web_search`, `finance_search`, `sandbox`',
'',
'> [accordion] ultra: current effort level values',
'>',
'> `ultra` has no frozen configuration. It runs on `anthropic/claude-opus-5-5`, and its settings are not all part of the documented request schema, so call it by name.',
'',
'## Next Steps',
].join('\n')

it("reads a Model bullet that states there is no fallback, and skips ultra's runtime model named only in prose", () => {
expect(NO_FALLBACK_DOC).toContain('(no fallback model)')
expect([...parsePerplexityEffortLevels(NO_FALLBACK_DOC)]).toEqual([
['openai/gpt-6-luna', ['reasoning', 'reasoning_effort', 'tools']],
['openai/gpt-6.1-terra', ['reasoning', 'reasoning_effort', 'tools']],
['openai/gpt-6.2-sol', ['reasoning', 'reasoning_effort', 'tools']],
])
})

it.each([
[
'a fallback clause in another shape',
Expand Down Expand Up @@ -486,6 +539,11 @@ describe('parsePerplexityEffortLevels', () => {
'* **LLM:** `openai',
],
['a model that is prose', '`anthropic/claude-opus-5-5`', 'Claude Opus 5.5'],
[
'text after a Model id other than (no fallback model)',
'`anthropic/claude-opus-5-5`',
'`anthropic/claude-opus-5-5` (preview)',
],
['an effort that is prose', '`high`', 'high, or lower on retries'],
[
'tools that are prose',
Expand Down
9 changes: 6 additions & 3 deletions src/server/providers/adapters/perplexity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,13 +268,16 @@ export function parsePerplexityEffortLevels(markdown: string): StatedFlags {
const tools = bullet('Tools')
const single = bullet('Model')
const several = bullet('Models')
// `Models:` names the level's model, then the fallback the request
// carries. Only the first is the model the level is stated to run on.
// `Model:` is a bare backticked id, or that id plus `(no fallback model)`
// (xhigh since 2026-11-19). That note states there is no fallback; any
// other text after the id is unread. `Models:` names the level's model,
// then the fallback the request carries. Only the first is the model
// the level is stated to run on.
const model =
single !== null && several !== null
? undefined
: single !== null
? /^`([^`\s]+)`$/.exec(single)?.[1]
? /^`([^`\s]+)`(?: \(no fallback model\))?$/.exec(single)?.[1]
: /^`([^`\s]+)`, with `[^`\s]+` as the \[fallback model\]\([^)\s]+\)$/.exec(
several ?? '',
)?.[1]
Expand Down
Loading