Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chatbot using LangChain

A modular and scalable AI chatbot project building using LangChain, FastAPI, and Streamlit. This repository demonstrates how to integrate both cloud-based LLMs (via Groq) and local LLMs (via Ollama) while providing a robust API layer and an interactive user interface.

🚀 Features

  • Multi-Model Support:
    • Groq (Llama 3.3): High-performance cloud inference for detailed tasks.
    • Ollama (TinyLlama): Lightweight local inference for privacy-focused use cases.
  • FastAPI Backend:
    • /chat: General-purpose chatbot endpoint.
    • /essay: specialized endpoint for essay generation.
    • /poem: specialized endpoint for creative writing (poetry).
  • Streamlit Frontend: A simple, interactive UI to chat with the local Ollama model.
  • RAG Capabilities: Includes research notebooks and sample datasets for implementing Retrieval-Augmented Generation.
  • LangSmith Integration: Ready for tracing and monitoring with LangChain's observability tools.

🛠️ Tech Stack

  • Framework: LangChain
  • API: FastAPI, LangServe, Uvicorn
  • Frontend: Streamlit
  • LLM Providers: Groq, Ollama
  • Data Handling: FAISS (CPU), PyPDF, BeautifulSoup4

📦 Installation

  1. Clone the repository:

    git clone https://github.com/YOUR_USERNAME/Chatbot-using-LangChain.git
    cd Chatbot-using-LangChain
  2. Create a virtual environment:

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
  3. Install dependencies:

    pip install -r requirements.txt
  4. Environment Setup: Create a .env file in the root directory and add your API keys:

    GROQ_API_KEY=your_groq_api_key
    LANGCHAIN_API_KEY=your_langchain_api_key
    LANGCHAIN_TRACING_V2=true
    LANGCHAIN_PROJECT=Langchain Chatbot

🖥️ Usage

Running the API Server

Start the FastAPI server using Uvicorn:

python api/app.py

The server will be available at http://localhost:8000. You can access the LangServe playground at:

  • http://localhost:8000/chat/playground
  • http://localhost:8000/essay/playground
  • http://localhost:8000/poem/playground

Running the Streamlit App

Launch the interactive chatbot UI:

streamlit run Chatbot/Ollama.py

📁 Project Structure

.
├── Chatbot/           # Streamlit application
│   └── Ollama.py
├── api/               # FastAPI backend with LangServe
│   └── app.py
├── rag/               # RAG experimentation and assets
│   ├── Simplerag.ipynb
│   ├── attention.pdf
│   ├── chain.ipynb
│   └── speech.txt
├── requirements.txt   # Project dependencies
└── README.md          # Documentation

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages