Spaces:
Sleeping
Sleeping
Update agent.py
Browse files
agent.py
CHANGED
@@ -38,6 +38,18 @@ class GaiaAgent:
|
|
38 |
print(f"Fel vid initiering av agent: {e}")
|
39 |
raise RuntimeError(f"Fel vid laddning av modell eller tokenizer: {e}")
|
40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
def process_task(self, task_description: str) -> str:
|
42 |
# Enkel instruktion till LLM för att utföra uppgiften
|
43 |
# Vi måste bygga en prompt som instruerar modellen att använda verktyg.
|
|
|
38 |
print(f"Fel vid initiering av agent: {e}")
|
39 |
raise RuntimeError(f"Fel vid laddning av modell eller tokenizer: {e}")
|
40 |
|
41 |
+
# --- THIS IS THE MISSING __CALL__ METHOD ---
|
42 |
+
def __call__(self, question: str) -> str:
|
43 |
+
"""
|
44 |
+
Denna metod gör att en instans av GaiaAgent kan kallas som en funktion.
|
45 |
+
Den kommer att anropa din process_task metod för att generera svaret.
|
46 |
+
"""
|
47 |
+
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
48 |
+
result = self.process_task(question)
|
49 |
+
print(f"Agent returning answer: {result[:100]}...") # För att inte fylla loggarna med för långa svar
|
50 |
+
return result
|
51 |
+
# --- END OF MISSING METHOD ---
|
52 |
+
|
53 |
def process_task(self, task_description: str) -> str:
|
54 |
# Enkel instruktion till LLM för att utföra uppgiften
|
55 |
# Vi måste bygga en prompt som instruerar modellen att använda verktyg.
|