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

Uploaded CPython 3.14Windows x86-64

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

Uploaded CPython 3.14manylinux: glibc 2.34+ ARM64

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

Uploaded CPython 3.14macOS 11.0+ ARM64

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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13manylinux: glibc 2.34+ ARM64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12manylinux: glibc 2.34+ ARM64

fabricatio_novel-0.11.4-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.4-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: fabricatio_novel-0.11.4-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.0 {"installer":{"name":"uv","version":"0.12.0","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.4-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 65befc5beaf965b22f9c17481aa29efb049e5c5a54aba01536b8fb4668cf8e94
MD5 fc8cd49f7e02ea3c297dce8ecad17274
BLAKE2b-256 56949bb586aed6e411d47e0cf0cc4dc0b2f1e0e8108fa65d6bf44ab55f81cd7f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_novel-0.11.4-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.0 {"installer":{"name":"uv","version":"0.12.0","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.4-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 c816fec22db1542abc495c7de2c0cafc85085d745f5b6c6347637e04228fbc65
MD5 d3d1f45c5bed297de66b6b80e4a1bfbd
BLAKE2b-256 8b0b426dedc5f823e0c136541c346845b63dd54c03f48f9dae2298bc891bc187

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_novel-0.11.4-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.0 {"installer":{"name":"uv","version":"0.12.0","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.4-cp314-cp314-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 da14eef8b9639e425c3c1619e03d1667657a026b956830f6d90c5348f5ab3e49
MD5 b82f4ff83417bde71671aba4c03a5be7
BLAKE2b-256 e9ee245b126cdd3e21750efc8d6d3a8669b6192c237ea15666b1f8350b26079b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_novel-0.11.4-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.0 {"installer":{"name":"uv","version":"0.12.0","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.4-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 811c40ca91515af7464949df0b5bd8a2340036484c77df437d75469e934d565a
MD5 bdcab9c3ab1088d64a3880745b558a50
BLAKE2b-256 530854813f8d6be01c3e3746262e388d929a0c76567135a72e9658e9330c9a15

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_novel-0.11.4-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.0 {"installer":{"name":"uv","version":"0.12.0","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.4-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 4df9a5fb5b2dfaaf6cf5f3efd99f9e9ff51e2d13873a33bad49100dc0e570e24
MD5 c33215633288bb5de4b93c1dd661892c
BLAKE2b-256 71e8d59005eb0fe995629894b1c05287c8f2ba75f4990ee6b755a36919bc7c51

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_novel-0.11.4-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.0 {"installer":{"name":"uv","version":"0.12.0","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.4-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 4ab3671aac057097765ec9185e625eae844c34d2dc619ef29a659594ccb204d6
MD5 ebdd401db041eb91f4ccb02bbbc3adea
BLAKE2b-256 99361d6a11ad46fd3a535f6a54cdc46b1e68c16a4886910ca795889ae26cb310

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_novel-0.11.4-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.0 {"installer":{"name":"uv","version":"0.12.0","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.4-cp313-cp313-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 9563ff685704aaa791381d9d282f8ac9a4f80994fe33d8832389b82c83edd0e0
MD5 4cf25fa7ffdcd1f317517b778199887b
BLAKE2b-256 976bd847280f22698a025fe942263626745267fa9365151d58dbfdefe4cdb2d2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_novel-0.11.4-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.0 {"installer":{"name":"uv","version":"0.12.0","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.4-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 931065dd48612c8ccee9c33c905968f1bed3fc5794621e17c6d0f181263bc287
MD5 49655fa921acaadd30927ee8ca8c3368
BLAKE2b-256 bb6a7c4472d411ffa4d74a89cbe152587a01ce84b5175bacf3320884a0087f1d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_novel-0.11.4-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.0 {"installer":{"name":"uv","version":"0.12.0","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.4-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 98cb34c6da192f684a82abc828f1cc4c6057df70737780a2dd1ee8054e70d5ae
MD5 c69a7325a6cf933ae487ccb402a451e2
BLAKE2b-256 ae77d33850778c4e9e4f50eb05a490459d5040b87df23ba31557ef3c29a361c7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_novel-0.11.4-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.0 {"installer":{"name":"uv","version":"0.12.0","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.4-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 5492955bd2040dd24528aa6e1b8f834cfea3aeea1f0d3153b1736cf79b5a979b
MD5 9b013de1a792921b688167b330cdf82a
BLAKE2b-256 97251261249be0d1ee7f319a242c1f881e0a4dc3ff22a5ebeda2bc5101810f10

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_novel-0.11.4-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.0 {"installer":{"name":"uv","version":"0.12.0","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.4-cp312-cp312-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 e85a0a8a7b5479a4791311dbd8ef76c1eebf6d2d70f2c3f77ca05d376f707080
MD5 9294af2558bad0545776913f089aa441
BLAKE2b-256 727942dce9e0ca7b96ed946fdb88b691cec00ceea36f075825206ba038740ec6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_novel-0.11.4-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.0 {"installer":{"name":"uv","version":"0.12.0","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.4-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6cff6cf88ce1a50531f5139eba85bb32cbb0b80e520376125746f9f385a73d2b
MD5 864598701bba6c6ec18e27ef8b0222eb
BLAKE2b-256 09022511f50e91d7bfdaf3e8e6efaf63169579ecc3c61d56e0f2322cba8f0ca1

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

This release

0.11.4 This release

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