venkateshdasari021's picture
Upload 17 files
f016beb verified
raw
history blame
442 Bytes
from langchain_community.utilities import GoogleSerperAPIWrapper
from langchain.agents import Tool
import os
search_tool = GoogleSerperAPIWrapper(
serper_api_key=os.getenv("SERPER_API_KEY"), # add this to your .env
k=3 # top-5 results
)
serper_search_tool = Tool(
name="Google Search",
func=search_tool.run,
description="Useful for answering questions by searching the web."
)