This project is part of projectai token system of AI Blockchain Contract series of RanchiMall. A blockchain contract is a governance structure on the blockchain which enables human led supervision over blockchain projects, as opposed to Corporate incorporation in traditional businesses and purely automated Smartcontracts in DAOs (Distributed Autonomous Organisation). Funding for Blockchain Contract comes directly on blockchain.
Generate templated PowerPoint decks or PDF reports from a local Chroma DB collection. One CLI, one template naming scheme — the format (pptx vs pdf) is determined automatically by which template you pick.
pip install -r requirements.txt# See available designs (shows format next to each)
python main.py --list-templates
# deck_corporate (pptx)
# deck_playful (pptx)
# report_modern (pdf)
# report_minimal (pdf)
# Generate a slide deck
python main.py \
--query "quarterly sales trends" \
--collection my_docs \
--template deck_corporate \
--title "Q2 Sales Review" \
--out q2_review.pptx
# Generate a PDF report — same command, just a different --template
python main.py \
--query "quarterly sales trends" \
--collection my_docs \
--template report_modern \
--title "Q2 Sales Review" \
--out q2_review.pdfIf --out is omitted, output defaults to output.pptx or output.pdf
based on the template's format.
-
data/chroma_query.pyqueries your Chroma collection and normalizes each hit into aContentItem(text, title, optional image_path(s), source). -
engine/image_resolver.pyresolves image_path (local or remote) to a usable file, or returns None so the layout falls back to text-only. -
engine/template_loader.pyloads a YAML design config fromtemplates/pptx/ortemplates/pdf/by name — it searches both, so you don't need to know a template's format in advance. -
engine/layout_selector.pypicks a layout per content item based on content signals, shared by both renderers so pptx and pdf output use identical layout logic:- 2+ images ->
image_grid - quoted text ->
quote - short + numeric ->
stat_callout - multi-line / semicolon-separated ->
bulleted_list - 1 image, short caption ->
full_bleed_image - 1 image, longer text ->
two_column_image - otherwise ->
text_block
Priority: explicit
ContentItem.layoutoverride > template'slayout_sequence(forces a fixed rotation) > content heuristics. - 2+ images ->
-
engine/pptx_renderer.py(python-pptx) orengine/pdf_renderer.py(reportlab canvas) draws each item using its chosen layout.
Copy a file in templates/pptx/ or templates/pdf/, change the theme
values, give it a new filename — it's immediately selectable via
--template <name>. No code changes needed for palette/font changes.
Template schema:
name: my_template
engine: pptx # or pdf — determines which renderer is used
theme:
primary_color: "1E2761"
secondary_color: "CADCFC"
background: "FFFFFF"
text_color: "212121"
muted_color: "6E6E6E"
on_primary: "FFFFFF"
font_header: "Cambria" # pdf templates use reportlab base fonts,
font_body: "Calibri" # e.g. Helvetica, Helvetica-Bold, Times-Roman
# pdf-only:
# page_size: LETTER # or A4
# margin_inches: 0.75For images to appear automatically, store an image_path field (and
optionally image_paths for multiple) in each document's metadata when
you ingest into Chroma:
collection.add(
documents=[...],
metadatas=[{"title": "...", "image_path": "https://...", "source": "..."}],
ids=[...],
)Write a _layout_<name>(...) function in both pptx_renderer.py and
pdf_renderer.py, register it in each file's LAYOUT_REGISTRY, and (if
it should be picked automatically) add the trigger condition to
engine/layout_selector.py.