Update app.py
Browse files
app.py
CHANGED
@@ -47,6 +47,7 @@ reference_documents = ["Louis XIV.pdf"]
|
|
47 |
text_chunks = process_pdfs(reference_documents)
|
48 |
|
49 |
instructions = os.getenv('INSTRUCTIONS')
|
|
|
50 |
def chat_with_assistant(message, history):
|
51 |
# Find relevant chunks based on the user message
|
52 |
relevant_chunks = get_relevant_chunks(message, text_chunks)
|
@@ -56,6 +57,10 @@ def chat_with_assistant(message, history):
|
|
56 |
system_message = f"""You are an impersonator and an educator.
|
57 |
Your role is to adopt the personality, style, psychology, ideas, background, and circumstances of a historical figure.
|
58 |
Your goal is to help students understand the historical figure better through and engaging conversation.
|
|
|
|
|
|
|
|
|
59 |
Use the following as context for your answers.
|
60 |
{context}
|
61 |
However, use it seamlessly as background knowledge for a lively discussion and combine it with your own information. Do not provide citations or adopt a Q&A or academic tone.
|
@@ -66,10 +71,6 @@ def chat_with_assistant(message, history):
|
|
66 |
Important: Your knowledge of the world ends at the time of the death of your historical figure.
|
67 |
"""
|
68 |
|
69 |
-
# Customize instructions as needed
|
70 |
-
instructions = instructions
|
71 |
-
system_message += instructions
|
72 |
-
|
73 |
# Prepare the message array
|
74 |
messages = []
|
75 |
|
|
|
47 |
text_chunks = process_pdfs(reference_documents)
|
48 |
|
49 |
instructions = os.getenv('INSTRUCTIONS')
|
50 |
+
|
51 |
def chat_with_assistant(message, history):
|
52 |
# Find relevant chunks based on the user message
|
53 |
relevant_chunks = get_relevant_chunks(message, text_chunks)
|
|
|
57 |
system_message = f"""You are an impersonator and an educator.
|
58 |
Your role is to adopt the personality, style, psychology, ideas, background, and circumstances of a historical figure.
|
59 |
Your goal is to help students understand the historical figure better through and engaging conversation.
|
60 |
+
|
61 |
+
Your assigned historical figure is stated in your instructions:
|
62 |
+
{instructions}
|
63 |
+
|
64 |
Use the following as context for your answers.
|
65 |
{context}
|
66 |
However, use it seamlessly as background knowledge for a lively discussion and combine it with your own information. Do not provide citations or adopt a Q&A or academic tone.
|
|
|
71 |
Important: Your knowledge of the world ends at the time of the death of your historical figure.
|
72 |
"""
|
73 |
|
|
|
|
|
|
|
|
|
74 |
# Prepare the message array
|
75 |
messages = []
|
76 |
|