CCockrum commited on
Commit
9cb1276
·
verified ·
1 Parent(s): 5b0e575

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -21
app.py CHANGED
@@ -82,27 +82,6 @@ def ensure_english(text):
82
 
83
  return "⚠️ Sorry, I only respond in English. Can you rephrase your question?"
84
 
85
- # ✅ Follow-Up Question Generation (Ensures Proper Formatting)
86
- def generate_follow_up(user_text):
87
- """Generates a structured follow-up question in a concise format."""
88
-
89
- prompt_text = (
90
- f"Given the user's question: '{user_text}', generate a SHORT follow-up question in the format: "
91
- "'Would you like to learn more about [related topic] or explore something else?'. "
92
- "Ensure it's concise and structured exactly as requested without extra commentary."
93
- )
94
-
95
- hf = get_llm_hf_inference(max_new_tokens=30, temperature=0.3)
96
- output = hf.invoke(input=prompt_text).strip()
97
-
98
- # ✅ Extract relevant part, removing unwanted symbols
99
- cleaned_output = re.sub(r"```|''|\"", "", output).strip()
100
-
101
- if "Would you like to learn more about" not in cleaned_output:
102
- cleaned_output = "Would you like to explore another related topic or ask about something else?"
103
-
104
- return cleaned_output
105
-
106
  # ✅ Main Response Function (Fixed History & Language Issues)
107
  def get_response(system_message, user_text, max_new_tokens=800):
108
  """Generates a response and ensures conversation history is updated."""
 
82
 
83
  return "⚠️ Sorry, I only respond in English. Can you rephrase your question?"
84
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
  # ✅ Main Response Function (Fixed History & Language Issues)
86
  def get_response(system_message, user_text, max_new_tokens=800):
87
  """Generates a response and ensures conversation history is updated."""