Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
from smolagents import
|
| 2 |
import datetime
|
| 3 |
import requests
|
| 4 |
import pytz
|
|
@@ -9,19 +9,23 @@ from Gradio_UI import GradioUI
|
|
| 9 |
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity!
|
| 11 |
|
|
|
|
| 12 |
@tool
|
| 13 |
-
|
| 14 |
-
def faq_bot_tool(query: str) -> str:
|
| 15 |
-
|
| 16 |
"""
|
| 17 |
-
|
| 18 |
|
| 19 |
Args:
|
| 20 |
-
|
|
|
|
| 21 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
try:
|
| 23 |
-
# Perform a web search using the
|
| 24 |
-
search_results =
|
| 25 |
|
| 26 |
# Extract relevant information from the search results
|
| 27 |
if search_results:
|
|
|
|
| 1 |
+
from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel, load_tool, tool
|
| 2 |
import datetime
|
| 3 |
import requests
|
| 4 |
import pytz
|
|
|
|
| 9 |
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity!
|
| 11 |
|
| 12 |
+
# Define a custom tool using the @tool decorator
|
| 13 |
@tool
|
| 14 |
+
def my_custom_tool(arg1: str, arg2: int) -> str:
|
|
|
|
|
|
|
| 15 |
"""
|
| 16 |
+
A tool that answers customers' queries on working with and as a Virtual Assistant by searching the web and producing a snippet of the first web result in line with parameter arg2.
|
| 17 |
|
| 18 |
Args:
|
| 19 |
+
arg1: Questions about working with and as a Virtual Assistant. (Forexample; Why should I hire a Virtual Assistant?, What courses do I need to complete to become a Virtual Assistant?)
|
| 20 |
+
arg2: 200 characters.
|
| 21 |
"""
|
| 22 |
+
return f"Processed {arg1} with value {arg2}"
|
| 23 |
+
|
| 24 |
+
# Load an external tool, such as a web search tool
|
| 25 |
+
web_search_tool = DuckDuckGoSearchTool(arg1)
|
| 26 |
try:
|
| 27 |
+
# Perform a web search using the DuckDuckGoSearchTool(arg1)
|
| 28 |
+
search_results = web_search_tool
|
| 29 |
|
| 30 |
# Extract relevant information from the search results
|
| 31 |
if search_results:
|