Skip to main content

fabricatio-novel

MIT Python Versions PyPI Version PyPI Downloads PyPI Downloads Bindings: PyO3 Build Tool: uv + maturin

AI-powered novel generation — outline to publication-ready EPUB.

Installation

pip install fabricatio[novel]
# or
uv pip install fabricatio[novel]

For the CLI tool:

pip install fabricatio-novel[cli]

Pipeline

Novel generation runs as a five-stage sequential pipeline driven by Handlebars templates.

  1. Draft — Outline text → NovelDraft (title, genre, synopsis, chapter list, character descriptions, language detection)
  2. CharactersNovelDraftCharacterCard[] (one per described character)
  3. ScriptsNovelDraft + CharacterCard[]Script[] (batched; each script is a list of Scene objects with per-scene prompts and global writing guidance)
  4. ChaptersScript[] + CharacterCard[] → raw chapter text (sequential; each chapter receives a rolling ChapterSummary from the previous chapter for narrative continuity)
  5. Assembly — Components assembled into a Novel object; NovelBuilder (Rust/PyO3) produces the EPUB

An optional RAG variant (NovelComposeRAG) queries LanceDB for WritingStyleDocument entries and injects them into script-level global_prompt and scene-level prompt fields before chapter generation.

Key Classes

Models

Class Description
NovelDraft High-level novel plan: title, genre, synopsis, character descriptions, ordered ChapterDraft list, expected word count
ChapterDraft Per-chapter outline with title, detailed synopsis, and weight (for word-count allocation)
Script Sequence of Scene objects with a global_prompt for chapter-level writing guidance
Scene Basic narrative unit: narrative description, tone/style prompt, tags, weight
ChapterSummary Structured summary of a generated chapter — key events, character states, emotional arc, unresolved threads
ChapterPlan Bundles a ChapterDraft, its Script, and computed word count per chapter
Chapter Final chapter with XHTML content, zero-based index, and word count
Novel Collection of Chapter objects with aggregate word count and compliance ratio
WritingStyleDocument LanceDB-backed document for storing and retrieving writing style references
NovelConfig Frozen dataclass specifying built-in template names for all pipeline stages

Capabilities (Mixins)

Class Description
NovelCompose Full pipeline: create_draft, create_characters, create_scripts, create_chapters, summarize_chapter, assemble_novel, compose_novel
NovelComposeRAG Extends NovelCompose — fetches writing style docs from LanceDB and injects them into script/scene prompts before chapter generation

Actions (fabricatio-actions)

Class Description
GenerateNovelDraft Generate a NovelDraft from an outline
GenerateCharactersFromDraft Generate CharacterCard list from a draft
GenerateScriptsFromDraftsAndCharacters Generate Script list from draft + characters
GenerateChaptersFromScripts Generate chapter text sequentially from scripts + characters
AssembleNovelFromComponents Build final Novel from draft, plans, and chapter contents
ValidateNovel Validate chapter count, word count, and compliance ratio
GenerateNovel Run the full pipeline in one action
DumpNovel Serialize a Novel to disk as EPUB via NovelBuilder

Workflows (fabricatio-actions)

Workflow Description
WriteNovelWorkflow One-step outline → EPUB
DebugNovelWorkflow Step-by-step: draft → characters → scripts → chapters → validation → assembly → dump
GenerateOnlyCharactersWorkflow Draft → characters only, for iterating on character design
RewriteChaptersOnlyWorkflow Reuse existing scripts + characters to regenerate chapter prose
ValidatedNovelWorkflow Full pipeline with quality gates (min chapters, word count, compliance ratio)
RegenerateWithNewCharactersWorkflow A/B test character impact by re-running with fresh character generation
DumpOnlyWorkflow Export a pre-built Novel object to EPUB

Rust / PyO3

Symbol Description
NovelBuilder Builder for EPUB 3.0 novels: set title/description/authors, add chapters (auto-XHTML), cover images, fonts, CSS, inline TOC, export to file
text_to_xhtml_paragraphs Convert plain text with newline-separated paragraphs to <p>-wrapped XHTML

Usage

CLI

# Generate a novel from an outline
fanvl w -o "In a world where dreams are currency..."

