Spaces:
Sleeping
Sleeping
jeremierostan
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -54,10 +54,14 @@ def chat_with_assistant(message, history):
|
|
54 |
context = "\n".join(relevant_chunks)
|
55 |
|
56 |
# Prepare the system message
|
57 |
-
system_message = f"""
|
58 |
-
|
59 |
-
|
|
|
|
|
60 |
|
|
|
|
|
61 |
Your assigned historical figure is stated in your instructions:
|
62 |
{instructions}
|
63 |
|
@@ -65,13 +69,14 @@ def chat_with_assistant(message, history):
|
|
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.
|
67 |
|
68 |
-
|
69 |
-
|
70 |
-
Always use appropriate language.
|
71 |
-
Refuse to answer inappropriate questions or questions unrelated to your role and historical figure.
|
72 |
-
Keep your responses concise and to the point. Avoid repetitions and always end on a period.
|
73 |
|
74 |
-
|
|
|
|
|
75 |
"""
|
76 |
|
77 |
# Prepare the message array
|
@@ -91,7 +96,7 @@ def chat_with_assistant(message, history):
|
|
91 |
# Make the API call
|
92 |
response = client.messages.create(
|
93 |
model="claude-3-5-sonnet-20240620",
|
94 |
-
max_tokens=
|
95 |
system=system_message,
|
96 |
messages=messages
|
97 |
)
|
|
|
54 |
context = "\n".join(relevant_chunks)
|
55 |
|
56 |
# Prepare the system message
|
57 |
+
system_message = f"""
|
58 |
+
#Role
|
59 |
+
-You are an impersonator and an educator.
|
60 |
+
-Your role is to adopt the personality, style, psychology, ideas, background, and circumstances of a historical figure.
|
61 |
+
-Your goal is to help students understand the historical figure better through and engaging conversation.
|
62 |
|
63 |
+
|
64 |
+
#Information
|
65 |
Your assigned historical figure is stated in your instructions:
|
66 |
{instructions}
|
67 |
|
|
|
69 |
{context}
|
70 |
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 |
|
72 |
+
#Important
|
73 |
+
-Always speak in the first person ("I") as the historical figure you are to incarnate.
|
74 |
+
-Always use appropriate language.
|
75 |
+
-Refuse to answer inappropriate questions or questions unrelated to your role and historical figure.
|
|
|
76 |
|
77 |
+
#Critical
|
78 |
+
-Important: Your knowledge of the world ends at the time of the death of your historical figure.
|
79 |
+
-Keep your responses concise and to the point. Avoid repetitions and always end on a period "." token
|
80 |
"""
|
81 |
|
82 |
# Prepare the message array
|
|
|
96 |
# Make the API call
|
97 |
response = client.messages.create(
|
98 |
model="claude-3-5-sonnet-20240620",
|
99 |
+
max_tokens=300,
|
100 |
system=system_message,
|
101 |
messages=messages
|
102 |
)
|