Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,6 +10,7 @@ from langchain_core.messages import AnyMessage, SystemMessage, HumanMessage
|
|
| 10 |
from langgraph.graph.message import add_messages
|
| 11 |
from langgraph.graph import START, StateGraph
|
| 12 |
from langgraph.prebuilt import ToolNode, tools_condition
|
|
|
|
| 13 |
# (Keep Constants as is)
|
| 14 |
# --- Constants ---
|
| 15 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
|
@@ -39,7 +40,14 @@ class BasicAgent:
|
|
| 39 |
max_retries=1,
|
| 40 |
max_tokens=128,
|
| 41 |
)
|
| 42 |
-
self.tools = [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
self.chat_with_tools = self.model.bind_tools(self.tools)
|
| 44 |
# The graph
|
| 45 |
builder = StateGraph(AgentState)
|
|
|
|
| 10 |
from langgraph.graph.message import add_messages
|
| 11 |
from langgraph.graph import START, StateGraph
|
| 12 |
from langgraph.prebuilt import ToolNode, tools_condition
|
| 13 |
+
from langchain_tavily import TavilySearch
|
| 14 |
# (Keep Constants as is)
|
| 15 |
# --- Constants ---
|
| 16 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
|
|
|
| 40 |
max_retries=1,
|
| 41 |
max_tokens=128,
|
| 42 |
)
|
| 43 |
+
self.tools = [
|
| 44 |
+
TavilySearch(
|
| 45 |
+
max_results=5,
|
| 46 |
+
topic="general",
|
| 47 |
+
search_depth="basic",
|
| 48 |
+
)
|
| 49 |
+
]
|
| 50 |
+
|
| 51 |
self.chat_with_tools = self.model.bind_tools(self.tools)
|
| 52 |
# The graph
|
| 53 |
builder = StateGraph(AgentState)
|