# Generate with RAG writing style augmentation
fanvl wr -o "In a world where dreams are currency..." -rq "Hemingway terse prose style"

# Generate with mental state tracking (character psychology)
fanvl wm -o "In a world where dreams are currency..."

# Generate with RAG + mental state tracking
fanvl wrm -o "In a world where dreams are currency..." -rq "Hemingway terse prose style"

# Generate with mental state tracking + illustrations
fanvl wmi -o "In a world where dreams are currency..."

# Generate with RAG + mental state tracking + illustrations
fanvl wrmi -o "In a world where dreams are currency..." -rq "Hemingway terse prose style"

# Store reference texts as writing style documents in LanceDB
fanvl store-refs ./corpus/*.txt

Programmatic

from fabricatio_novel.workflows.novel import DebugNovelWorkflow
from fabricatio_core import Event

event = Event.instantiate("write")
event.payload["novel_outline"] = "In a world where dreams are currency..."
role = Role.with_bio(name="writer").subscribe(event, DebugNovelWorkflow).dispatch()

EPUB Builder (Rust)

from fabricatio_novel.rust import NovelBuilder, text_to_xhtml_paragraphs

xhtml = text_to_xhtml_paragraphs(raw_chapter_text)

builder = (
    NovelBuilder()
    .new_novel()
    .set_title("My Novel")
    .add_author("Author Name")
    .add_chapter("Chapter 1", xhtml)
    .add_inline_toc()
)

builder.export("output.epub")

Dependencies

  • fabricatio-core — Core interfaces, template management, LLM capabilities
  • fabricatio-character — Character generation and card models
  • pydantic — Data validation via models
  • Optional: fabricatio-lancedb — Writing style RAG, fabricatio-actions — workflow support, questionary + typer — CLI

License

MIT — see LICENSE

Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

fabricatio_novel-0.10.6-cp314-cp314-win_amd64.whl (2.4 MB view details)

Uploaded CPython 3.14Windows x86-64

fabricatio_novel-0.10.6-cp314-cp314-manylinux_2_34_x86_64.whl (2.6 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.34+ x86-64

fabricatio_novel-0.10.6-cp314-cp314-manylinux_2_34_aarch64.whl (2.3 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.34+ ARM64

fabricatio_novel-0.10.6-cp314-cp314-macosx_11_0_arm64.whl (2.2 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

fabricatio_novel-0.10.6-cp313-cp313-win_amd64.whl (2.4 MB view details)

Uploaded CPython 3.13Windows x86-64

fabricatio_novel-0.10.6-cp313-cp313-manylinux_2_34_x86_64.whl (2.6 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

fabricatio_novel-0.10.6-cp313-cp313-manylinux_2_34_aarch64.whl (2.3 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ ARM64

fabricatio_novel-0.10.6-cp313-cp313-macosx_11_0_arm64.whl (2.2 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

fabricatio_novel-0.10.6-cp312-cp312-win_amd64.whl (2.4 MB view details)

Uploaded CPython 3.12Windows x86-64

fabricatio_novel-0.10.6-cp312-cp312-manylinux_2_34_x86_64.whl (2.6 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

fabricatio_novel-0.10.6-cp312-cp312-manylinux_2_34_aarch64.whl (2.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ ARM64

fabricatio_novel-0.10.6-cp312-cp312-macosx_11_0_arm64.whl (2.2 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

Details for the file fabricatio_novel-0.10.6-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: fabricatio_novel-0.10.6-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 2.4 MB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.31 {"installer":{"name":"uv","version":"0.11.31","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fabricatio_novel-0.10.6-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 512acebc1e28394cd9db67db2b1313d059b14a8bc15ea096c5db794ab2237a5e
MD5 50fc47efad911381b66e39d783965f95
BLAKE2b-256 b353592fc6f693119d86ae7c9c80a72c7dc866cd18622452e02e467b7b7310b7

See more details on using hashes here.

File details

Details for the file fabricatio_novel-0.10.6-cp314-cp314-manylinux_2_34_x86_64.whl.

File metadata

  • Download URL: fabricatio_novel-0.10.6-cp314-cp314-manylinux_2_34_x86_64.whl
  • Upload date:
  • Size: 2.6 MB
  • Tags: CPython 3.14, manylinux: glibc 2.34+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.31 {"installer":{"name":"uv","version":"0.11.31","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fabricatio_novel-0.10.6-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 cc7104cd6fb08734660f278e9eb2ebe6f548f8daf88be620609f49fdcf3ec732
MD5 fb80da6479821651ddcb5433fb7b343b
BLAKE2b-256 0093eec20ed2dea32d98c3537ec49768f55a1a238cd24a36daf8210dc955024b

See more details on using hashes here.

File details

Details for the file fabricatio_novel-0.10.6-cp314-cp314-manylinux_2_34_aarch64.whl.

File metadata

  • Download URL: fabricatio_novel-0.10.6-cp314-cp314-manylinux_2_34_aarch64.whl
  • Upload date:
  • Size: 2.3 MB
  • Tags: CPython 3.14, manylinux: glibc 2.34+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.31 {"installer":{"name":"uv","version":"0.11.31","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fabricatio_novel-0.10.6-cp314-cp314-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 cbbdf0c69b2a1f40040b2affe14f124251981b4bb2b45d6aadd49d9312f58f0a
MD5 1b6c259046a888045030dc455db6844c
BLAKE2b-256 9011e47c899b2e4739f93bc726a9e799e65ee0c0bbc4b5dc6386742aac95acce

See more details on using hashes here.

File details

Details for the file fabricatio_novel-0.10.6-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

  • Download URL: fabricatio_novel-0.10.6-cp314-cp314-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 2.2 MB
  • Tags: CPython 3.14, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.31 {"installer":{"name":"uv","version":"0.11.31","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fabricatio_novel-0.10.6-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 722e993231ecec4d1cfbd2d99fcf600a4afd54071a0cfe81e44a697089206789
MD5 b6c38a0d59ff2c58816803d646c9ccc1
BLAKE2b-256 454026a6580df57cffa4b4e385cd39a3afed034e430e5cc826848eb810855ab9

See more details on using hashes here.

File details

Details for the file fabricatio_novel-0.10.6-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: fabricatio_novel-0.10.6-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 2.4 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.31 {"installer":{"name":"uv","version":"0.11.31","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fabricatio_novel-0.10.6-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 e66eaa5fb7cc48c01ddecbf76d120ef383e06dc9b563847ad0ab9e8b575509a9
MD5 219f3304825f035060a7bdfa5b711d1f
BLAKE2b-256 087d0780e51ef2306773c23b322b01acb4dbdbbf7b41efbc8f30524c42e6ef16

See more details on using hashes here.

File details

Details for the file fabricatio_novel-0.10.6-cp313-cp313-manylinux_2_34_x86_64.whl.

File metadata

  • Download URL: fabricatio_novel-0.10.6-cp313-cp313-manylinux_2_34_x86_64.whl
  • Upload date:
  • Size: 2.6 MB
  • Tags: CPython 3.13, manylinux: glibc 2.34+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.31 {"installer":{"name":"uv","version":"0.11.31","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fabricatio_novel-0.10.6-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 629a311351586ddae27f8cfc2ae486d97357832023ebf84dc26ad13634edc629
MD5 8069a4d6c93661ac74b9847af1254ddd
BLAKE2b-256 aa765462e3e458b11b4a6315e026f27ad61271418388eb6b6f8e8cfd0ffd565e

See more details on using hashes here.

File details

Details for the file fabricatio_novel-0.10.6-cp313-cp313-manylinux_2_34_aarch64.whl.

File metadata

  • Download URL: fabricatio_novel-0.10.6-cp313-cp313-manylinux_2_34_aarch64.whl
  • Upload date:
  • Size: 2.3 MB
  • Tags: CPython 3.13, manylinux: glibc 2.34+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.31 {"installer":{"name":"uv","version":"0.11.31","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fabricatio_novel-0.10.6-cp313-cp313-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 8fc046c8da47cda31d3d883d6584df0e4e83dea5e21a636409263e5be93a94d6
MD5 8bf69280e5e11f03866b82b638e3f4d0
BLAKE2b-256 c11268fc7a6381e05d725ba8c9374d8d6951ab890fed119cd06adf2718df5226

See more details on using hashes here.

File details

Details for the file fabricatio_novel-0.10.6-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

  • Download URL: fabricatio_novel-0.10.6-cp313-cp313-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 2.2 MB
  • Tags: CPython 3.13, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.31 {"installer":{"name":"uv","version":"0.11.31","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fabricatio_novel-0.10.6-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ae7a53d3218f6489008fcf79fcd051163f75dc01628f1cc723f7f80229d40da3
MD5 7caf144e6ba2856a8e62768094e88d23
BLAKE2b-256 3cb40a8b01b3342eefe8da72b4bdebbdd50e1a41c2a6d96daa9ac526eac7b9b7

See more details on using hashes here.

File details

Details for the file fabricatio_novel-0.10.6-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: fabricatio_novel-0.10.6-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 2.4 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.31 {"installer":{"name":"uv","version":"0.11.31","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fabricatio_novel-0.10.6-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 6c2cde5d440eca458859b421c677ffb92bf06c92265125581628ffe635ab0fb0
MD5 8a6b1cad594802607577d6d14d458aa6
BLAKE2b-256 2e894489681510a7252b5aa79f7d4810019d8e00939a48b522f5699fbb834e88

See more details on using hashes here.

File details

Details for the file fabricatio_novel-0.10.6-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

  • Download URL: fabricatio_novel-0.10.6-cp312-cp312-manylinux_2_34_x86_64.whl
  • Upload date:
  • Size: 2.6 MB
  • Tags: CPython 3.12, manylinux: glibc 2.34+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.31 {"installer":{"name":"uv","version":"0.11.31","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fabricatio_novel-0.10.6-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 e4a152d938b2228bc6700b37c53d38996d9a5a00a6380d937bb918daee552ab7
MD5 b456c50eedb69876418371b312efc299
BLAKE2b-256 7be9ce179160ac0cf001cbc4b62a9f51d64b01c6f24e3d692da27493088cd376

See more details on using hashes here.

File details

Details for the file fabricatio_novel-0.10.6-cp312-cp312-manylinux_2_34_aarch64.whl.

File metadata

  • Download URL: fabricatio_novel-0.10.6-cp312-cp312-manylinux_2_34_aarch64.whl
  • Upload date:
  • Size: 2.3 MB
  • Tags: CPython 3.12, manylinux: glibc 2.34+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.31 {"installer":{"name":"uv","version":"0.11.31","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fabricatio_novel-0.10.6-cp312-cp312-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 7c8fd4a165a1dc09dee4221b1288cbb162be022e0ff3a6457df17a956e354321
MD5 ebc98162bddc494b4248e5c47442039f
BLAKE2b-256 72d5d6607c5a2f8e23abc4a4ef440927b85745ceb996489b319389205ee0c678

See more details on using hashes here.

File details

Details for the file fabricatio_novel-0.10.6-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

  • Download URL: fabricatio_novel-0.10.6-cp312-cp312-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 2.2 MB
  • Tags: CPython 3.12, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.31 {"installer":{"name":"uv","version":"0.11.31","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fabricatio_novel-0.10.6-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1dad280260129fe6c5014fb80b4c87d1da4970e1e76cd24ad55af3ed86f80c78
MD5 675a4ba7ec1727001d71c5c2be775dd4
BLAKE2b-256 f862d652c01a67bf6bd6350157023fe9a0a62d4577e515c0d442912e21b99b3e

See more details on using hashes here.

Release history Release notifications | RSS feed

0.21.1

12 files

0.21.0

12 files

0.14.0

12 files

0.11.6

12 files

0.11.4

12 files

0.11.2

12 files

This release

0.10.6 This release

12 files

0.10.3

12 files

0.10.2

12 files

0.8.0

12 files

0.7.0

12 files

0.6.0

12 files

0.5.0

12 files

0.4.1

12 files

0.4.0

12 files

0.3.3

11 files

0.3.2

12 files

0.3.1

12 files

0.3.0

12 files

0.2.0

12 files

0.1.10

12 files

0.1.9

12 files

0.1.8

12 files

0.1.7

12 files

0.1.6

12 files

0.1.5

12 files

0.1.4

12 files

0.1.3

8 files

0.1.2

8 files

0.1.1

8 files

Supported by

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