Spaces:
Sleeping
Sleeping
typo in tool finding
Browse files
app.py
CHANGED
|
@@ -23,17 +23,13 @@ OPENAI_TOKEN = os.getenv("OPENAI_API_KEY")
|
|
| 23 |
|
| 24 |
# --- Custom Tools ---
|
| 25 |
class ReliableSearchTool(Tool):
|
| 26 |
-
|
|
|
|
| 27 |
|
| 28 |
def __init__(self):
|
| 29 |
-
super().__init__(
|
| 30 |
-
name="reliable_search",
|
| 31 |
-
description="Search the web for information with built-in retry and fallback mechanisms",
|
| 32 |
-
fn=self.search
|
| 33 |
-
)
|
| 34 |
self.ddg_tool = DuckDuckGoSearchTool()
|
| 35 |
-
self.max_retries =
|
| 36 |
-
self.timeout =
|
| 37 |
|
| 38 |
def search(self, query: str) -> str:
|
| 39 |
"""Search the web with retry logic and fallbacks."""
|
|
@@ -67,9 +63,9 @@ class SlpMultiAgent:
|
|
| 67 |
|
| 68 |
# Use GPT-3.5-turbo model with optimized settings
|
| 69 |
model = OpenAIServerModel(
|
| 70 |
-
model_id="gpt-3.5-turbo",
|
| 71 |
temperature=0.1, # Slight randomness for better reasoning
|
| 72 |
-
max_tokens=
|
| 73 |
)
|
| 74 |
|
| 75 |
# Here you can implement your agent logic, tools, and model calls
|
|
@@ -77,7 +73,7 @@ class SlpMultiAgent:
|
|
| 77 |
tools=[ReliableSearchTool(), VisitWebpageTool()], # Use our custom reliable search tool
|
| 78 |
model=model,
|
| 79 |
additional_authorized_imports=["pandas", "time", "json", "requests"],
|
| 80 |
-
max_steps=
|
| 81 |
name="WebAgent",
|
| 82 |
verbosity_level=0,
|
| 83 |
description="An agent that can search the web and visit webpages to find information."
|
|
@@ -85,9 +81,9 @@ class SlpMultiAgent:
|
|
| 85 |
|
| 86 |
manager_agent = CodeAgent(
|
| 87 |
model=OpenAIServerModel(
|
| 88 |
-
model_id="gpt-3.5-turbo",
|
| 89 |
temperature=0.1,
|
| 90 |
-
max_tokens=
|
| 91 |
),
|
| 92 |
tools=[],
|
| 93 |
managed_agents=[web_agent],
|
|
@@ -101,7 +97,7 @@ class SlpMultiAgent:
|
|
| 101 |
],
|
| 102 |
planning_interval=3,
|
| 103 |
verbosity_level=1,
|
| 104 |
-
max_steps=
|
| 105 |
final_answer_checks=[check_reasoning]
|
| 106 |
)
|
| 107 |
|
|
|
|
| 23 |
|
| 24 |
# --- Custom Tools ---
|
| 25 |
class ReliableSearchTool(Tool):
|
| 26 |
+
name = "reliable_search"
|
| 27 |
+
description = "Search the web for information with built-in retry and fallback mechanisms"
|
| 28 |
|
| 29 |
def __init__(self):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
self.ddg_tool = DuckDuckGoSearchTool()
|
| 31 |
+
self.max_retries = 2 # Reduced for efficiency
|
| 32 |
+
self.timeout = 8
|
| 33 |
|
| 34 |
def search(self, query: str) -> str:
|
| 35 |
"""Search the web with retry logic and fallbacks."""
|
|
|
|
| 63 |
|
| 64 |
# Use GPT-3.5-turbo model with optimized settings
|
| 65 |
model = OpenAIServerModel(
|
| 66 |
+
model_id="gpt-3.5-turbo-16k",
|
| 67 |
temperature=0.1, # Slight randomness for better reasoning
|
| 68 |
+
max_tokens=1000 # Keep higher tokens for complex reasoning
|
| 69 |
)
|
| 70 |
|
| 71 |
# Here you can implement your agent logic, tools, and model calls
|
|
|
|
| 73 |
tools=[ReliableSearchTool(), VisitWebpageTool()], # Use our custom reliable search tool
|
| 74 |
model=model,
|
| 75 |
additional_authorized_imports=["pandas", "time", "json", "requests"],
|
| 76 |
+
max_steps=5, # Keep sufficient steps for complex tasks
|
| 77 |
name="WebAgent",
|
| 78 |
verbosity_level=0,
|
| 79 |
description="An agent that can search the web and visit webpages to find information."
|
|
|
|
| 81 |
|
| 82 |
manager_agent = CodeAgent(
|
| 83 |
model=OpenAIServerModel(
|
| 84 |
+
model_id="gpt-3.5-turbo-16k",
|
| 85 |
temperature=0.1,
|
| 86 |
+
max_tokens=1000
|
| 87 |
),
|
| 88 |
tools=[],
|
| 89 |
managed_agents=[web_agent],
|
|
|
|
| 97 |
],
|
| 98 |
planning_interval=3,
|
| 99 |
verbosity_level=1,
|
| 100 |
+
max_steps=10, # Keep full steps for complex reasoning
|
| 101 |
final_answer_checks=[check_reasoning]
|
| 102 |
)
|
| 103 |
|