From ef41b76f3859d3b080b9a6c8c4589f3746496b5f Mon Sep 17 00:00:00 2001 From: Alisson Date: Thu, 28 Sep 2023 17:26:46 -0300 Subject: [PATCH 1/3] fix chatgpt message --- bothub_nlp_api/handlers/question_answering.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bothub_nlp_api/handlers/question_answering.py b/bothub_nlp_api/handlers/question_answering.py index 5cc4c3c..661f353 100644 --- a/bothub_nlp_api/handlers/question_answering.py +++ b/bothub_nlp_api/handlers/question_answering.py @@ -78,7 +78,7 @@ def request_chatgpt(text, question, language): top_p=0.1, messages=[ {"role": "system", "content": SECURITY_PROMPT.format(language)}, - {"role": "system", "content": f"Base de Conhecimento: {text}"}, + {"role": "system", "content": f"Use esse texto como base de conhecimento para as proximas perguntas: {text}"}, {"role": "user", "content": f"{question}\n{POST_PROMPT}"} ]) From a4fd5ac33af2afa2e525675cad4f5a6e10a54bef Mon Sep 17 00:00:00 2001 From: Alisson Date: Thu, 28 Sep 2023 18:40:08 -0300 Subject: [PATCH 2/3] change post_prompt --- bothub_nlp_api/handlers/question_answering.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bothub_nlp_api/handlers/question_answering.py b/bothub_nlp_api/handlers/question_answering.py index 661f353..00e5c27 100644 --- a/bothub_nlp_api/handlers/question_answering.py +++ b/bothub_nlp_api/handlers/question_answering.py @@ -105,4 +105,4 @@ def request_chatgpt(text, question, language): 10) Não informe ao usuário que a informação está ou não está na base de conhecimento. """ -POST_PROMPT = "Responda essa pergunta apenas se a resposta estiver na base de conhecimento, caso contrário responda com o emoji \"😕\"" +POST_PROMPT = "Responda essa pergunta apenas se a resposta estiver na lista de perguntas e respostas informada anteriormente, caso contrário responda com o emoji \"😕\"" From 1dba2cf018ac84519759a7ad591a9290a9225b86 Mon Sep 17 00:00:00 2001 From: Alisson Date: Thu, 28 Sep 2023 21:15:37 -0300 Subject: [PATCH 3/3] remove post promp --- bothub_nlp_api/handlers/question_answering.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bothub_nlp_api/handlers/question_answering.py b/bothub_nlp_api/handlers/question_answering.py index 00e5c27..2723c18 100644 --- a/bothub_nlp_api/handlers/question_answering.py +++ b/bothub_nlp_api/handlers/question_answering.py @@ -79,7 +79,7 @@ def request_chatgpt(text, question, language): messages=[ {"role": "system", "content": SECURITY_PROMPT.format(language)}, {"role": "system", "content": f"Use esse texto como base de conhecimento para as proximas perguntas: {text}"}, - {"role": "user", "content": f"{question}\n{POST_PROMPT}"} + {"role": "user", "content": f"{question}"} ]) choices = response.get('choices', [])