Update app.py
Browse files
app.py
CHANGED
|
@@ -167,25 +167,25 @@ class SimpleAgent:
|
|
| 167 |
# Use the transformers pipeline with optimized parameters
|
| 168 |
logging.info("Using pipeline approach...")
|
| 169 |
|
| 170 |
-
# Create a
|
| 171 |
-
if "
|
| 172 |
-
simple_prompt = f"
|
| 173 |
-
elif "
|
| 174 |
-
simple_prompt = f"
|
| 175 |
-
elif "
|
| 176 |
-
simple_prompt = f"
|
| 177 |
-
elif "chess" in question.lower() and "black" in question.lower():
|
| 178 |
-
simple_prompt = f"Chess: Black's winning move in algebraic notation:"
|
| 179 |
-
elif "how many" in question.lower():
|
| 180 |
-
simple_prompt = f"Q: {question[:150]} A: The number is"
|
| 181 |
-
elif "what is" in question.lower() or "who" in question.lower():
|
| 182 |
-
simple_prompt = f"Q: {question[:150]} A:"
|
| 183 |
elif "where" in question.lower():
|
| 184 |
-
simple_prompt = f"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 185 |
else:
|
| 186 |
-
simple_prompt = f"
|
| 187 |
|
| 188 |
-
logging.info(f"
|
| 189 |
|
| 190 |
outputs = self.text_generator(
|
| 191 |
simple_prompt,
|
|
|
|
| 167 |
# Use the transformers pipeline with optimized parameters
|
| 168 |
logging.info("Using pipeline approach...")
|
| 169 |
|
| 170 |
+
# Create a general prompt that encourages direct, factual answers for any question
|
| 171 |
+
if "how many" in question.lower():
|
| 172 |
+
simple_prompt = f"{question} Answer with a number only:"
|
| 173 |
+
elif "what is" in question.lower() or "what are" in question.lower():
|
| 174 |
+
simple_prompt = f"{question} Answer briefly and factually:"
|
| 175 |
+
elif "who" in question.lower():
|
| 176 |
+
simple_prompt = f"{question} Answer with the name only:"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 177 |
elif "where" in question.lower():
|
| 178 |
+
simple_prompt = f"{question} Answer with the location only:"
|
| 179 |
+
elif "when" in question.lower():
|
| 180 |
+
simple_prompt = f"{question} Answer with the date/time only:"
|
| 181 |
+
elif "which" in question.lower():
|
| 182 |
+
simple_prompt = f"{question} Answer with the specific item only:"
|
| 183 |
+
elif question.strip().endswith("?"):
|
| 184 |
+
simple_prompt = f"{question} Give a direct, factual answer:"
|
| 185 |
else:
|
| 186 |
+
simple_prompt = f"{question} Provide a brief, factual response:"
|
| 187 |
|
| 188 |
+
logging.info(f"General prompt pattern: {simple_prompt[:100]}...")
|
| 189 |
|
| 190 |
outputs = self.text_generator(
|
| 191 |
simple_prompt,
|