Update app.py
Browse files
app.py
CHANGED
|
@@ -629,14 +629,19 @@ def rephrase_for_search(query, model):
|
|
| 629 |
template="""
|
| 630 |
Rephrase the following conversational query into a concise, search-engine-friendly format.
|
| 631 |
Remove any conversational elements and focus on the core information need.
|
|
|
|
| 632 |
|
| 633 |
Conversational query: {query}
|
| 634 |
|
| 635 |
-
|
| 636 |
)
|
| 637 |
|
| 638 |
chain = LLMChain(llm=model, prompt=rephrase_prompt)
|
| 639 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 640 |
return rephrased_query
|
| 641 |
|
| 642 |
def ask_question(question, temperature, top_p, repetition_penalty, web_search, google_news_rss):
|
|
|
|
| 629 |
template="""
|
| 630 |
Rephrase the following conversational query into a concise, search-engine-friendly format.
|
| 631 |
Remove any conversational elements and focus on the core information need.
|
| 632 |
+
Provide only the rephrased query without any explanation.
|
| 633 |
|
| 634 |
Conversational query: {query}
|
| 635 |
|
| 636 |
+
Rephrased query:"""
|
| 637 |
)
|
| 638 |
|
| 639 |
chain = LLMChain(llm=model, prompt=rephrase_prompt)
|
| 640 |
+
response = chain.run(query=query).strip()
|
| 641 |
+
|
| 642 |
+
# Extract only the rephrased query, ignoring any explanations
|
| 643 |
+
rephrased_query = response.split('\n')[0].strip()
|
| 644 |
+
|
| 645 |
return rephrased_query
|
| 646 |
|
| 647 |
def ask_question(question, temperature, top_p, repetition_penalty, web_search, google_news_rss):
|