Spaces:
Sleeping
Sleeping
Update agent.py
Browse files
agent.py
CHANGED
|
@@ -10,12 +10,12 @@ If you are asked for a comma separated list, apply the above rules depending of
|
|
| 10 |
"""
|
| 11 |
|
| 12 |
class GaiaAgent:
|
| 13 |
-
def __init__(self, model_id="
|
| 14 |
self.generator = pipeline("text-generation", model=model_id, tokenizer=model_id, max_new_tokens=512)
|
| 15 |
|
| 16 |
def __call__(self, question: str) -> tuple[str, str]:
|
| 17 |
try:
|
| 18 |
-
prompt = f"
|
| 19 |
output = self.generator(prompt)[0]["generated_text"]
|
| 20 |
|
| 21 |
if "FINAL ANSWER:" in output:
|
|
@@ -25,3 +25,5 @@ class GaiaAgent:
|
|
| 25 |
return final, output
|
| 26 |
except Exception as e:
|
| 27 |
return "ERROR", f"Agent failed: {e}"
|
|
|
|
|
|
|
|
|
| 10 |
"""
|
| 11 |
|
| 12 |
class GaiaAgent:
|
| 13 |
+
def __init__(self, model_id="tiiuae/falcon-rw-1b"):
|
| 14 |
self.generator = pipeline("text-generation", model=model_id, tokenizer=model_id, max_new_tokens=512)
|
| 15 |
|
| 16 |
def __call__(self, question: str) -> tuple[str, str]:
|
| 17 |
try:
|
| 18 |
+
prompt = f"{SYSTEM_PROMPT}\n\n{question}\nFINAL ANSWER:"
|
| 19 |
output = self.generator(prompt)[0]["generated_text"]
|
| 20 |
|
| 21 |
if "FINAL ANSWER:" in output:
|
|
|
|
| 25 |
return final, output
|
| 26 |
except Exception as e:
|
| 27 |
return "ERROR", f"Agent failed: {e}"
|
| 28 |
+
|
| 29 |
+
|