This project implements an AI-powered search and chat agent using LangChain, LangGraph, and Tavily Search API. The agent can retrieve real-time search results and engage in interactive conversations with users, providing a seamless and dynamic experience.
- ๐ Search Engine Integration: Uses Tavily API to fetch real-time web search results.
- ๐ฌ Conversational AI: Chat with an LLM-powered agent that remembers the conversation.
- โณ Streaming Responses: Real-time token streaming for a more engaging chat experience.
- ๐ง Memory Handling: Retains conversation history for contextual understanding.
- ๐ LangSmith Tracing: Debugging and tracing using LangSmith (optional).
- ๐ง Tool Integration: Extensible architecture for adding more tools.
1๏ธโฃ Clone the Repository
git clone https://github.com/your-username/your-repository.git
cd your-repository2๏ธโฃ Install Dependencies
pip install -r requirements.txt
3๏ธโฃ Set Up Environment Variables
Create a .env file and add your API keys:
LANGSMITH_TRACING=true # Set to false if debugging is not needed
LANGSMITH_API_KEY=your-langsmith-api-key
TAVILY_API_KEY=your-tavily-api-key
OPENAI_API_KEY=your-openai-api-key
4๏ธโฃ Run the Chatbot
python SearchEngineAgent.py
1. Start the script and enter your search query.
2. The agent fetches search results and returns real-time data.
3. Engage in a conversation with the LLM-powered assistant.
4. Chat history is stored, and you can ask about previous searches.
5. Type "exit" to terminate the session.
๐ project-folder
โ-- SearchEngineAgent.py # Main script
โ-- .env # Environment variables (ignored in Git)
โ-- requirements.txt # Python dependencies
โ-- README.md # This file
- LangChain - Framework for building LLM applications.
- LangGraph - Agent execution framework.
- Tavily Search - Real-time search API.
- OpenAI API - LLM-powered chat agent.
- Python - Main programming language.
- Enhanced Search Capabilities (support for multiple sources).
- Integration with More LLMs (GPT-4, Claude, etc.).
- Custom User Profiles & Memory Handling.
- Web-Based Frontend Interface.