# requirements.txt — HuggingFace Spaces (CPU, 12 GB RAM, 16 GB disk) # OPTIMIZED: pre-built wheels only — zero C++ source compilation. # PyTorch CPU wheel is installed separately in Dockerfile BEFORE this file. # ───────────────────────────────────────────────────────────────────────────── # # Build-stall root causes fixed: # 1. llama-cpp-python: pinned to ==0.3.30 (latest wheel on abetlen's CPU index). # Using >=0.3.0 resolves to 0.3.31 on PyPI which has NO wheel — triggers # a full CMake/C++ build that stalls for 8+ hours on HF Spaces CPU hardware. # 2. unstructured[pdf,image]: removed — pulled numba→llvmlite (LLVM compilation). # OCR fallback in document_loader.py is wrapped in try/except ImportError and # is non-critical; PyMuPDF handles the vast majority of PDFs natively. # # CRITICAL: --extra-index-url MUST be declared first (before the package line) # so pip resolves llama-cpp-python from the wheel index, not PyPI source. # ───────────────────────────────────────────────────────────────────────────── --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu # LLM Runtime — pinned to latest pre-built CPU wheel (py3-none-manylinux2014_x86_64) # DO NOT use >=; that resolves to the PyPI source tarball and stalls the build. llama-cpp-python==0.3.30 # ── Web Framework ───────────────────────────────────────────────────────────── flask>=3.0.0 flask-cors>=4.0.0 flask-limiter>=3.5.0 # ── LangChain — text splitting only (no community extras) ───────────────────── # langchain-community removed: not imported anywhere; adds aiohttp + SQLAlchemy. # langchain base removed: not directly imported; only sub-packages are used. langchain-core>=0.2.0,<2.0.0 langchain-text-splitters>=0.3.0,<2.0.0 # ── CrewAI (agent orchestration — ingest crew + LLM wrapper) ────────────────── crewai>=0.36.0,<2.0.0 # ── Embeddings — sentence-transformers (bge-small ~130 MB, pure Python) ─────── # Also provides CrossEncoder used for reranking in crew.py. sentence-transformers>=3.0.0 # ── Transformers (transitive dep of sentence-transformers, pure Python) ──────── transformers>=4.40.0 # ── HuggingFace Hub (model download in gen_llm.py + HfApi in app.py) ───────── huggingface-hub>=0.23.0 # ── Vector Database (embedded, pre-built manylinux wheel) ──────────────────── chromadb>=0.5.0 # ── Graph Database (embedded, pre-built cp312 wheel) ───────────────────────── kuzu>=0.11.3 # ── Hybrid Search (pure Python) ─────────────────────────────────────────────── rank-bm25>=0.2.2 # ── Document Loaders (all pre-built wheels or pure Python) ──────────────────── PyMuPDF>=1.24.0 python-docx>=1.1.0 openpyxl>=3.1.0 pandas>=2.0.0 pytesseract>=0.3.10 Pillow>=10.0.0 # ── Utilities ───────────────────────────────────────────────────────────────── requests>=2.31.0 python-dotenv>=1.0.0 tqdm>=4.66.0 numpy>=1.24.0 pydantic>=2.0.0 # ── Encryption (session key security via cryptography.fernet) ───────────────── cryptography>=41.0.0 # ── System monitoring (CPU/RAM banner in UI via psutil) ─────────────────────── psutil>=5.9.0 # ── NLP entity extraction (pre-built cp312 wheel + py3-none-any model) ──────── spacy>=3.7.0 en-core-web-sm @ https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.8.0/en_core_web_sm-3.8.0-py3-none-any.whl