Update app.py
Browse files
app.py
CHANGED
@@ -6,6 +6,7 @@ import pandas as pd
|
|
6 |
from smolagents import CodeAgent, DuckDuckGoSearchTool, OpenAIServerModel, VisitWebpageTool, Tool, HfApiModel, ToolCallingAgent
|
7 |
import io
|
8 |
import base64
|
|
|
9 |
# (Keep Constants as is)
|
10 |
# --- Constants ---
|
11 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
@@ -106,6 +107,9 @@ class AudioToTextTool(Tool):
|
|
106 |
# return fixed_answer
|
107 |
class BasicAgent:
|
108 |
def __init__(self):
|
|
|
|
|
|
|
109 |
|
110 |
self.think_model = OpenAIServerModel(
|
111 |
model_id="THUDM/GLM-4-32B-0414",
|
@@ -125,7 +129,7 @@ class BasicAgent:
|
|
125 |
attachment_tool=AttachmentDownloadTool()
|
126 |
image_tool=ImageCaptionTool()
|
127 |
audio_tool=AudioToTextTool()
|
128 |
-
self.tools = [attachment_tool,image_tool,audio_tool,DuckDuckGoSearchTool(), VisitWebpageTool()]
|
129 |
# self.tools = [attachment_tool,image_tool,audio_tool]
|
130 |
web_agent = CodeAgent(
|
131 |
tools=[DuckDuckGoSearchTool(), VisitWebpageTool()],
|
|
|
6 |
from smolagents import CodeAgent, DuckDuckGoSearchTool, OpenAIServerModel, VisitWebpageTool, Tool, HfApiModel, ToolCallingAgent
|
7 |
import io
|
8 |
import base64
|
9 |
+
from langchain.agents import load_tools
|
10 |
# (Keep Constants as is)
|
11 |
# --- Constants ---
|
12 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
|
|
107 |
# return fixed_answer
|
108 |
class BasicAgent:
|
109 |
def __init__(self):
|
110 |
+
|
111 |
+
|
112 |
+
wiki_tool = Tool.from_langchain(load_tools(["wikipedia"])[0])
|
113 |
|
114 |
self.think_model = OpenAIServerModel(
|
115 |
model_id="THUDM/GLM-4-32B-0414",
|
|
|
129 |
attachment_tool=AttachmentDownloadTool()
|
130 |
image_tool=ImageCaptionTool()
|
131 |
audio_tool=AudioToTextTool()
|
132 |
+
self.tools = [attachment_tool,image_tool,audio_tool,wiki_tool,DuckDuckGoSearchTool(), VisitWebpageTool()]
|
133 |
# self.tools = [attachment_tool,image_tool,audio_tool]
|
134 |
web_agent = CodeAgent(
|
135 |
tools=[DuckDuckGoSearchTool(), VisitWebpageTool()],
|