Update app.py
Browse files
app.py
CHANGED
@@ -44,7 +44,7 @@ def chat_with_assistant(message, history):
|
|
44 |
context = "\n".join(relevant_chunks)
|
45 |
|
46 |
# Prepare the system message
|
47 |
-
|
48 |
You provide short, clear answers in simple language.
|
49 |
Use the following as context for all of your answers:
|
50 |
{context}
|
@@ -52,12 +52,12 @@ def chat_with_assistant(message, history):
|
|
52 |
|
53 |
# Customize instructions as needed
|
54 |
instructions = """
|
55 |
-
|
56 |
"""
|
57 |
-
system_message
|
58 |
|
59 |
# Prepare the message array
|
60 |
-
messages = [
|
61 |
|
62 |
# Add conversation history
|
63 |
for human_msg, ai_msg in history:
|
@@ -73,8 +73,9 @@ def chat_with_assistant(message, history):
|
|
73 |
# Make the API call
|
74 |
response = client.messages.create(
|
75 |
model="claude-3-sonnet-20240307",
|
76 |
-
|
77 |
max_tokens=500,
|
|
|
78 |
messages=messages
|
79 |
)
|
80 |
|
|
|
44 |
context = "\n".join(relevant_chunks)
|
45 |
|
46 |
# Prepare the system message
|
47 |
+
system_message = f"""You are an AI assistant answering questions based on a reference document.
|
48 |
You provide short, clear answers in simple language.
|
49 |
Use the following as context for all of your answers:
|
50 |
{context}
|
|
|
52 |
|
53 |
# Customize instructions as needed
|
54 |
instructions = """
|
55 |
+
You provide useful examples and similes.
|
56 |
"""
|
57 |
+
system_message += instructions
|
58 |
|
59 |
# Prepare the message array
|
60 |
+
messages = []
|
61 |
|
62 |
# Add conversation history
|
63 |
for human_msg, ai_msg in history:
|
|
|
73 |
# Make the API call
|
74 |
response = client.messages.create(
|
75 |
model="claude-3-sonnet-20240307",
|
76 |
+
#model="claude-3-haiku-20240307",
|
77 |
max_tokens=500,
|
78 |
+
system=system_message,
|
79 |
messages=messages
|
80 |
)
|
81 |
|