Update app.py
Browse files
app.py
CHANGED
|
@@ -1,27 +1,24 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from smolagents import CodeAgent, InferenceClientModel
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
from tools import WeatherInfoTool, HubStatsTool
|
| 6 |
from retriever import GuestRetrieverTool, docs
|
| 7 |
-
from langchain_community.tools.ddg_search.tool import DuckDuckGoSearchTool
|
| 8 |
|
| 9 |
-
#
|
| 10 |
-
search_tool =
|
| 11 |
weather_info_tool = WeatherInfoTool()
|
| 12 |
hub_stats_tool = HubStatsTool()
|
| 13 |
guest_info_tool = GuestRetrieverTool(docs)
|
| 14 |
|
| 15 |
-
#
|
| 16 |
-
# client = InferenceClient(model="HuggingFaceH4/zephyr-7b-beta")
|
| 17 |
model = InferenceClientModel(model_id="HuggingFaceH4/zephyr-7b-beta")
|
|
|
|
| 18 |
|
| 19 |
-
#
|
| 20 |
alfred = CodeAgent(
|
| 21 |
tools=[guest_info_tool, weather_info_tool, hub_stats_tool, search_tool],
|
| 22 |
model=model,
|
| 23 |
add_base_tools=True,
|
| 24 |
-
planning_interval=3
|
| 25 |
)
|
| 26 |
|
| 27 |
def respond(message, history):
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from smolagents import CodeAgent, InferenceClientModel
|
| 3 |
+
from tools import WeatherInfoTool, HubStatsTool, DDGSearchTool
|
|
|
|
|
|
|
| 4 |
from retriever import GuestRetrieverTool, docs
|
|
|
|
| 5 |
|
| 6 |
+
# Tools
|
| 7 |
+
search_tool = DDGSearchTool()
|
| 8 |
weather_info_tool = WeatherInfoTool()
|
| 9 |
hub_stats_tool = HubStatsTool()
|
| 10 |
guest_info_tool = GuestRetrieverTool(docs)
|
| 11 |
|
| 12 |
+
# Model
|
|
|
|
| 13 |
model = InferenceClientModel(model_id="HuggingFaceH4/zephyr-7b-beta")
|
| 14 |
+
# If needed: InferenceClientModel(model_id="...", token="YOUR_HF_TOKEN")
|
| 15 |
|
| 16 |
+
# Agent
|
| 17 |
alfred = CodeAgent(
|
| 18 |
tools=[guest_info_tool, weather_info_tool, hub_stats_tool, search_tool],
|
| 19 |
model=model,
|
| 20 |
add_base_tools=True,
|
| 21 |
+
planning_interval=3,
|
| 22 |
)
|
| 23 |
|
| 24 |
def respond(message, history):
|