Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -19,16 +19,21 @@ class BasicAgent:
|
|
| 19 |
def __init__(self, model=None, tools=None):
|
| 20 |
self.model = model
|
| 21 |
self.tools = tools if tools is not None else []
|
| 22 |
-
self.
|
| 23 |
print("BasicAgent initialized.")
|
| 24 |
|
| 25 |
def __call__(self, question: str) -> str:
|
| 26 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 27 |
# Implement your agent logic here using self.model and self.tools
|
| 28 |
-
final_answer = self.
|
| 29 |
-
print(f"Agent returning
|
| 30 |
return final_answer
|
| 31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
| 33 |
"""
|
| 34 |
Fetches all questions, runs the BasicAgent on them, submits all answers,
|
|
|
|
| 19 |
def __init__(self, model=None, tools=None):
|
| 20 |
self.model = model
|
| 21 |
self.tools = tools if tools is not None else []
|
| 22 |
+
self.history = []
|
| 23 |
print("BasicAgent initialized.")
|
| 24 |
|
| 25 |
def __call__(self, question: str) -> str:
|
| 26 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 27 |
# Implement your agent logic here using self.model and self.tools
|
| 28 |
+
final_answer = self.process_question(question)
|
| 29 |
+
print(f"Agent returning answer: {final_answer[:50]}...")
|
| 30 |
return final_answer
|
| 31 |
|
| 32 |
+
def _process_question (self, question:str) -> str:
|
| 33 |
+
search_results = search_tool(question) if self.tools and search_tool in self.tools else "No search results available."
|
| 34 |
+
return f"Based on my analysis of '{question}', I found: {search_results[:500]}..."
|
| 35 |
+
|
| 36 |
+
|
| 37 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
| 38 |
"""
|
| 39 |
Fetches all questions, runs the BasicAgent on them, submits all answers,
|