Skip to main content

Docling → Chroma → Ollama: Simple RAG pipeline

Project description

📄 DocRAG LLM

check out my python library at pypi https://pypi.org/project/docrag-llm/#description

pip install docrag-llm

DocRAG LLM is a simple, Retrieval-Augmented Generation (RAG) pipeline.
It connects Docling (document parsing) → ChromaDB (vector store) → Ollama (local LLMs) into a single workflow, with both a CLI and a Python API.


✨ Features

  • 🔍 Parse documents with Docling (PDF, DOCX, PPTX, HTML, etc.).
  • 📑 Chunk text intelligently for retrieval.
  • 🧠 Store embeddings in ChromaDB.
  • 🤖 Answer questions using Ollama (default: llama3.2:1b).
  • 🛡️ Designed for local execution (no cloud lock-in).
  • 🖥️ Works both as a CLI tool and a Python library.

📦 Installation

pip install docrag-llm

Requirements

  • Python 3.10+
  • Ollama installed and running
  • Models pulled locally:
    ollama pull llama3.2:1b --or any other model you prefer from Ollama
    ollama pull nomic-embed-text
    

🚀 Quickstart (CLI)

Ingest a document into Chroma

--uses all defaults

python -m docrag.cli ingest https://arxiv.org/pdf/2508.20755 
  • --persist → directory for Chroma DB (default: ./.chroma) Default no need to change
  • --embed → embedding model (default: nomic-embed-text) Default embed model
  • --collection → logical collection name (default: demo)
  • to specify new collection add the following --collection and name of your collection if not goes to default

Ask a question (default LLM = llama3.2:1b) you can choose depending on what you download as models

Llama3.2:1b was chosen because of it's small size

python -m docrag.cli ask "Summerize in one paragraph and give me 5 bullets points of the main ideas"   
  • --llm → LLM model to use (default: llama3.2:1b)
  • --top-k → number of chunks retrieved (default: 5)
  • --persist → directory for Chroma DB (default: ./.chroma)
  • --collection → logical collection name (default: demo)
  • --embed → embedding model (default: nomic-embed-text)

Export parsed text

python -m docrag.cli export https://arxiv.org/pdf/2508.20755   --out-dir ./exports

Saves parsed text (Markdown/JSON).


CLI Help

python -m docrag.cli --help
python -m docrag.cli ingest --help
python -m docrag.cli ask --help
python -m docrag.cli export --help

🐍 Usage as a Python Library

from docrag import DocragSettings, RAGPipeline

# Configure pipeline
cfg = DocragSettings(
    persist_path="./.chroma",
    collection="demo",
    embed_model="nomic-embed-text",
    llm_model="llama3.2:1b",
)

pipeline = RAGPipeline(cfg)

# Ingest a document
n_chunks = pipeline.ingest("https://arxiv.org/pdf/2508.20755")
print(f"Ingested {n_chunks} chunks")

# Ask a question
answer = pipeline.ask("Give a concise bullet summary of the paper's main contributions.")
print(answer)

⚙️ Configuration

Both the Python API and CLI allow controlling:

  • persist_path → path to Chroma DB
  • collection → collection name
  • embed_model → embedding model (Ollama tag)
  • llm_model → LLM model (default: llama3.2:1b)
  • chunk_chars / chunk_overlap → chunking granularity

📊 Roadmap

  • Add model-check CLI command to list installed Ollama models.
  • Support multiple backends (Weaviate, Milvus).
  • Add streaming output for long answers.
  • Expand test suite with large document regression cases.

🤝 Contributing

PRs and issues welcome! Please run lint and tests before submitting:

ruff check .
pytest

📜 License

MIT License © 2025

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

docrag_llm-0.1.23.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

docrag_llm-0.1.23-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file docrag_llm-0.1.23.tar.gz.

File metadata

  • Download URL: docrag_llm-0.1.23.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for docrag_llm-0.1.23.tar.gz
Algorithm Hash digest
SHA256 31cde95afd0d1dce664b8ff41cc8a9f0b27b42b42261c9ad08d5669323462e34
MD5 96629b5982180a80250839a31a9da1f8
BLAKE2b-256 9f112eb0488caafba9bb118a2f6c0b84f4ad4bfd4bd499c28a571f25da60dfec

See more details on using hashes here.

File details

Details for the file docrag_llm-0.1.23-py3-none-any.whl.

File metadata

  • Download URL: docrag_llm-0.1.23-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for docrag_llm-0.1.23-py3-none-any.whl
Algorithm Hash digest
SHA256 9b07fedf2fd2d20fa9794418b9768df1eac698ff1d01d0fafb99cd77b4e531c5
MD5 4a65fd0906eea5d9c27f20422df2242e
BLAKE2b-256 da78e4bb847e00a2b4437589ec640783c8764ff0597443241ea3eccf6d83d805

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page