QuickLearnerAI commited on
Commit
7ae77ed
·
verified ·
1 Parent(s): 7268d90

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -65,15 +65,19 @@ PDF CONTENT:
65
  {pdf_context}
66
  Answer the user's questions only based on the PDF content above. If the answer cannot be found in the PDF, politely state that the information is not available in the provided document."""
67
 
68
- messages= [
 
69
  {"role": "system", "content": system_message},
70
  ]
 
 
71
  for h_user, h_bot in history:
72
  messages.append({"role": "user", "content": h_user})
73
  messages.append({"role": "assistant", "content": h_bot})
 
 
 
74
 
75
- #add the current user question into history
76
- messages.append(["role": "user", "content": user_question])
77
 
78
  #connect the model with the app
79
  reponse = client.chat.completions.create(
 
65
  {pdf_context}
66
  Answer the user's questions only based on the PDF content above. If the answer cannot be found in the PDF, politely state that the information is not available in the provided document."""
67
 
68
+ # Prepare message history for Together API
69
+ messages = [
70
  {"role": "system", "content": system_message},
71
  ]
72
+
73
+ # Add chat history
74
  for h_user, h_bot in history:
75
  messages.append({"role": "user", "content": h_user})
76
  messages.append({"role": "assistant", "content": h_bot})
77
+
78
+ # Add the current user question
79
+ messages.append({"role": "user", "content": user_question})
80
 
 
 
81
 
82
  #connect the model with the app
83
  reponse = client.chat.completions.create(