CoolFace
Apppublic

dev-2106/Conversational-AI-Agent

sourceHugging Faceapache-2.0updated 7mo agoView on Hugging Face
0likes
App README

๐Ÿ”Ž LangChain - Chat with Search

An AI-powered chatbot that can search the web, query Wikipedia, and find research papers on Arxiv โ€” all in real time using Groq LLM and LangChain Agents. Free to use!

๐Ÿ“Œ What Does This App Do?

This app is a smart conversational agent that can:

  • โ€”๐ŸŒ Search the web using DuckDuckGo for current information
  • โ€”๐Ÿ“š Search Wikipedia for factual and encyclopedic knowledge
  • โ€”๐Ÿ”ฌ Search Arxiv for academic research papers
  • โ€”๐Ÿ’ฌ Maintains chat history across the entire conversation
  • โ€”๐Ÿง  Shows its thinking process โ€” watch the agent reason step by step in real time

๐Ÿ› ๏ธ How It Works

User asks a question
        โ”‚
        โ–ผ
Groq LLM (llama-3.1-8b-instant) decides which tool to use
        โ”‚
        โ”œโ”€โ”€โ–บ DuckDuckGo Search  โ†’ for general web queries
        โ”œโ”€โ”€โ–บ Wikipedia          โ†’ for factual knowledge
        โ””โ”€โ”€โ–บ Arxiv              โ†’ for research papers
        โ”‚
        โ–ผ
Agent reasons through results (ReAct framework)
        โ”‚
        โ–ผ
Final answer streamed back to user via Streamlit

The agent uses the ZERO_SHOT_REACT_DESCRIPTION strategy โ€” it reads the tool descriptions and decides on its own which tool best answers each question.


โš™๏ธ Tech Stack

TechnologyPurposeCost
GroqLLM inference (llama-3.1-8b-instant)Free
LangChainAgent and tool orchestrationFree
DuckDuckGo SearchReal-time web searchFree, no API key
Wikipedia APIEncyclopedic knowledgeFree, no API key
Arxiv APIResearch paper searchFree, no API key
StreamlitWeb UI with streamingFree
โœ… Only requires a free Groq API key โ€” no other API keys needed!

๐Ÿš€ How to Use

On HuggingFace Spaces:

  1. 1.Open the app
  2. 2.Enter your free Groq API key in the sidebar (get one here)
  3. 3.Type any question in the chat input
  4. 4.Watch the agent search and reason in real time!

Run Locally:

1. Clone the repo:

bash
git clone https://huggingface.co/spaces/dev-2106/langchain-chat-search
cd langchain-chat-search

2. Install dependencies:

bash
pip install streamlit langchain langchain-groq langchain-community duckduckgo-search wikipedia arxiv python-dotenv

3. Create `.env` file:

env
GROQ_API_KEY=your-groq-api-key

4. Run the app:

bash
streamlit run app.py

๐Ÿ”‘ API Keys Required

KeyWhere to GetCost
GROQ_API_KEYconsole.groq.comFree
DuckDuckGo, Wikipedia, and Arxiv require no API keys at all.

๐Ÿ’ก Features

  • โ€”โœ… Real-time streaming โ€” see the response being generated token by token
  • โ€”โœ… Agent thought process visible โ€” watch the agent decide which tool to use
  • โ€”โœ… 3 search tools โ€” web, Wikipedia, and Arxiv all in one chatbot
  • โ€”โœ… Chat history โ€” full conversation context maintained across messages
  • โ€”โœ… No OpenAI needed โ€” powered entirely by free Groq inference

๐Ÿ“‹ Requirements

txt
streamlit
langchain
langchain-groq
langchain-community
duckduckgo-search
wikipedia
arxiv
python-dotenv

๐Ÿ› Common Issues & Fixes

ErrorCauseFix
No module named 'langchain_classic'Deprecated packageUse from langchain.agents import initialize_agent
DuckDuckGo RateLimitToo many requestsWait 30 seconds and retry
GROQ 429 rate limitFree tier exceededWait 60 seconds and retry
Parsing errorLLM response format issueAlready handled with handle_parsing_errors=True

๐Ÿ“„ License

This project is open source and available under the MIT License.


<p align="center">Built with โค๏ธ using LangChain, Groq and Streamlit</p>