Spaces:
Sleeping
Sleeping
Update agent.py
Browse files9 unmodified lines10111213131415161718181920212122239 unmodified lines"""
class GaiaAgent: def __init__(self, model_id="mistralai/Mistral-7B-Instruct-v0.1"): 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"<s>[INST] {SYSTEM_PROMPT}\n\n{question} [/INST]" prompt = f"<|system|>\n{SYSTEM_PROMPT}\n<|user|>\n{question}\n<|assistant|>" output = self.generator(prompt)[0]["generated_text"]
# Extrahera bara svaret efter FINAL ANSWER: if "FINAL ANSWER:" in output: final = output.split("FINAL ANSWER:")[-1].strip().split("\n")[0].strip() else:agent.py+2-3