jeremierostan commited on
Commit
2d2bfa2
·
verified ·
1 Parent(s): 9f4d092

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
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
- ai_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,12 +52,12 @@ def chat_with_assistant(message, history):
52
 
53
  # Customize instructions as needed
54
  instructions = """
55
-
56
  """
57
- system_message = f"{ai_message} {instructions}"
58
 
59
  # Prepare the message array
60
- messages = [{"role": "system", "content": system_message}]
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
- # model ="claude-3-haiku-20240307",
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