diff --git a/backend/modules/brain/integrations/Big/Brain.py b/backend/modules/brain/integrations/Big/Brain.py index ab7cd9858..bf210a45c 100644 --- a/backend/modules/brain/integrations/Big/Brain.py +++ b/backend/modules/brain/integrations/Big/Brain.py @@ -36,7 +36,8 @@ class BigBrain(KnowledgeBrainQA): def get_chain(self): system_template = """Combine these summaries in a way that makes sense and answer the user's question. - Use markdown or any other techniques to display the content in a nice and aerated way. + Use markdown or any other techniques to display the content in a nice and aerated way. + Here are user instructions on how to respond: {custom_personality} ______________________ {summaries}""" messages = [ @@ -88,6 +89,9 @@ class BigBrain(KnowledgeBrainQA): { "question": question.question, "chat_history": transformed_history, + "custom_personality": ( + self.prompt_to_use.content if self.prompt_to_use else None + ), } ): if "answer" in chunk: diff --git a/backend/modules/brain/integrations/GPT4/Brain.py b/backend/modules/brain/integrations/GPT4/Brain.py index 03db2cd1d..505b4d4f9 100644 --- a/backend/modules/brain/integrations/GPT4/Brain.py +++ b/backend/modules/brain/integrations/GPT4/Brain.py @@ -28,7 +28,10 @@ class GPT4Brain(KnowledgeBrainQA): prompt = ChatPromptTemplate.from_messages( [ - ("system", "You are GPT-4 powered by Quivr. You are an assistant."), + ( + "system", + "You are GPT-4 powered by Quivr. You are an assistant. {custom_personality}", + ), MessagesPlaceholder(variable_name="chat_history"), ("human", "{question}"), ] @@ -53,6 +56,9 @@ class GPT4Brain(KnowledgeBrainQA): { "question": question.question, "chat_history": transformed_history, + "custom_personality": ( + self.prompt_to_use.content if self.prompt_to_use else None + ), } ): response_tokens.append(chunk.content)