{"id":24472434,"url":"https://github.com/amine-akrout/parenting-assistant-rag","last_synced_at":"2026-04-13T04:33:45.004Z","repository":{"id":273364482,"uuid":"911204349","full_name":"amine-akrout/parenting-assistant-rag","owner":"amine-akrout","description":"AI-Powered Parenting Assistant","archived":false,"fork":false,"pushed_at":"2025-10-01T07:10:51.000Z","size":1597,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-01T09:12:18.313Z","etag":null,"topics":["docker","docker-compose","faiss","fastapi","huggingface","langchain","langfuse","llm","llm-guard","llmops","openai","rag"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/amine-akrout.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-01-02T13:30:38.000Z","updated_at":"2025-09-18T12:33:27.000Z","dependencies_parsed_at":"2025-09-18T14:27:22.795Z","dependency_job_id":null,"html_url":"https://github.com/amine-akrout/parenting-assistant-rag","commit_stats":null,"previous_names":["amine-akrout/parenting_assistant_rag"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/amine-akrout/parenting-assistant-rag","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amine-akrout%2Fparenting-assistant-rag","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amine-akrout%2Fparenting-assistant-rag/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amine-akrout%2Fparenting-assistant-rag/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amine-akrout%2Fparenting-assistant-rag/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amine-akrout","download_url":"https://codeload.github.com/amine-akrout/parenting-assistant-rag/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amine-akrout%2Fparenting-assistant-rag/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31554091,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-08T10:21:54.569Z","status":"ssl_error","status_checked_at":"2026-04-08T10:21:38.171Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","docker-compose","faiss","fastapi","huggingface","langchain","langfuse","llm","llm-guard","llmops","openai","rag"],"created_at":"2025-01-21T08:12:18.531Z","updated_at":"2026-04-13T04:33:44.967Z","avatar_url":"https://github.com/amine-akrout.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🤖 AI-Powered Parenting Assistant\n\n## 📌 Overview\nThe **AI-Powered Parenting Assistant** is an intelligent chatbot designed to provide safe, reliable, and empathetic responses to parenting-related questions. Built using **LangChain**, **LLM Guard**, and **FastAPI**, the system leverages **Retrieval-Augmented Generation (RAG)** to enhance its responses with relevant knowledge from curated sources.\n\nThe chatbot also integrates **advanced content filtering** to ensure the safety and appropriateness of responses, making it a powerful demonstration of AI engineering best practices.\n\n---\n\n## 🚀 Features\n### ✅ **Retrieval-Augmented Generation (RAG) System**\n- Uses **FAISS vector search** combined with **BM25 retrieval** for accurate contextual knowledge retrieval.\n- Implements **OpenVINO Reranker** for document ranking and relevance filtering.\n\n### 🛡 **AI Safety with LLM Guard**\n- **Input Filtering**: Blocks **toxic, political, religious, and self-harm topics** using `llm_guard`.\n- **Output Validation**: Scans model responses for **language safety, sensitivity, and relevance**.\n- **Routing Mechanism**: Ensures inappropriate queries are handled gracefully.\n\n### ⚡ **High-Performance AI Pipeline**\n- **LangChain Pipelines**: Modular **runnable chains** for seamless data flow.\n- **Prompt Engineering**: Optimized **few-shot prompting** for structured AI outputs.\n- **FastAPI Backend**: Fully asynchronous **REST API** for real-time chatbot interactions.\n- **Langfuse Monitoring**: Enables **real-time LLM performance tracking**.\n\n### 🔥 **Job-Worthy Tech Stack**\n✅ **AI \u0026 LLMs**: OpenAI GPT Models, LangChain, HuggingFace Embeddings  \n✅ **Data Retrieval**: FAISS, BM25, OpenVINO Reranker  \n✅ **Safety**: LLM Guard (Input \u0026 Output Filtering)  \n✅ **Backend API**: FastAPI, Pydantic, Loguru  \n✅ **Monitoring**: Langfuse Callbacks  \n✅ **Dockerized Pipeline**: Multi-stage AI data processing stack  \n\n---\n\n## 📁 Project Structure\n```\n📂 src/\n ├── core/\n │   ├── chatbot.py       # Main AI chatbot pipeline (LLM + Retrieval + Guard)\n │   ├── embedding.py     # FAISS/BM25 index generation\n │   ├── evaluation.py    # AI performance and accuracy checks\n │   ├── filters.py       # LLM Guard configurations for input/output scanning\n │── config.py            # Application settings \u0026 environment variables\n │\n ├── api/\n │   ├── routers/\n │   │   └── chat.py      # FastAPI routes for chatbot integration\n │   │── __init__.py      # API initializer\n │   └── main.py          # FastAPI app initialization\n │\n ├── data/\n │   ├── clean_data.py    # Data preprocessing scripts\n │\n ├── monitoring/\n │   └── monitoring.py    # Langfuse monitoring setup\n │\n ├── Dockerfile           # Containerization setup\n ├── docker-compose.yml   # Multi-container deployment setup\n ├── requirements.txt     # Python dependencies\n ├── README.md            # Project documentation (this file)\n```\n\n---\n\n## 🏗 Setup \u0026 Installation\n### 1️⃣ **Clone the Repository**\n```bash\ngit clone https://github.com/amine-akrout/parenting_assistant_rag.git\ncd parenting_assistant_rag\n```\n\n### 2️⃣ **Create Virtual Environment \u0026 Install Dependencies**\n```bash\npython -m venv venv\nsource venv/bin/activate  # On Windows use `venv\\Scripts\\activate`\npip install -r requirements.txt\n```\n\n### 3️⃣ **Set Up Environment Variables**\nCreate a `.env` file in the root directory:\n```ini\nPOSTGRES_USER=your_db_user\nPOSTGRES_PASSWORD=your_db_password\nPOSTGRES_DB=your_db_name\nOPENAI_API_KEY=your-openai-key\nLANGFUSE_PUBLIC_KEY=your-langfuse-public-key\nLANGFUSE_SECRET_KEY=your-langfuse-secret-key\n```\n\n### 4️⃣ **Run the API Server**\n```bash\nuvicorn src.api.main:app --host 0.0.0.0 --port 8000\n```\n\n### 5️⃣ **Test the API**\nOpen **Swagger UI** to test endpoints:  \n📌 `http://localhost:8000/docs`\n\n---\n\n## 🐳 Dockerized Workflow\nThis project includes a **Dockerized data pipeline** that prepares, indexes, and serves the chatbot API.  \n\n### 1️⃣ **Start All Services**\n```bash\ndocker-compose up --build\n```\n### 2️⃣ **Stop All Services**\n```bash\ndocker-compose down\n```\n\n### **Docker Services Overview**\n- **`langfuse-server`** → Logs chatbot requests/responses for monitoring\n- **`db`** → PostgreSQL database for logging and indexing\n- **`clean-data`** → Prepares and cleans datasets before indexing\n- **`preprocess`** → Creates FAISS/BM25 indexes for fast retrieval\n- **`chatbot-api`** → Runs the **FastAPI** chatbot backend\n\n\n---\n\n## 📈 Performance Monitoring (Langfuse)\nEnable **Langfuse** for real-time monitoring: \n\n📌 `http://localhost:3000`  \n\nView logs on **Langfuse Dashboard**.\n\n---\n\n## 🧪 Testing\n\nRun unit tests using **pytest**:\n\n```bash\npytest tests/\n```\n\n---\n\n## 🎯 Future Enhancements\n✅ Add **multi-turn conversations** (memory support)  \n✅ Implement **whisper model for speech-to-text**  \n✅ Add **more retrieval sources (vector \u0026 hybrid search)**  \n✅ Integrate **more LLM Guard features** (e.g., sentiment analysis)  \n\n\n---\n\n## 🤝 Contributing\nFeel free to **open an issue** or **submit a pull request**.\n\n---\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famine-akrout%2Fparenting-assistant-rag","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famine-akrout%2Fparenting-assistant-rag","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famine-akrout%2Fparenting-assistant-rag/lists"}