| from langchain_google_community import GoogleSearchRun, GoogleSearchAPIWrapper |
| from dotenv import load_dotenv |
|
|
| load_dotenv() |
|
|
| search_wrapper = GoogleSearchAPIWrapper() |
| search_tool = GoogleSearchRun(api_wrapper=search_wrapper) |
|
|
| if __name__ == "__main__": |
| print("Start testing search tool with an example question") |
| |
| |
| from utils.agent_executor import create_agent_executor |
|
|
| tools = [search_tool] |
| agent_executor = create_agent_executor(tools=tools) |
| response = agent_executor.invoke( |
| {"input": "What is the current capital of Australia and when was it founded?"} |
| ) |
|
|
| print("\nFinal Answer:") |
| print(response["output"]) |
|
|