Commit
·
f22eb38
1
Parent(s):
c207ad1
Removed the smolagents agent
Browse files- app.py +3 -33
- requirements.txt +4 -2
app.py
CHANGED
|
@@ -1,10 +1,7 @@
|
|
| 1 |
import os
|
| 2 |
import gradio as gr
|
| 3 |
import requests
|
| 4 |
-
import inspect
|
| 5 |
import pandas as pd
|
| 6 |
-
from smolagents import CodeAgent, DuckDuckGoSearchTool, FinalAnswerTool, WikipediaSearchTool, \
|
| 7 |
-
VisitWebpageTool, InferenceClientModel, GoogleSearchTool
|
| 8 |
|
| 9 |
# (Keep Constants as is)
|
| 10 |
# --- Constants ---
|
|
@@ -14,39 +11,12 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
|
| 14 |
# ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
|
| 15 |
class BasicAgent:
|
| 16 |
def __init__(self):
|
| 17 |
-
# Initialize the search tool
|
| 18 |
-
web_search_tool = DuckDuckGoSearchTool()
|
| 19 |
-
google_search_tool = GoogleSearchTool()
|
| 20 |
-
visit_webpage_tool = VisitWebpageTool()
|
| 21 |
-
final_answer_tool = FinalAnswerTool()
|
| 22 |
-
|
| 23 |
-
# Initialize the model
|
| 24 |
-
model = InferenceClientModel(
|
| 25 |
-
"Qwen/Qwen2.5-Coder-32B-Instruct", provider="together"
|
| 26 |
-
)
|
| 27 |
-
|
| 28 |
-
self.web_agent = CodeAgent(
|
| 29 |
-
model=model,
|
| 30 |
-
tools=[google_search_tool, visit_webpage_tool],
|
| 31 |
-
name="web_agent",
|
| 32 |
-
description="Browses the web to find information"
|
| 33 |
-
)
|
| 34 |
-
print("WebAgent initialized.")
|
| 35 |
-
self.manager_agent = CodeAgent(
|
| 36 |
-
model=InferenceClientModel("deepseek-ai/DeepSeek-R1", provider="together", max_tokens=8096),
|
| 37 |
-
tools=[final_answer_tool],
|
| 38 |
-
managed_agents=[self.web_agent],
|
| 39 |
-
planning_interval=5,
|
| 40 |
-
verbosity_level=2,
|
| 41 |
-
max_steps=15,
|
| 42 |
-
)
|
| 43 |
print("BasicAgent initialized.")
|
| 44 |
def __call__(self, question: str) -> str:
|
| 45 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
return response
|
| 50 |
|
| 51 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
| 52 |
"""
|
|
|
|
| 1 |
import os
|
| 2 |
import gradio as gr
|
| 3 |
import requests
|
|
|
|
| 4 |
import pandas as pd
|
|
|
|
|
|
|
| 5 |
|
| 6 |
# (Keep Constants as is)
|
| 7 |
# --- Constants ---
|
|
|
|
| 11 |
# ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
|
| 12 |
class BasicAgent:
|
| 13 |
def __init__(self):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
print("BasicAgent initialized.")
|
| 15 |
def __call__(self, question: str) -> str:
|
| 16 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 17 |
+
fixed_answer = "This is a default answer."
|
| 18 |
+
print(f"Agent returning fixed answer: {fixed_answer}")
|
| 19 |
+
return fixed_answer
|
|
|
|
| 20 |
|
| 21 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
| 22 |
"""
|
requirements.txt
CHANGED
|
@@ -1,4 +1,6 @@
|
|
| 1 |
gradio
|
| 2 |
requests
|
| 3 |
-
|
| 4 |
-
|
|
|
|
|
|
|
|
|
| 1 |
gradio
|
| 2 |
requests
|
| 3 |
+
langchain_openai
|
| 4 |
+
langchain_core
|
| 5 |
+
langgraph
|
| 6 |
+
langchain-tavily
|