CoolFace
Apppublic

Laeeeq/React_Agent_App

sourceHugging Faceapache-2.0updated 2y agoView on Hugging Face
0likes
test.py31 linesDownload Raw Back to root
1import sys2from llama_index.llms.gemini import Gemini3from llama_index.core.tools.function_tool import FunctionTool4from llama_index.core.agent import ReActAgent5from tools.search_tool import SearchingTool6from utils.custom_logger import logger7from utils.exception import CustomException8 9try:10    # Create a FunctionTool for the search functionality11    search_tool = FunctionTool.from_defaults(fn=SearchingTool)12    logger.info("FunctionTool for search created successfully.")13 14    # Initialize the Gemini LLM15    llm = Gemini()  # Ensure this is properly configured in your environment16    logger.info("Gemini LLM initialized successfully.")17 18    # Initialize the ReActAgent19    agent = ReActAgent.from_tools(20        tools=[search_tool],21        llm=llm,22        verbose=True,23        allow_parallel_tool_calls=True24    )25    logger.info("Initialized ReActAgent successfully.")26 27except Exception as e:28    # Log the error with detailed traceback29    logger.error(CustomException(e, sys))30 31print(dir(agent))