Spaces:
Sleeping
Sleeping
Update agent.py
Browse files9 unmodified lines1011121314151617181920213 unmodified lines2526279 unmodified lines"""class GaiaAgent:def __init__(self, model_id="HuggingFaceH4/zephyr-7b-beta"):self.generator = pipeline("text-generation", model=model_id, tokenizer=model_id, max_new_tokens=512)def __call__(self, question: str) -> tuple[str, str]:try:prompt = f"<|system|>\n{SYSTEM_PROMPT}\n<|user|>\n{question}\n<|assistant|>"output = self.generator(prompt)[0]["generated_text"]if "FINAL ANSWER:" in output:3 unmodified linesreturn final, outputexcept Exception as e:return "ERROR", f"Agent failed: {e}"9 unmodified lines1011121314151617181920213 unmodified lines25262728299 unmodified lines"""class GaiaAgent:def __init__(self, model_id="tiiuae/falcon-rw-1b"):self.generator = pipeline("text-generation", model=model_id, tokenizer=model_id, max_new_tokens=512)def __call__(self, question: str) -> tuple[str, str]:try:prompt = f"{SYSTEM_PROMPT}\n\n{question}\nFINAL ANSWER:"output = self.generator(prompt)[0]["generated_text"]if "FINAL ANSWER:" in output:3 unmodified linesreturn final, outputexcept Exception as e:return "ERROR", f"Agent failed: {e}"
agent.py+4-2