https://github.com/user-attachments/assets/a9ff8e75-f7ca-44d5-86bb-004fbcc58007
This project demonstrates how to build a search-powered conversational AI agent using LangChain and Groq LLMs, wrapped in a clean Streamlit UI. The chatbot doesnโt just generate answers from a single model โ instead, it uses LangChain Agents that can reason, choose tools, and act before responding.
๐ง How It Works
LLM Backbone (Groq LLM)
The core reasoning engine is powered by Groqโs llama-3.1-8b-instant model. It interprets the userโs queries and decides how to solve them.
LangChain Agent
The app uses ZERO_SHOT_REACT_DESCRIPTION agent type. This means the agent can โthink step by step,โ deciding when to search and which tool to use โ without any predefined training examples.
Integrated Tools
๐ฐ Wikipedia Tool โ fetches concise, reliable summaries for general knowledge queries. ๐ Arxiv Tool โ retrieves abstracts of academic research papers, useful for technical/scientific queries. ๐ DuckDuckGo Tool โ performs real-time web searches for the latest information or broader topics.
Agent Execution Flow
User enters a query in the Streamlit chat. The agent analyzes the query and selects the most relevant tool (Wikipedia, Arxiv, or DuckDuckGo). The tool fetches external data. The agent integrates the results and responds conversationally.
Interactive UI
Powered by Streamlit, showing both the chat and the agentโs thought process (via StreamlitCallbackHandler). Maintains chat history so the conversation feels natural and continuous.
โ๏ธ Installation
Clone the repo
git clone https://github.com/your-username/Search-Engine-With-Langchain-Tools-And-Agents.git cd Search-Engine-With-Langchain-Tools-And-Agents
Create a virtual environment
python -m venv venv source venv/bin/activate # On Linux/Mac venv\Scripts\activate # On Windows
Install dependencies
pip install -r requirements.txt
If requirements.txt is not created yet, generate one:
pip freeze > requirements.txt
๐ Environment Variables
Create a .env file in the project root:
GROQ_API_KEY=your_groq_api_key_here HF_TOKEN=your_huggingface_token_here
โ ๏ธ Important: Do not commit .env to GitHub (already added to .gitignore).
โถ๏ธ Usage Run the Streamlit app: streamlit run app.py
Open your browser at: ๐ http://localhost:8501
Youโll see a chatbot interface where you can: Ask research-based queries โ answered via Arxiv General knowledge โ answered via Wikipedia Broader topics โ answered via DuckDuckGo
๐ธ Demo (Screenshot/GIF) (Add a screenshot of your Streamlit app here)
๐ ๏ธ Tech Stack
Python Streamlit LangChain Groq API Arxiv API Wikipedia API DuckDuckGo Search
๐งโ๐ป Author Himanshu Lodha ๐ผ LinkedIn ๐ GitHub