react_agent / search_agent.py
RohitKeswani's picture
adding agent
1b85a7a
from typing import Literal
from langchain_core.tools import tool
from langchain_community.tools import DuckDuckGoSearchRun
@tool
def get_search_results(query: str) -> str:
"""Fetches search results from DuckDuckGo."""
# Perform the search using DuckDuckGoSearchRun
search_tool = DuckDuckGoSearchRun()
results = search_tool.invoke(query)
return results
tools = [get_search_results]