beyzapehlivan commited on
Commit
4ed0eb8
·
verified ·
1 Parent(s): 98bb313

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -8
app.py CHANGED
@@ -16,7 +16,6 @@ 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 ve hataları gideren eksiksiz prompt
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).
@@ -37,9 +36,10 @@ To solve the task, you must write Python code. You can import these libraries:
37
  planning_interval=2,
38
  system_prompt=CUSTOM_SYSTEM_PROMPT
39
  )
40
- print("AlfredAgent başarıyla kuruldu. Sistem promptu güncellendi.")
41
 
42
- def __call__(self, question: str) -> str:
 
43
  prompt = f"""Task: {question}
44
 
45
  IMPORTANT: Your Final Answer must be ONLY the value requested.
@@ -50,17 +50,12 @@ def __call__(self, question: str) -> str:
50
 
51
  try:
52
  result = self.agent.run(prompt)
53
-
54
- # TEMİZLİK OPERASYONU: Alfred'in cevabını süzüyoruz
55
  clean_result = str(result).strip()
56
 
57
- # Eğer cevap içinde "Final Answer:" gibi bir ifade kaldıysa onu temizleyelim
58
  if "Final Answer:" in clean_result:
59
  clean_result = clean_result.split("Final Answer:")[-1].strip()
60
 
61
- # Çok uzun cevapları (paragraf gibi) engellemek için:
62
  if len(clean_result) > 100:
63
- # Alfred bazen tüm süreci cevap sanıyor, sadece en son cümleyi almaya çalışalım
64
  clean_result = clean_result.split('\n')[-1].strip()
65
 
66
  return clean_result
 
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).
 
36
  planning_interval=2,
37
  system_prompt=CUSTOM_SYSTEM_PROMPT
38
  )
39
+ print("AlfredAgent başarıyla kuruldu.")
40
 
41
+ def __call__(self, question: str) -> str:
42
+ # BU FONKSİYON OLMAZSA "NOT CALLABLE" HATASI ALIRSIN
43
  prompt = f"""Task: {question}
44
 
45
  IMPORTANT: Your Final Answer must be ONLY the value requested.
 
50
 
51
  try:
52
  result = self.agent.run(prompt)
 
 
53
  clean_result = str(result).strip()
54
 
 
55
  if "Final Answer:" in clean_result:
56
  clean_result = clean_result.split("Final Answer:")[-1].strip()
57
 
 
58
  if len(clean_result) > 100:
 
59
  clean_result = clean_result.split('\n')[-1].strip()
60
 
61
  return clean_result