File size: 378 Bytes
8ff02f0
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
from langchain_community.tools import DuckDuckGoSearchResults
from state import AgentState

def search_tool(state: AgentState) -> str:
    """Search the internet for the given question"""
    print('\n STATE:', state)
    question = state["question"]
    search = DuckDuckGoSearchResults()
    search_results = search.invoke(question)
    return {"final_answer": search_results}