File size: 406 Bytes
1b85a7a
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
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]