Instructions to use mathanmithun/DhiGrowth_FAQ_RAG with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use mathanmithun/DhiGrowth_FAQ_RAG with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf mathanmithun/DhiGrowth_FAQ_RAG:Q4_K_M # Run inference directly in the terminal: llama cli -hf mathanmithun/DhiGrowth_FAQ_RAG:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf mathanmithun/DhiGrowth_FAQ_RAG:Q4_K_M # Run inference directly in the terminal: llama cli -hf mathanmithun/DhiGrowth_FAQ_RAG:Q4_K_M
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf mathanmithun/DhiGrowth_FAQ_RAG:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama cli -hf mathanmithun/DhiGrowth_FAQ_RAG:Q4_K_M
Use Docker
docker model run hf.co/mathanmithun/DhiGrowth_FAQ_RAG:Q4_K_M
- Llama new
- LM Studio
- Jan
- Ollama
How to use mathanmithun/DhiGrowth_FAQ_RAG with Ollama:
ollama run hf.co/mathanmithun/DhiGrowth_FAQ_RAG:Q4_K_M
- Unsloth Desktop
- Pi
How to use mathanmithun/DhiGrowth_FAQ_RAG with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf mathanmithun/DhiGrowth_FAQ_RAG:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:9931/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "mathanmithun/DhiGrowth_FAQ_RAG:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use mathanmithun/DhiGrowth_FAQ_RAG with Docker Model Runner:
docker model run hf.co/mathanmithun/DhiGrowth_FAQ_RAG:Q4_K_M
- Lemonade
How to use mathanmithun/DhiGrowth_FAQ_RAG with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull mathanmithun/DhiGrowth_FAQ_RAG:Q4_K_M
Run and chat with the model
lemonade run user.DhiGrowth_FAQ_RAG-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use mathanmithun/DhiGrowth_FAQ_RAG with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf mathanmithun/DhiGrowth_FAQ_RAG:Q4_K_M
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:9931/v1 hermes config set model.default mathanmithun/DhiGrowth_FAQ_RAG:Q4_K_M
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use mathanmithun/DhiGrowth_FAQ_RAG with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf mathanmithun/DhiGrowth_FAQ_RAG:Q4_K_M
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:9931/v1 \ --custom-model-id "mathanmithun/DhiGrowth_FAQ_RAG:Q4_K_M" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
|
Download README.md from mathanmithun/DhiGrowth_FAQ_RAG: direct link, hf CLI and curl.
- Browser
- Download file 9.77 kB
-
https://huggingface.co/mathanmithun/DhiGrowth_FAQ_RAG/resolve/main/README.md
- Command line
-
hf download hf://mathanmithun/DhiGrowth_FAQ_RAG/README.md
-
curl -L -o README.md https://huggingface.co/mathanmithun/DhiGrowth_FAQ_RAG/resolve/main/README.md
9.77 kB
| # Dhigrowth RAG Chatbot | |
| A Retrieval-Augmented Generation (RAG) chatbot system built for Dhigrowth, providing accurate answers based on company knowledge base using vector similarity search and fine-tuned language models. | |
| ## π Features | |
| - **RAG Architecture**: Combines vector similarity search with LLM generation for accurate, context-aware responses | |
| - **Vector Database**: ChromaDB for efficient document retrieval | |
| - **Fine-tuned Model**: Qwen2.5-0.5B model fine-tuned on Dhigrowth data | |
| - **RESTful API**: FastAPI-based backend with comprehensive error handling | |
| - **Input Validation**: Pydantic-based validation for robust API requests | |
| - **Comprehensive Logging**: File and console logging for debugging and monitoring | |
| - **Health Monitoring**: Health check endpoints for system status | |
| - **Error Handling**: Graceful error handling with informative responses | |
| ## π Table of Contents | |
| - [Installation](#installation) | |
| - [Project Structure](#project-structure) | |
| - [Configuration](#configuration) | |
| - [Usage](#usage) | |
| - [API Documentation](#api-documentation) | |
| - [Testing](#testing) | |
| - [Deployment](#deployment) | |
| - [Troubleshooting](#troubleshooting) | |
| ## π οΈ Installation | |
| ### Prerequisites | |
| - Python 3.8 or higher | |
| - 4GB+ RAM recommended | |
| - 2GB+ disk space for models and embeddings | |
| ### Step 1: Clone the Repository | |
| ```bash | |
| git clone <repository-url> | |
| cd DHIGROWTH_RAG | |
| ``` | |
| ### Step 2: Create Virtual Environment | |
| **Windows:** | |
| ```bash | |
| python -m venv venv | |
| source venv/Scripts/activate | |
| ``` | |
| **Linux/Mac:** | |
| ```bash | |
| python3 -m venv venv | |
| source venv/bin/activate | |
| ``` | |
| ### Step 3: Install Dependencies | |
| ```bash | |
| pip install -r requirements.txt | |
| ``` | |
| ### Step 4: Set Up Vector Database | |
| Create the vector database from your data: | |
| ```bash | |
| python src/embed_loader.py | |
| ``` | |
| This will: | |
| - Load data from `data/dhigrowth_final_rag_ft.jsonl` | |
| - Create embeddings using SentenceTransformer | |
| - Store documents in ChromaDB at `./embeddings` | |
| ## π Project Structure | |
| ``` | |
| DHIGROWTH_RAG/ | |
| β | |
| βββ app.py # FastAPI application | |
| βββ config.py # Configuration module | |
| βββ requirements.txt # Python dependencies | |
| βββ README.md # This file | |
| β | |
| βββ models/ # LLM model files | |
| β βββ Dhi_Qwen2P5_0_5B_Q4_K_M.gguf | |
| β | |
| βββ data/ # Training/knowledge base data | |
| β βββ dhigrowth_final_rag_ft.jsonl | |
| β | |
| βββ embeddings/ # ChromaDB persistent storage | |
| β βββ (auto-generated) | |
| β | |
| βββ src/ # Source code | |
| βββ embed_loader.py # Vector database creation | |
| βββ retriever.py # Document retrieval module | |
| βββ llm_wrapper.py # LLM model wrapper | |
| βββ rag_pipeline.py # Main RAG pipeline | |
| βββ logger_config.py # Logging configuration | |
| ``` | |
| ## βοΈ Configuration | |
| Configuration is managed through environment variables or `config.py`. Create a `.env` file in the project root: | |
| ```env | |
| # Model paths | |
| MODEL_PATH=./models/Dhi_Qwen2P5_0_5B_Q4_K_M.gguf | |
| EMBEDDINGS_PATH=./embeddings | |
| DATA_PATH=./data/dhigrowth_final_rag_ft.jsonl | |
| # Embedding model | |
| EMBEDDING_MODEL=all-MiniLM-L6-v2 | |
| # Generation settings | |
| MAX_TOKENS=400 | |
| TOP_K=3 | |
| # LLM settings | |
| N_CTX=4096 | |
| TEMPERATURE=0.0 | |
| TOP_P=1.0 | |
| # Server settings | |
| PORT=8001 | |
| ``` | |
| ### Configuration Options | |
| - `MODEL_PATH`: Path to the GGUF model file | |
| - `EMBEDDINGS_PATH`: ChromaDB storage directory | |
| - `DATA_PATH`: Path to JSONL knowledge base file | |
| - `EMBEDDING_MODEL`: SentenceTransformer model name | |
| - `MAX_TOKENS`: Maximum tokens for LLM generation | |
| - `TOP_K`: Number of documents to retrieve | |
| - `N_CTX`: Context window size | |
| - `TEMPERATURE`: Sampling temperature (0.0 = deterministic) | |
| - `TOP_P`: Nucleus sampling parameter | |
| - `PORT`: Server port (default: 8001) | |
| ## π Usage | |
| ### Starting the API Server | |
| ```bash | |
| # Activate virtual environment | |
| source venv/Scripts/activate # Windows: venv\Scripts\activate | |
| # Start the server | |
| uvicorn app:app --reload --port 8001 | |
| ``` | |
| The API will be available at `http://localhost:8001` | |
| ### Interactive API Documentation | |
| Once the server is running, visit: | |
| - **Swagger UI**: http://localhost:8001/docs | |
| - **ReDoc**: http://localhost:8001/redoc | |
| ### Using the RAG Pipeline Directly | |
| ```python | |
| from src.rag_pipeline import rag_chat | |
| # Ask a question | |
| answer = rag_chat("What services does Dhigrowth offer?") | |
| print(answer) | |
| ``` | |
| ## π‘ API Documentation | |
| ### Endpoints | |
| #### `GET /` | |
| Root endpoint with API information. | |
| **Response:** | |
| ```json | |
| { | |
| "message": "Dhigrowth RAG Chatbot API", | |
| "version": "1.0.0", | |
| "endpoints": { | |
| "health": "/health", | |
| "ask": "/ask (POST)" | |
| } | |
| } | |
| ``` | |
| #### `GET /health` | |
| Health check endpoint. | |
| **Response:** | |
| ```json | |
| { | |
| "status": "healthy", | |
| "service": "Dhigrowth RAG Chatbot", | |
| "version": "1.0.0" | |
| } | |
| ``` | |
| #### `POST /ask` | |
| Ask a question to the chatbot. | |
| **Request Body:** | |
| ```json | |
| { | |
| "question": "What services does Dhigrowth offer?" | |
| } | |
| ``` | |
| **Response:** | |
| ```json | |
| { | |
| "question": "What services does Dhigrowth offer?", | |
| "answer": "Dhigrowth provides website development, application development, digital marketing, SEO improvement, business automation, and custom business growth strategies." | |
| } | |
| ``` | |
| **Error Responses:** | |
| - `400 Bad Request`: Invalid input | |
| - `422 Unprocessable Entity`: Validation error | |
| - `500 Internal Server Error`: Server error | |
| ### Example API Calls | |
| **Using cURL:** | |
| ```bash | |
| curl -X POST http://localhost:8001/ask \ | |
| -H "Content-Type: application/json" \ | |
| -d '{"question": "How do I book a consultation?"}' | |
| ``` | |
| **Using Python:** | |
| ```python | |
| import requests | |
| response = requests.post( | |
| "http://localhost:8001/ask", | |
| json={"question": "What services does Dhigrowth offer?"} | |
| ) | |
| print(response.json()) | |
| ``` | |
| **Using JavaScript:** | |
| ```javascript | |
| fetch("http://localhost:8001/ask", { | |
| method: "POST", | |
| headers: { | |
| "Content-Type": "application/json", | |
| }, | |
| body: JSON.stringify({ | |
| question: "What services does Dhigrowth offer?", | |
| }), | |
| }) | |
| .then((response) => response.json()) | |
| .then((data) => console.log(data)); | |
| ``` | |
| ## π§ͺ Testing | |
| ### Running Tests | |
| Test the RAG pipeline directly: | |
| ```bash | |
| python -c "from src.rag_pipeline import rag_chat; print(rag_chat('What services does Dhigrowth offer?'))" | |
| ``` | |
| Test the API using FastAPI TestClient: | |
| ```bash | |
| python -c "from app import app; from fastapi.testclient import TestClient; client = TestClient(app); print(client.get('/health').json())" | |
| ``` | |
| ### Test Cases | |
| The system has been tested with: | |
| - β Valid questions about Dhigrowth | |
| - β Out-of-scope questions (returns "I don't have that information") | |
| - β Input validation (empty/whitespace questions) | |
| - β Error handling | |
| See `TEST_RESULTS.md` for detailed test results. | |
| ## π’ Deployment | |
| ### Option 1: Local Development | |
| ```bash | |
| uvicorn app:app --reload --port 8001 | |
| ``` | |
| ### Option 2: Production with Uvicorn | |
| ```bash | |
| uvicorn app:app --host 0.0.0.0 --port 8001 --workers 4 | |
| ``` | |
| ### Option 3: Docker (Recommended for Production) | |
| Create a `Dockerfile`: | |
| ```dockerfile | |
| FROM python:3.11-slim | |
| WORKDIR /app | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| COPY . . | |
| EXPOSE 8001 | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8001"] | |
| ``` | |
| Build and run: | |
| ```bash | |
| docker build -t dhigrowth-rag . | |
| docker run -p 8001:8001 dhigrowth-rag | |
| ``` | |
| ### Option 4: Cloud Deployment | |
| **VPS Deployment:** | |
| 1. Upload project files | |
| 2. Install dependencies | |
| 3. Run with process manager (systemd, supervisor, or PM2) | |
| 4. Configure reverse proxy (nginx) | |
| **Platform-as-a-Service:** | |
| - Deploy to Heroku, Railway, or Render | |
| - Configure environment variables | |
| - Set up persistent storage for embeddings | |
| ## π§ Troubleshooting | |
| ### Common Issues | |
| **Issue: Model file not found** | |
| - **Solution**: Ensure `Dhi_Qwen2P5_0_5B_Q4_K_M.gguf` is in the `models/` directory | |
| **Issue: ChromaDB collection empty** | |
| - **Solution**: Run `python src/embed_loader.py` to create the vector database | |
| **Issue: Import errors** | |
| - **Solution**: Ensure virtual environment is activated and dependencies are installed | |
| **Issue: Port already in use** | |
| - **Solution**: Change port: `uvicorn app:app --port 8001` | |
| **Issue: Slow response times** | |
| - **Solution**: | |
| - First request is slower (model loading) | |
| - Subsequent requests are faster | |
| - Consider using GPU for faster inference | |
| ### Logs | |
| Check logs in `dhigrowth_rag.log` for detailed error information. | |
| ## π Performance | |
| - **Model Loading**: ~2-3 seconds (first request only) | |
| - **Embedding Model**: ~5 seconds (first request only) | |
| - **Query Processing**: ~2-3 seconds per query | |
| - **Vector Database**: 1,601 documents indexed | |
| ## π Security Considerations | |
| - Input validation prevents injection attacks | |
| - CORS can be configured for specific origins in production | |
| - Consider adding authentication for production deployment | |
| - Rate limiting recommended for public APIs | |
| ## π License | |
| [Add your license information here] | |
| ## π₯ Contributing | |
| [Add contribution guidelines if applicable] | |
| ## π§ Contact | |
| For questions or support, contact [your contact information] | |
| ## π Acknowledgments | |
| - Qwen2.5 model by Alibaba Cloud | |
| - ChromaDB for vector database | |
| - SentenceTransformers for embeddings | |
| - FastAPI for the web framework | |
| --- | |
| **Version**: 1.0.0 | |
| **Last Updated**: November 2024 | |