Perplexity: unlock reasoning effort

489d46b9a09ed0961c55b59094bf229c5af53d70

Cohee <18619528+Cohee1207@users.noreply.github.com>

3 files changed, +6 -3Showing whitespace changes
public/index.html+2 -2
@@ -2078,7 +2078,7 @@
20782078 </span>
20792079 </div>
20802080 </div>
20812081 <div class="flex-container flexFlowColumn wide100p textAlignCenter marginTop10" data-source="openai,custom,claude,xai,makersuite,vertexai,aimlapi,openrouter,pollinations,perplexity">
20822082 <div class="flex-container oneline-dropdown" title="Constrains effort on reasoning for reasoning models.&#10;Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response." data-i18n="[title]Constrains effort on reasoning for reasoning models.">
20832083 <label for="openai_reasoning_effort">
20842084 <span data-i18n="Reasoning Effort">Reasoning Effort</span>
@@ -2092,7 +2092,7 @@
20922092 <option data-i18n="openai_reasoning_effort_high" value="high">High</option>
20932093 <option data-i18n="openai_reasoning_effort_maximum" value="max">Maximum</option>
20942094 </select>
20952095 <div class="toggle-description justifyLeft marginBot5" data-source="openai,custom,xai,aimlapi,openrouter,perplexity" data-i18n="OpenAI-style options: low, medium, high. Minimum and maximum are aliased to low and high. Auto does not send an effort level.">
20962096 OpenAI-style options: low, medium, high. Minimum and maximum are aliased to low and high. Auto does not send an effort level.
20972097 </div>
20982098 <div class="toggle-description justifyLeft marginBot5" data-source="claude" data-i18n="Allocates a portion of the response length for thinking (min: 1024 tokens, low: 10%, medium: 25%, high: 50%, max: 95%), but minimum 1024 tokens. Auto does not request thinking.">
public/scripts/openai.js+1 -0
@@ -2160,6 +2160,7 @@ function getReasoningEffort() {
21602160 chat_completion_sources.AIMLAPI,
21612161 chat_completion_sources.OPENROUTER,
21622162 chat_completion_sources.POLLINATIONS,
2163+ chat_completion_sources.PERPLEXITY,
21632164 ];
21642165
21652166 if (!reasoningEffortSources.includes(oai_settings.chat_completion_source)) {
src/endpoints/backends/chat-completions.js+3 -1
@@ -1507,7 +1507,9 @@ router.post('/generate', function (request, response) {
15071507 apiUrl = API_PERPLEXITY;
15081508 apiKey = readSecret(request.user.directories, SECRET_KEYS.PERPLEXITY);
15091509 headers = {};
15101510 bodyParams = {};
1511+ reasoning_effort: request.body.reasoning_effort,
1512+ };
15111513 request.body.messages = postProcessPrompt(request.body.messages, PROMPT_PROCESSING_TYPE.STRICT, getPromptNames(request));
15121514 } else if (request.body.chat_completion_source === CHAT_COMPLETION_SOURCES.GROQ) {
15131515 apiUrl = API_GROQ;