Update app.py
Browse files
app.py
CHANGED
|
@@ -26,26 +26,6 @@ class BasicAgent:
|
|
| 26 |
result = self.generator(f"Answer this question accurately: {question}", max_length=256, do_sample=False)
|
| 27 |
return result[0]['generated_text'].split("Answer this question accurately:")[-1].strip()
|
| 28 |
|
| 29 |
-
import os
|
| 30 |
-
|
| 31 |
-
class BasicAgent:
|
| 32 |
-
def __init__(self):
|
| 33 |
-
print("✅ Initializing BasicAgent with model + tools...")
|
| 34 |
-
self.model = HfApiModel(
|
| 35 |
-
model="mistralai/Mistral-7B-Instruct-v0.2",
|
| 36 |
-
api_key=os.getenv("HF_API_KEY")
|
| 37 |
-
)
|
| 38 |
-
self.agent = ToolCallingAgent(
|
| 39 |
-
name="search_agent",
|
| 40 |
-
description="Answers GAIA questions using search and reasoning.",
|
| 41 |
-
model=self.model,
|
| 42 |
-
tools=[DuckDuckGoSearchTool()],
|
| 43 |
-
max_steps=4
|
| 44 |
-
)
|
| 45 |
-
|
| 46 |
-
def __call__(self, question: str) -> str:
|
| 47 |
-
print(f"🧠 Running agent on: {question}")
|
| 48 |
-
return self.agent.run(question).strip()
|
| 49 |
|
| 50 |
|
| 51 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
|
|
| 26 |
result = self.generator(f"Answer this question accurately: {question}", max_length=256, do_sample=False)
|
| 27 |
return result[0]['generated_text'].split("Answer this question accurately:")[-1].strip()
|
| 28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
|
| 31 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|