Skip to main content

DocuMind SDK - lightweight AI document generation for PPTX, DOCX, Markdown, XLSX, and HWPX

Project description

DocuMind SDK

Korean: README.ko.md

Lightweight Python SDK for AI document generation.

Install documind when you want to generate native document files directly from Python.

Installation

pip install documind

Provider integration dependencies for OpenAI, Bedrock, Anthropic, Gemini, and Vertex AI are included in the default installation.

Quick Start

import asyncio
from documind import generate_document, init

init(
    llm_provider="openai",
    openai_api_key="sk-...",
    default_llm_model="gpt-4o",
    storage_local_path="./outputs",
)

async def main():
    result = await generate_document(
        query="Create an AI document automation proposal.",
        document_type="pptx",
        locale="en",
    )
    print(result.output_path)

asyncio.run(main())

SDK API Reference

Public imports:

from documind import (
    DocuMind,
    GenerationRequest,
    GenerationResult,
    ImageAttachment,
    TemplateInput,
    configure,
    generate_document,
    init,
    stream_document,
)

Engine Configuration

Use init(**config) for process-wide defaults, or pass the same values to DocuMind(...) for one engine instance.

Option Type / Example Description
llm_provider "openai" Provider route. Supported values include openai, anthropic, azure, bedrock, gcp_vertex, gemini, ollama, vllm, custom.
use_default_models True If true, agents use the default model names below.
default_llm_model "gpt-4o" Text generation model.
default_vlm_model "gpt-4o" Accepted for vision-model compatibility.
default_image_model "dall-e-3" Image asset model. If unavailable, generation continues without image assets.
storage_local_path "./outputs" Output directory for generated documents, HTML previews, and image assets.
log_level / log_file "INFO" / path Logging controls.
openai_api_key "sk-..." OpenAI credential.
openai_base_url URL OpenAI-compatible endpoint override.
anthropic_api_key string Anthropic credential.
google_api_key string Gemini API key.
gcp_project_id, gcp_location, google_application_credentials strings Vertex AI settings.
aws_profile, aws_region, aws_access_key_id, aws_secret_access_key, aws_session_token, aws_role_arn strings Bedrock settings.
azure_openai_api_key, azure_openai_endpoint, azure_openai_api_version, azure_openai_deployment strings Azure OpenAI settings.
custom_llm_base_url, custom_llm_api_key, custom_llm_model_name strings OpenAI-compatible custom provider settings.
preload_icons False Optional icon asset warm-up.
icon_preload_limit integer Optional icon warm-up limit.

Document Generation

generate_document(...) is the simplest one-shot helper. For repeated calls, create DocuMind(...) once and call engine.generate(...).

from documind import DocuMind, ImageAttachment, TemplateInput

engine = DocuMind(
    llm_provider="openai",
    openai_api_key="sk-...",
    storage_local_path="./outputs",
)

result = await engine.generate(
    query="Create a customer onboarding deck.",
    format="pptx",
    locale="en",
    template=TemplateInput(path="./template.pptx"),
    images=[
        ImageAttachment(path="./product.png", description="Product screenshot"),
    ],
    needs_research=False,
)
Argument Type / Default Description
query required string Natural-language document goal.
format "pptx" Output format for engine.generate. One of pptx, docx, xlsx, md, hwp.
document_type optional Alias for format; useful when adapting external input models.
template_id optional string Compatibility hook for template identifiers.
template path, bytes, dict, TemplateInput Optional native/template file.
images list of paths, bytes, dicts, ImageAttachment Optional image evidence for planning and visual references.
session_id optional string Caller-provided correlation/session ID.
locale "ko" Locale hint. Output language is also inferred from query.
needs_research None True forces research, False skips it, None lets DocuMind infer intent.
preload_icons optional bool Per-call icon warm-up toggle.
**options dict Forward-compatible pipeline options. Stable SDK callers should prefer the explicit arguments above.

Structured Input

from documind import GenerationRequest

generation_input = GenerationRequest(
    query="Create a weekly report.",
    document_type="docx",
    locale="en",
    needs_research=False,
    options={"template_id": "internal-template-id"},
)

result = await engine.generate_from_request(generation_input)
GenerationRequest field Type / Default Description
query required string Natural-language document goal.
document_type "pptx" pptx, docx, xlsx, md, or hwp.
template None Path, bytes, dict, or TemplateInput.
images [] Image evidence list.
session_id None Correlation/session ID.
locale "ko" Locale hint.
needs_research None Research routing toggle.
stream False Streaming marker for external adapters. Use generate_stream for SDK streaming.
options {} Additional pipeline options, including template_id.
Helper type Fields
TemplateInput path, content, filename
ImageAttachment path, content, filename, mime_type, role="content_reference", description

GenerationResult exposes success, output_path, output_bytes, document_type, mime_type, fidelity_scores, slide_count, errors, metadata, and to_dict().

Supported Formats

Format Output
pptx Native PowerPoint file
docx Native Word file
xlsx Native Excel workbook
md Markdown document
hwp HWPX document

Streaming

from documind import DocuMind, GenerationRequest

engine = DocuMind(llm_provider="openai", openai_api_key="sk-...")
generation_input = GenerationRequest(query="Create a weekly report.", document_type="docx")

async for event in engine.generate_stream(generation_input):
    print(event.to_sse())

Build From Source

cd packages/documind
python scripts/sync_runtime.py
python -m build

Publishing instructions are in PUBLISHING.md and PUBLISHING.ko.md.

License

Apache-2.0

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

documind-0.2.1.tar.gz (250.8 kB view details)

Uploaded Source

Built Distribution

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

documind-0.2.1-py3-none-any.whl (270.2 kB view details)

Uploaded Python 3

File details

Details for the file documind-0.2.1.tar.gz.

File metadata

  • Download URL: documind-0.2.1.tar.gz
  • Upload date:
  • Size: 250.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for documind-0.2.1.tar.gz
Algorithm Hash digest
SHA256 63e5f044e3547052085ee5fa8bbfbc9f9c5d3f04a654b514a29b04dc5db96516
MD5 66823492ee8d5fcb0c2d0ed55e4f9a9a
BLAKE2b-256 12fd2401c4deb79d5d6eb6c430413b708a7038c61a80f9c14a01c63d45d9b4fb

See more details on using hashes here.

File details

Details for the file documind-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: documind-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 270.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for documind-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d950ae6f78a493556f150b85a55212b78c1b82f0935fd7e57d7132ae3b585241
MD5 96733ea83d87e0c6836ef110ff5de1fb
BLAKE2b-256 311fec116ab4b77fc797a2297a1588dc05b959690c720c1e4c250dc84c660aa1

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