diff --git a/conf/default.php b/conf/default.php index 088241f..8b01691 100644 --- a/conf/default.php +++ b/conf/default.php @@ -11,6 +11,8 @@ $conf['embedmodel'] = 'OpenAI text-embedding-ada-002'; $conf['storage'] = 'SQLite'; +$conf['customprompt'] = ''; + $conf['openai_apikey'] = ''; $conf['openai_org'] = ''; diff --git a/conf/metadata.php b/conf/metadata.php index aca0019..87089e8 100644 --- a/conf/metadata.php +++ b/conf/metadata.php @@ -18,6 +18,8 @@ ) ); +$meta['customprompt'] = array(); + $meta['openai_apikey'] = array('password'); $meta['openai_org'] = array('string'); diff --git a/helper.php b/helper.php index 19fbc1f..ca0c981 100644 --- a/helper.php +++ b/helper.php @@ -202,6 +202,7 @@ public function askQuestion($question, $history = [], $contextQuestion = '') $prompt = $this->getPrompt('question', [ 'context' => $context, 'question' => $question, + 'customprompt' => $this->getConf('customprompt'), ]); } else { $prompt = $this->getPrompt('noanswer', [ diff --git a/lang/en/question.prompt b/lang/en/question.prompt index cbbc317..85d9849 100644 --- a/lang/en/question.prompt +++ b/lang/en/question.prompt @@ -1,4 +1,4 @@ -Your Task: Use the following documents as context to answer the users question. If you don't know the answer, just say that you don't know, don't try to make up an answer. {{LANGUAGE}} +Your Task: Use the following documents as context to answer the users question. If you don't know the answer, just say that you don't know, don't try to make up an answer. {{LANGUAGE}} {{CUSTOMPROMPT}} ---------------- {{CONTEXT}} diff --git a/lang/en/settings.php b/lang/en/settings.php index 1120f3f..f5e3be1 100644 --- a/lang/en/settings.php +++ b/lang/en/settings.php @@ -10,7 +10,7 @@ $lang['rephrasemodel'] = 'The 🧠 model to use for rephrasing questions. Configure required credentials below.'; $lang['embedmodel'] = 'The 🧠 model to use for text embedding. Configure required credentials below.
🔄 You need to rebuild the vector storage when changing this setting.'; $lang['storage'] = 'Which 📥 vector storage to use. Configure required credentials below.
🔄 You need to rebuild the vector storage when changing this setting.'; - +$lang['customprompt'] = 'A custom prompt that is added to the prompt used by this plugin when querying the AI model. For consistency, it should be in English.'; $lang['openai_apikey'] = '🧠 OpenAI API key'; $lang['openai_org'] = '🧠 OpenAI Organization ID (if any)';