tatianija commited on
Commit
d79684d
·
verified ·
1 Parent(s): 4ee08d3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -26
app.py CHANGED
@@ -634,21 +634,15 @@ Answer with just "YES" if web search would be helpful, or "NO" if the available
634
  search_results = self.search.call(question)
635
 
636
  # Combine all contexts
637
- full_context = f"""
638
- Question: {question}
639
-
640
- Search Results: {search_results}
641
-
642
- {attachment_context}
643
-
644
- {url_context}
645
- """
646
 
647
- answer_prompt = f"""Based on the search results and additional context provided, answer this question comprehensively and accurately:
648
-
649
- {full_context}
650
-
651
- Provide a clear, well-structured answer:"""
 
 
652
 
653
  return self._chat_completion(answer_prompt, max_tokens=800, temperature=0.3)
654
 
@@ -662,19 +656,15 @@ Provide a clear, well-structured answer:"""
662
  Answer the question using only the LLM and available context.
663
  """
664
  try:
665
- full_context = f"""
666
- Question: {question}
667
-
668
- {attachment_context}
669
-
670
- {url_context}
671
- """
672
 
673
- answer_prompt = f"""Answer this question based on your knowledge and the provided context:
674
-
675
- {full_context}
676
-
677
- Provide a clear, comprehensive answer:"""
 
 
678
 
679
  return self._chat_completion(answer_prompt, max_tokens=800, temperature=0.3)
680
 
 
634
  search_results = self.search.call(question)
635
 
636
  # Combine all contexts
637
+ full_context = f"""Question: {question} Search Results: {search_results} {attachment_context}{url_context}"""
 
 
 
 
 
 
 
 
638
 
639
+ answer_prompt = f"""\no_think You are a general AI assistant. I will ask you a question.
640
+ Based on the context sections below, provide an answer to the question.
641
+ If the search results don't fully answer the question, you can supplement with your general knowledge.
642
+ Your ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings.
643
+ If you are asked for a number, don't use comma to write your number neither use units such as $ or percent sign unless specified otherwise.
644
+ If you are asked for a string, don't use articles, neither abbreviations (e.g. for cities), and write the digits in plain text unless specified otherwise.
645
+ {full_context} """
646
 
647
  return self._chat_completion(answer_prompt, max_tokens=800, temperature=0.3)
648
 
 
656
  Answer the question using only the LLM and available context.
657
  """
658
  try:
659
+ full_context = f"""Question: {question} {attachment_context} {url_context}"""
 
 
 
 
 
 
660
 
661
+ answer_prompt = f"""\no_think You are a general AI assistant. I will ask you a question.
662
+ Based on the context sections below, provide an answer to the question.
663
+ If the search results don't fully answer the question, you can supplement with your general knowledge.
664
+ Your ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings.
665
+ If you are asked for a number, don't use comma to write your number neither use units such as $ or percent sign unless specified otherwise.
666
+ If you are asked for a string, don't use articles, neither abbreviations (e.g. for cities), and write the digits in plain text unless specified otherwise.
667
+ {full_context} """
668
 
669
  return self._chat_completion(answer_prompt, max_tokens=800, temperature=0.3)
670