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, character knowledge, numerical stats, emotional arc, unresolved threads, resolved threads, established facts, last scene
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, compliance ratio, and export_chapters_as_texts() for per-chapter text file export
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")

Text Export

from pathlib import Path
from fabricatio_novel.models.novel import Novel

# Export each chapter as chapter-{index}.txt with a metadata.json file.
novel.dump_artifacts("./novel-text")
# → ./novel-text/chapter-0.txt
# → ./novel-text/chapter-1.txt
# → ./novel-text/metadata.json

Each .txt file starts with the chapter title, a blank line, then the chapter content. metadata.json contains the novel title, synopsis, and chapter listing with filenames.

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.11.6-cp314-cp314-win_amd64.whl (2.4 MB view details)

Uploaded CPython 3.14Windows x86-64

fabricatio_novel-0.11.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.11.6-cp314-cp314-manylinux_2_34_aarch64.whl (2.3 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.34+ ARM64

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

Uploaded CPython 3.14macOS 11.0+ ARM64

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

Uploaded CPython 3.13Windows x86-64

fabricatio_novel-0.11.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.11.6-cp313-cp313-manylinux_2_34_aarch64.whl (2.3 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ ARM64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

fabricatio_novel-0.11.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.11.6-cp312-cp312-manylinux_2_34_aarch64.whl (2.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ ARM64

fabricatio_novel-0.11.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.11.6-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: fabricatio_novel-0.11.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.12.1 {"installer":{"name":"uv","version":"0.12.1","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.11.6-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 1b94d47039ed299c505ea5edd7e91fe0753c8371b440063b1a2233da8f614a79
MD5 bfed07caf6ed6d4bd6693e8ff3b12e31
BLAKE2b-256 e493ed41d21fba15af4f6aa1579dd63eb916d386e6854d9d8ebb029d04662299

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_novel-0.11.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.12.1 {"installer":{"name":"uv","version":"0.12.1","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.11.6-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 a66a46da12ce227a47c4c7b00e0ec07096899bdd1160b17e4501e85ae695becf
MD5 6dad982bae5580cf2f45b7d395893e7c
BLAKE2b-256 49afa8ceb855a31b230ce43265a6af90e1c37acc4a4a3d1538708620d35eb880

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_novel-0.11.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.12.1 {"installer":{"name":"uv","version":"0.12.1","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.11.6-cp314-cp314-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 bdb1842253642648e67e54d1e28d18aaa92b6812988860fa9c3634be26481eea
MD5 565113f827aee044e372cf30f9f1ecc8
BLAKE2b-256 6992ba5bf2d6628fb398ac29204fb7b3a7ca858834dd98518a825bf7005c3ce2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_novel-0.11.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.12.1 {"installer":{"name":"uv","version":"0.12.1","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.11.6-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 232127e6b7af1477ba5a62e21a97a366519c86886db3684226d8076f6745f8f6
MD5 ea1bbe6eeb8585261635785b35259ee0
BLAKE2b-256 da00ccd79b146d4fdb28b9d87074b0cc6a600eea7cc4fd2894cd1756b01d5614

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_novel-0.11.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.12.1 {"installer":{"name":"uv","version":"0.12.1","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.11.6-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 b05e7319fd4d8a550b49b46eba7cb8840e22cd7c688443bc2e9fea92481f5ee6
MD5 19906243182057bf09bf1cd97538f404
BLAKE2b-256 ac93ddde37ac9959ad0bb3817ae8e3ae75ff8d1dd2022320986f84c2d7bd4b40

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_novel-0.11.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.12.1 {"installer":{"name":"uv","version":"0.12.1","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.11.6-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 26c41d7564b562f130694914d17352e7c0f09ad9a45e542ce274dcb527f57692
MD5 2f4da919da3993c0c359442c3dcb1b70
BLAKE2b-256 c5d27399623629303e7b4114baf6c3dc4f3bb0315c88408879700f39de010d30

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_novel-0.11.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.12.1 {"installer":{"name":"uv","version":"0.12.1","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.11.6-cp313-cp313-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 cf2dd6d5cfc3954d91dba61f857d90bc965bcf7da879296a2c03009d557dc2ab
MD5 a21aee22b9e86712a13ab7c60834032a
BLAKE2b-256 2ba4b593dec59333ad964f7cb3cb3bd5101f7be0ec80cbb3ad32f7eaecb81961

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_novel-0.11.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.12.1 {"installer":{"name":"uv","version":"0.12.1","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.11.6-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b3007787c521780392abf5275249596662f02bfa43d93449e0b1f92ea2fd8780
MD5 1dead5be54cfe318bce0724d7deefc12
BLAKE2b-256 4bf40d5aa51ea8fd08df9c56005afb8b1b5091e25854de76f8ee7bf9440a99a4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_novel-0.11.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.12.1 {"installer":{"name":"uv","version":"0.12.1","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.11.6-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 3aab08155bdc4750dc9919830a4000dd0d7b95a93de128d2fb91c4082a76fad9
MD5 9d4a7f23a873f871485fa2b162847514
BLAKE2b-256 667d11796f7e07d16278c7eaaa16aa70c9e0a002d1525fc7d3b5ba1f0b9ab9cc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_novel-0.11.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.12.1 {"installer":{"name":"uv","version":"0.12.1","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.11.6-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 cc5365667edc3def7d0e9a039edbcd390115f1f691d12aa78e95cc29cf6d0038
MD5 21e71e6e5f58fd4b5784b0a21aef53f3
BLAKE2b-256 89e637e746181672dffd9dcd16d92befc91ad244ebca48d107aa7544977d9991

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_novel-0.11.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.12.1 {"installer":{"name":"uv","version":"0.12.1","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.11.6-cp312-cp312-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 a30ab30258787e0b961ff7888f23170deafd808690c1bc7e2a43f6f030734bff
MD5 def6c8204af94fc865f47e6059accdfa
BLAKE2b-256 b0d004061a6f7dc20054301369d863716408dd8201534a2eeb05f35979b3659b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_novel-0.11.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.12.1 {"installer":{"name":"uv","version":"0.12.1","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.11.6-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b82903ca8fd50040b71c16f6ede0dcf80753c124f10a5894e23ae5aaa9ea0327
MD5 9f950c17b8527942b26e93c836415b7b
BLAKE2b-256 0d49ce339d9bca05f2a5922d0889b403f80df48f036cbdf1be421b03667ee945

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

This release

0.11.6 This release

12 files

0.11.4

12 files

0.11.2

12 files

0.10.6

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