mirror of
https://github.com/StanGirard/quivr.git
synced 2024-12-04 05:07:48 +03:00
feat: Update system templates with custom personality support (#2209)
This pull request updates the system templates to include support for custom personality. It adds a new parameter called "custom_personality" to the generate_stream function, which allows users to provide a custom personality for the AI assistant. This feature enhances the user experience by allowing them to personalize the assistant's responses.
This commit is contained in:
parent
57ec5a634b
commit
2ae8ec1739
@ -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:
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user