Skip to content

Commit 1717bfa

Browse files
committed
Add new parameters for Perplexity API endpoint
1 parent 2af7a74 commit 1717bfa

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

background/background.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,19 @@
22
* @param {string} apiKey
33
* @param {string} model
44
* @param {number} temperature
5+
* @param {number} topk
6+
* @param {number} topp
7+
* @param {number} frequencyPenalty
8+
* @param {number} presencePenalty
9+
* @param {number} maxTokens
510
* @param {string} content
611
* @param {string} language
712
* @returns {Promise<any>}
813
* Call the Perplexity API with the provided parameters.
914
* Return a promise that resolves with the API response.
1015
*/
1116
function callPerplexityAPI(apiKey, model, temperature, topk, topp, frequencyPenalty, presencePenalty, maxTokens, content, language) {
17+
const API_ENDPOINT = 'https://api.perplexity.ai/chat/completions';
1218
const systemPrompt = `You are an AI assistant that generates concise, high-quality abstracts and keywords for webpage content.
1319
1420
Instructions:
@@ -54,7 +60,7 @@ if (maxTokens !== null) body.max_tokens = maxTokens;
5460
options.body = JSON.stringify(body);
5561

5662

57-
return fetch('https://api.perplexity.ai/chat/completions', options)
63+
return fetch(API_ENDPOINT, options)
5864
.then(response => response.json())
5965
.catch(err => console.error(err));
6066
}

0 commit comments

Comments
 (0)