Update app.py
Browse files
app.py
CHANGED
|
@@ -133,11 +133,14 @@ def handle_input(user_prompt, image=None, audio=None, websearch=False, document=
|
|
| 133 |
)
|
| 134 |
user_prompt = transcription.text
|
| 135 |
|
|
|
|
|
|
|
|
|
|
| 136 |
tools = [
|
| 137 |
Tool(
|
| 138 |
-
name="
|
| 139 |
-
func=
|
| 140 |
-
description="Useful for
|
| 141 |
),
|
| 142 |
Tool(
|
| 143 |
name="Image",
|
|
@@ -146,12 +149,19 @@ def handle_input(user_prompt, image=None, audio=None, websearch=False, document=
|
|
| 146 |
),
|
| 147 |
]
|
| 148 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 149 |
# Add the web search tool only if websearch mode is enabled
|
| 150 |
if websearch:
|
| 151 |
tools.append(Tool(
|
| 152 |
name="Web",
|
| 153 |
func=WebSearch()._run,
|
| 154 |
-
description="Useful for searching
|
| 155 |
))
|
| 156 |
|
| 157 |
# Add the document question answering tool only if a document is provided
|
|
|
|
| 133 |
)
|
| 134 |
user_prompt = transcription.text
|
| 135 |
|
| 136 |
+
# Initialize the search tool
|
| 137 |
+
search = DuckDuckGoSearchRun()
|
| 138 |
+
|
| 139 |
tools = [
|
| 140 |
Tool(
|
| 141 |
+
name="Search",
|
| 142 |
+
func=search.run,
|
| 143 |
+
description="Useful for searching the internet for general information"
|
| 144 |
),
|
| 145 |
Tool(
|
| 146 |
name="Image",
|
|
|
|
| 149 |
),
|
| 150 |
]
|
| 151 |
|
| 152 |
+
# Add the numpy tool, but with a more specific description
|
| 153 |
+
tools.append(Tool(
|
| 154 |
+
name="Numpy",
|
| 155 |
+
func=NumpyCodeCalculator()._run,
|
| 156 |
+
description="Useful only for performing numerical computations, not for general searches"
|
| 157 |
+
))
|
| 158 |
+
|
| 159 |
# Add the web search tool only if websearch mode is enabled
|
| 160 |
if websearch:
|
| 161 |
tools.append(Tool(
|
| 162 |
name="Web",
|
| 163 |
func=WebSearch()._run,
|
| 164 |
+
description="Useful for advanced web searching beyond general information"
|
| 165 |
))
|
| 166 |
|
| 167 |
# Add the document question answering tool only if a document is provided
|