Spaces:
Sleeping
Sleeping
File size: 3,994 Bytes
98346d0 0736eb7 98346d0 b4c8380 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | ---
title: GenAI Toolkit
emoji: π€
colorFrom: blue
colorTo: green
sdk: docker
pinned: false
---
# π€ GenAI Toolkit
> A powerful, all-in-one Generative AI application combining multiple NLP features into a single, clean interface β powered by LangChain, LangGraph, and Groq LLaMA 3.
---
## π Features
| Feature | Description |
|---------|-------------|
| π **Language Translation** | Translate text across 20+ languages instantly |
| π **Text Summarization** | Condense long documents using map-reduce chunking |
| π **Keyword Extraction** | Extract key topics and phrases from any text |
| βοΈ **Email Writer** | Generate professional emails and cover letters |
| π¬ **Chat Assistant** | Multi-turn AI conversations with memory |
| π **PDF Q&A** | Upload PDFs and ask questions using RAG |
---
## π οΈ Tech Stack
| Layer | Technology |
|-------|-----------|
| **LLM** | Groq LLaMA 3.3 70B + LLaMA 3.1 8B |
| **Orchestration** | LangChain + LangGraph |
| **Vector Store** | FAISS + HuggingFace Embeddings |
| **UI** | Gradio |
| **Deployment** | Docker + Hugging Face Spaces |
---
## ποΈ Architecture
GenAI-Toolkit/
βββ src/
β βββ features/
β β βββ translation.py # LangChain PromptTemplate
β β βββ summarization.py # Map-Reduce summarization
β β βββ keyword_extraction.py # Structured output extraction
β β βββ email_writer.py # Email + Cover letter generation
β β βββ pdf_qa.py # RAG pipeline with FAISS
β βββ graphs/
β β βββ chat_graph.py # LangGraph conversation graph
β βββ utils/
β β βββ llm.py # Groq LLM setup
β β βββ vector_store.py # FAISS vector store
β βββ app.py # Gradio UI
βββ Dockerfile
βββ requirements.txt
---
## π How It Works
### Language Translation
Uses LangChain `PromptTemplate` with Groq LLaMA 3.1 to translate text between 20+ languages while preserving tone and context.
### Text Summarization
Implements **map-reduce chunking** β splits long documents into chunks, summarizes each chunk, then combines into a final summary. Handles documents of any length.
### Keyword Extraction
Uses structured LLM output to extract the most relevant keywords with context and relevance explanations.
### Email & Cover Letter Writer
Template-driven generation with customizable tone, email type, and recipient details. Cover letter writer tailors content to specific job roles and companies.
### Chat Assistant
Built with **LangGraph StateGraph** β maintains full conversation history across turns using a stateful graph architecture.
### PDF Q&A
Implements **RAG (Retrieval Augmented Generation)**:
1. Upload PDF β extract text with PyMuPDF
2. Chunk text with RecursiveCharacterTextSplitter
3. Embed chunks with HuggingFace sentence-transformers
4. Store in FAISS vector store
5. Retrieve top-k relevant chunks per question
6. Generate answer with LangGraph agent
---
## π§ Local Setup
```bash
# Clone the repo
git clone https://github.com/shashankheg/GenAI-Toolkit.git
cd GenAI-Toolkit
# Create virtual environment
uv venv
.venv\Scripts\activate
# Install dependencies
uv pip install -r requirements.txt
# Add API key to .env
echo "GROQ_API_KEY=your-key-here" > .env
# Run the app
python -m src.app
```
---
## π³ Docker
```bash
docker build -t genai-toolkit .
docker run -p 7860:7860 -e GROQ_API_KEY=your-key genai-toolkit
```
---
## π API Keys
- **Groq API** (free) β https://console.groq.com
- No OpenAI key required β fully powered by Groq
---
## π Model Details
| Task | Model | Speed |
|------|-------|-------|
| Translation, Keywords, Email | LLaMA 3.1 8B Instant | ~0.5s |
| Summarization, Chat, PDF Q&A | LLaMA 3.3 70B Versatile | ~1-2s |
---
## π¨βπ» Author
- HuggingFace: [@shashankheg](https://huggingface.co/shashankheg) |