Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -27,9 +27,10 @@ class BasicAgent:
|
|
27 |
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'
|
28 |
})
|
29 |
self.cache = {}
|
|
|
30 |
def __call__(self, question: str) -> str:
|
31 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
32 |
-
fixed_answer = agent.
|
33 |
print(f"Agent returning fixed answer: {fixed_answer}")
|
34 |
return fixed_answer
|
35 |
|
@@ -240,25 +241,6 @@ class BasicAgent:
|
|
240 |
|
241 |
return min(0.99, max(0.1, confidence))
|
242 |
|
243 |
-
# Example usage
|
244 |
-
if __name__ == "__main__":
|
245 |
-
agent = BasicAgent()
|
246 |
-
|
247 |
-
questions = [
|
248 |
-
"How many studio albums did Taylor Swift release between 2010 and 2015?",
|
249 |
-
"When was the first iPhone released?",
|
250 |
-
"What is the capital of Canada?",
|
251 |
-
"List the planets in our solar system"
|
252 |
-
]
|
253 |
-
|
254 |
-
for question in questions:
|
255 |
-
result = agent.answer_question(question)
|
256 |
-
print(f"\nAnswer: {result['answer']}")
|
257 |
-
#print(f"Source: {result['source']}")
|
258 |
-
#print(f"Confidence: {result['confidence']}")
|
259 |
-
#print("="*50)
|
260 |
-
|
261 |
-
|
262 |
|
263 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
264 |
"""
|
|
|
27 |
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'
|
28 |
})
|
29 |
self.cache = {}
|
30 |
+
|
31 |
def __call__(self, question: str) -> str:
|
32 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
33 |
+
fixed_answer = self.agent.generate({question})
|
34 |
print(f"Agent returning fixed answer: {fixed_answer}")
|
35 |
return fixed_answer
|
36 |
|
|
|
241 |
|
242 |
return min(0.99, max(0.1, confidence))
|
243 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
244 |
|
245 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
246 |
"""
|