unsloth/studio/backend/requirements/studio.txt
danielhanchen 3851a543d8 Studio: contained chat document extraction with fast adaptive parsing
Adds document extraction to the chat composer with a small footprint that
reuses the existing RAG preview UI and is fast by default.

Backend
- Adaptive PDF extraction: born-digital pages produce layout-aware Markdown
  via pymupdf4llm and render no page images, so a text PDF issues no VLM
  calls. Only pages without a text layer are detected as scanned and
  rendered for OCR.
- Scanned pages are transcribed (not summarized) through the already loaded
  vision model over /v1/chat/completions. No dedicated OCR model is loaded
  and the chat model is never swapped out.
- Adaptive render DPI (120, env override) and bounded async caption
  concurrency (2 local, 3 gguf, env override).
- /chat/document-support and /chat/extract-document endpoints with NDJSON
  streaming progress, cancellation, multipart size guards, and token-budget
  truncation.

Frontend
- Reuses the existing RAG DocumentPreviewSheet and MarkdownPreview to render
  an extracted document inline (a new markdown preview target), instead of a
  separate preview panel.
- Extraction uses whatever model is loaded; there is no OCR model picker,
  cross-tab lock, or custom-code consent step.
- Compact document chips in the composer and transcript; image data is
  stripped from persisted attachments.
- Document settings expose a mode (fast text, auto, scanned), a caption
  toggle, a token budget, and concurrency. Unknown settings keys are ignored.

Adds backend tests for the adaptive path, the support probe, NDJSON
streaming, cancellation, error mapping, and the scanned-page dedup.
2026-06-25 12:28:33 +00:00

35 lines
1.1 KiB
Text

# Studio UI backend dependencies
typer
fastapi
uvicorn
pydantic
packaging
matplotlib==3.10.9
pandas
nest_asyncio
datasets==4.3.0
pyjwt
# gradio>=4.0.0 # 148 MB - Studio uses React + FastAPI, not Gradio
huggingface-hub==0.36.2
structlog>=24.1.0
diceware
ddgs
pypdf>=6.0.0,<7
python-multipart>=0.0.26
# Document extraction relies on pymupdf4llm 1.27+ (installed via
# data-designer-deps.txt), which pulls pymupdf-layout. The bundled ONNX
# models work fine on modern onnxruntime; we require >=1.19 because
# earlier wheels (e.g. 1.17.x) were built against NumPy 1.x and crash
# on import in venvs that have NumPy 2.x installed (pymupdf.layout ->
# onnxruntime -> numpy._multiarray_umath ABI mismatch). Verified
# end-to-end with onnxruntime 1.25.0 + numpy 2.4.x.
onnxruntime>=1.19
cryptography>=42.0.0
boto3>=1.34.0 # optional: S3 dataset loading
httpx>=0.27.0
fastmcp>=3.0.2
# RAG (knowledge bases, hybrid retrieval). sentence-transformers lives in
# extras-no-deps.txt; these add the lexical+dense store and document parsing.
sqlite-vec==0.1.9
pymupdf==1.27.2.3
python-docx==1.2.0