Update app.py
Browse files
app.py
CHANGED
|
@@ -16,25 +16,26 @@ model = HfApiModel(model_id="Qwen/Qwen2.5-72B-Instruct", token=token)
|
|
| 16 |
|
| 17 |
class AlfredAgent:
|
| 18 |
def __init__(self):
|
| 19 |
-
# Alfred'e görev bilinci aşılayan özel talimatlar
|
| 20 |
CUSTOM_SYSTEM_PROMPT = """You are a highly efficient GAIA solver.
|
| 21 |
1. When you visit a page, look specifically for tables or lists related to the question.
|
| 22 |
2. If a page is too long or messy, use search to find a better source (like Wikipedia).
|
| 23 |
3. Always provide the answer in the requested format (Year, Name, or Number).
|
| 24 |
-
4. If you are stuck in a loop, try a different search query or move to a different website.
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
self.agent = CodeAgent(
|
| 27 |
tools=[VisitWebpageTool()],
|
| 28 |
model=model,
|
| 29 |
-
max_steps=9,
|
| 30 |
add_base_tools=True,
|
| 31 |
planning_interval=2,
|
| 32 |
-
system_prompt=CUSTOM_SYSTEM_PROMPT
|
| 33 |
)
|
| 34 |
-
print("AlfredAgent başarıyla kuruldu.
|
| 35 |
|
| 36 |
def __call__(self, question: str) -> str:
|
| 37 |
-
# Kuralları burada da pekiştiriyoruz
|
| 38 |
prompt = f"""Task: {question}
|
| 39 |
|
| 40 |
RULES:
|
|
@@ -46,7 +47,6 @@ RULES:
|
|
| 46 |
|
| 47 |
try:
|
| 48 |
result = self.agent.run(prompt)
|
| 49 |
-
# Alfred bazen çok uzun cevap verebilir, sadece son satırı almayı deneyelim
|
| 50 |
return str(result).strip()
|
| 51 |
except Exception as e:
|
| 52 |
return f"Error: {e}"
|
|
|
|
| 16 |
|
| 17 |
class AlfredAgent:
|
| 18 |
def __init__(self):
|
|
|
|
| 19 |
CUSTOM_SYSTEM_PROMPT = """You are a highly efficient GAIA solver.
|
| 20 |
1. When you visit a page, look specifically for tables or lists related to the question.
|
| 21 |
2. If a page is too long or messy, use search to find a better source (like Wikipedia).
|
| 22 |
3. Always provide the answer in the requested format (Year, Name, or Number).
|
| 23 |
+
4. If you are stuck in a loop, try a different search query or move to a different website.
|
| 24 |
+
|
| 25 |
+
Here are the tools you can use:
|
| 26 |
+
{{managed_agents_descriptions}}"""
|
| 27 |
|
| 28 |
self.agent = CodeAgent(
|
| 29 |
tools=[VisitWebpageTool()],
|
| 30 |
model=model,
|
| 31 |
+
max_steps=9,
|
| 32 |
add_base_tools=True,
|
| 33 |
planning_interval=2,
|
| 34 |
+
system_prompt=CUSTOM_SYSTEM_PROMPT
|
| 35 |
)
|
| 36 |
+
print("AlfredAgent başarıyla kuruldu. Hata giderildi.")
|
| 37 |
|
| 38 |
def __call__(self, question: str) -> str:
|
|
|
|
| 39 |
prompt = f"""Task: {question}
|
| 40 |
|
| 41 |
RULES:
|
|
|
|
| 47 |
|
| 48 |
try:
|
| 49 |
result = self.agent.run(prompt)
|
|
|
|
| 50 |
return str(result).strip()
|
| 51 |
except Exception as e:
|
| 52 |
return f"Error: {e}"
|