Pijush2023 commited on
Commit
703dbcb
·
verified ·
1 Parent(s): bd6232a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -11
app.py CHANGED
@@ -251,23 +251,40 @@ local_events_details = fetch_local_events()
251
  # Question: {question}
252
  # Helpful Answer:"""
253
 
254
- template1 = """You are an expert concierge who is helpful and a renowned guide for Omaha, Nebraska. Based on the following details:
255
- Weather: """ + weather_details + """,
256
- Date and Time: """ + current_time_and_date + """,
257
- Local Events: """ + local_events_details + """,
 
258
  use the following pieces of context, memory, and message history, along with your knowledge of perennial events in Omaha, Nebraska, to answer the question at the end. If you don't know the answer, just say "Homie, I need to get more data for this," and don't try to make up an answer. Use fifteen sentences maximum. Keep the answer as detailed as possible. Always include the address, time, date, and event type and description. Always say "It was my pleasure!" at the end of the answer.
259
  {{context}}
260
  Question: {{question}}
261
- Helpful Answer:"""
262
-
263
- template2 = """You are an expert concierge who is helpful and a renowned guide for Omaha, Nebraska. Based on the following details:
264
- Weather: """ + weather_details + """,
265
- Date and Time: """ + current_time_and_date + """,
266
- Local Events: """ + local_events_details + """,
 
 
267
  take the location or address but don't show the location or address on the output prompts. Use the following pieces of context, memory, and message history, along with your knowledge of perennial events in Omaha, Nebraska, to answer the question at the end. If you don't know the answer, just say "Homie, I need to get more data for this," and don't try to make up an answer. Keep the answer short and sweet and crisp. Always say "It was my pleasure!" at the end of the answer.
268
  {{context}}
269
  Question: {{question}}
270
- Helpful Answer:"""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
271
 
272
  QA_CHAIN_PROMPT_1 = PromptTemplate(input_variables=["context", "question"], template=template1)
273
  QA_CHAIN_PROMPT_2 = PromptTemplate(input_variables=["context", "question"], template=template2)
 
251
  # Question: {question}
252
  # Helpful Answer:"""
253
 
254
+ template1 = """
255
+ You are an expert concierge who is helpful and a renowned guide for Omaha, Nebraska. Based on the following details:
256
+ Weather: {weather_details},
257
+ Date and Time: {current_time_and_date},
258
+ Local Events: {local_events_details},
259
  use the following pieces of context, memory, and message history, along with your knowledge of perennial events in Omaha, Nebraska, to answer the question at the end. If you don't know the answer, just say "Homie, I need to get more data for this," and don't try to make up an answer. Use fifteen sentences maximum. Keep the answer as detailed as possible. Always include the address, time, date, and event type and description. Always say "It was my pleasure!" at the end of the answer.
260
  {{context}}
261
  Question: {{question}}
262
+ Helpful Answer:
263
+ """
264
+
265
+ template2 = """
266
+ You are an expert concierge who is helpful and a renowned guide for Omaha, Nebraska. Based on the following details:
267
+ Weather: {weather_details},
268
+ Date and Time: {current_time_and_date},
269
+ Local Events: {local_events_details},
270
  take the location or address but don't show the location or address on the output prompts. Use the following pieces of context, memory, and message history, along with your knowledge of perennial events in Omaha, Nebraska, to answer the question at the end. If you don't know the answer, just say "Homie, I need to get more data for this," and don't try to make up an answer. Keep the answer short and sweet and crisp. Always say "It was my pleasure!" at the end of the answer.
271
  {{context}}
272
  Question: {{question}}
273
+ Helpful Answer:
274
+ """
275
+
276
+ # Format the templates with the appropriate details
277
+ formatted_template1 = template1.format(
278
+ weather_details=weather_details,
279
+ current_time_and_date=current_time_and_date,
280
+ local_events_details=local_events_details
281
+ )
282
+
283
+ formatted_template2 = template2.format(
284
+ weather_details=weather_details,
285
+ current_time_and_date=current_time_and_date,
286
+ local_events_details=local_events_details
287
+ )
288
 
289
  QA_CHAIN_PROMPT_1 = PromptTemplate(input_variables=["context", "question"], template=template1)
290
  QA_CHAIN_PROMPT_2 = PromptTemplate(input_variables=["context", "question"], template=template2)