Pijush2023 commited on
Commit
72a50e9
·
verified ·
1 Parent(s): 907cfdb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -29
app.py CHANGED
@@ -236,20 +236,20 @@ local_events_details = fetch_local_events()
236
 
237
 
238
  # Define prompt templates
239
- # template1 = """You are an expert concierge who is helpful and a renowned guide for Omaha, Nebraska. Based on today's weather being a sunny bright day and the date is 18th June 2024, use the following pieces of context,
240
- # 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.
241
- # Use fifteen sentences maximum. Keep the answer as detailed as possible. Always include the address, time, date, and
242
- # event type and description. Always say "It was my pleasure!" at the end of the answer.
243
- # {context}
244
- # Question: {question}
245
- # Helpful Answer:"""
246
-
247
- # template2 = """You are an expert concierge who is helpful and a renowned guide for Omaha, Nebraska. Based on today's weather being a sunny bright day and the date is 18th June 2024, take the location or address but don't show the location or address on the output prompts. Use the following pieces of context,
248
- # 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.
249
- # Keep the answer short and sweet and crisp. Always say "It was my pleasure!" at the end of the answer.
250
- # {context}
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:
@@ -273,24 +273,24 @@ 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)
291
 
292
- QA_CHAIN_PROMPT_1 = PromptTemplate(input_variables=["context", "question", "weather_details", "current_time_and_date", "local_events_details"], template=template1)
293
- QA_CHAIN_PROMPT_2 = PromptTemplate(input_variables=["context", "question", "weather_details", "current_time_and_date", "local_events_details"], template=template2)
294
 
295
  # Define the retrieval QA chain
296
  def build_qa_chain(prompt_template):
 
236
 
237
 
238
  # Define prompt templates
239
+ template1 = """You are an expert concierge who is helpful and a renowned guide for Omaha, Nebraska. Based on today's weather being a sunny bright day and the date is 18th June 2024, use the following pieces of context,
240
+ 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.
241
+ Use fifteen sentences maximum. Keep the answer as detailed as possible. Always include the address, time, date, and
242
+ event type and description. Always say "It was my pleasure!" at the end of the answer.
243
+ {context}
244
+ Question: {question}
245
+ Helpful Answer:"""
246
+
247
+ template2 = """You are an expert concierge who is helpful and a renowned guide for Omaha, Nebraska. Based on today's weather being a sunny bright day and the date is 18th June 2024, take the location or address but don't show the location or address on the output prompts. Use the following pieces of context,
248
+ 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.
249
+ Keep the answer short and sweet and crisp. Always say "It was my pleasure!" at the end of the answer.
250
+ {context}
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:
 
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)
291
 
292
+ # QA_CHAIN_PROMPT_1 = PromptTemplate(input_variables=["context", "question", "weather_details", "current_time_and_date", "local_events_details"], template=template1)
293
+ # QA_CHAIN_PROMPT_2 = PromptTemplate(input_variables=["context", "question", "weather_details", "current_time_and_date", "local_events_details"], template=template2)
294
 
295
  # Define the retrieval QA chain
296
  def build_qa_chain(prompt_template):