itskavya commited on
Commit
f235d08
·
verified ·
1 Parent(s): 7581b17

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -11,9 +11,11 @@ from langchain_hyperbrowser import HyperbrowserBrowserUseTool
11
  from langgraph.graph import START, StateGraph
12
  from langgraph.prebuilt import ToolNode, tools_condition
13
  from langchain_core.messages import HumanMessage, SystemMessage
 
14
 
15
  browser_tool = HyperbrowserBrowserUseTool()
16
- tools = [browser_tool]
 
17
  llm = HuggingFaceEndpoint(repo_id="Qwen/Qwen2.5-Coder-32B-Instruct")
18
  chat = ChatHuggingFace(llm=llm)
19
  llm_with_tools = chat.bind_tools(tools, parallel_tool_calls=False)
@@ -23,7 +25,7 @@ class State(TypedDict):
23
  messages = Annotated[list[AnyMessage], add_messages]
24
 
25
  def assistant(state:State):
26
- system_message = SystemMessage("You are a helpful assistant. Your job is to answer the questions asked of you as accurately as possible. You have access to a browser search tool, which you may use when needed to answer a question.")
27
  return {
28
  "messages": [llm_with_tools.invoke([system_message] + state["messages"])]
29
  }
 
11
  from langgraph.graph import START, StateGraph
12
  from langgraph.prebuilt import ToolNode, tools_condition
13
  from langchain_core.messages import HumanMessage, SystemMessage
14
+ from langchain_community.tools import DuckDuckGoSearchResults
15
 
16
  browser_tool = HyperbrowserBrowserUseTool()
17
+ search_tool = DuckDuckGoSearchResults()
18
+ tools = [browser_tool, search_tool]
19
  llm = HuggingFaceEndpoint(repo_id="Qwen/Qwen2.5-Coder-32B-Instruct")
20
  chat = ChatHuggingFace(llm=llm)
21
  llm_with_tools = chat.bind_tools(tools, parallel_tool_calls=False)
 
25
  messages = Annotated[list[AnyMessage], add_messages]
26
 
27
  def assistant(state:State):
28
+ system_message = SystemMessage("You are a helpful assistant. Your job is to answer the questions asked of you as accurately as possible. You have access to search and browser tools, which you may use when needed to answer a question.")
29
  return {
30
  "messages": [llm_with_tools.invoke([system_message] + state["messages"])]
31
  }