dmfelder commited on
Commit
b9bb939
·
verified ·
1 Parent(s): fcfd317

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -16
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 more factual, direct prompt
171
- if "mercedes" in question.lower() and "studio album" in question.lower():
172
- simple_prompt = f"Mercedes Sosa released how many studio albums between 2000-2009? Answer:"
173
- elif "teal'c" in question.lower() and "hot" in question.lower():
174
- simple_prompt = f"In Stargate, Teal'c responds to 'Isn't that hot?' by saying:"
175
- elif "vikings" in question.lower() and "where" in question.lower():
176
- simple_prompt = f"Where do the Minnesota Vikings play? Answer:"
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"Q: {question[:150]} A: Location:"
 
 
 
 
 
 
185
  else:
186
- simple_prompt = f"Fact: {question[:150]} Answer:"
187
 
188
- logging.info(f"Factual prompt: {simple_prompt[:100]}...")
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,