Kackle commited on
Commit
488b180
·
verified ·
1 Parent(s): 0d99aa3

parsing issue

Browse files
Files changed (1) hide show
  1. app.py +16 -8
app.py CHANGED
@@ -29,9 +29,11 @@ class ReliableSearchTool(Tool):
29
  output_type = "string"
30
 
31
  def __init__(self):
 
32
  self.ddg_tool = DuckDuckGoSearchTool()
33
  self.max_retries = 2
34
  self.timeout = 8
 
35
 
36
  def forward(self, query: str) -> str:
37
  """Search the web with retry logic and fallbacks."""
@@ -70,7 +72,7 @@ class SlpMultiAgent:
70
 
71
  # Here you can implement your agent logic, tools, and model calls
72
  web_agent = CodeAgent(
73
- tools=[ReliableSearchTool(), VisitWebpageTool()],
74
  model=model,
75
  additional_authorized_imports=["pandas", "time", "json", "requests"],
76
  max_steps=5, # Keep sufficient steps for complex tasks
@@ -111,15 +113,21 @@ class SlpMultiAgent:
111
  result = await loop.run_in_executor(
112
  None,
113
  lambda: manager_agent.run(f"""
114
- Answer this question accurately and concisely:
115
 
116
- {short_question}
117
 
118
- Instructions:
119
- - Think step by step
120
- - Use search only if you need current/specific information
121
- - Be precise and factual
122
- - If uncertain, state your confidence level
 
 
 
 
 
 
123
  """)
124
  )
125
  break # Success, exit retry loop
 
29
  output_type = "string"
30
 
31
  def __init__(self):
32
+ super().__init__()
33
  self.ddg_tool = DuckDuckGoSearchTool()
34
  self.max_retries = 2
35
  self.timeout = 8
36
+ self.is_initialized = True
37
 
38
  def forward(self, query: str) -> str:
39
  """Search the web with retry logic and fallbacks."""
 
72
 
73
  # Here you can implement your agent logic, tools, and model calls
74
  web_agent = CodeAgent(
75
+ tools=[ReliableSearchTool(), VisitWebpageTool()], # Use custom reliable search tool
76
  model=model,
77
  additional_authorized_imports=["pandas", "time", "json", "requests"],
78
  max_steps=5, # Keep sufficient steps for complex tasks
 
113
  result = await loop.run_in_executor(
114
  None,
115
  lambda: manager_agent.run(f"""
116
+ Question: {short_question}
117
 
118
+ Answer this question step by step. When you need to write code, use this exact format:
119
 
120
+ <code>
121
+ # Your Python code here
122
+ </code>
123
+
124
+ When you have the final answer, use:
125
+
126
+ <code>
127
+ final_answer("Your answer here")
128
+ </code>
129
+
130
+ Be precise and factual. Use search tools only when needed.
131
  """)
132
  )
133
  break # Success, exit retry loop