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

Uploaded CPython 3.14Windows x86-64

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

Uploaded CPython 3.14manylinux: glibc 2.34+ ARM64

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

Uploaded CPython 3.14macOS 11.0+ ARM64

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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13manylinux: glibc 2.34+ ARM64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12manylinux: glibc 2.34+ ARM64

fabricatio_novel-0.10.3-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.3-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: fabricatio_novel-0.10.3-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.29 {"installer":{"name":"uv","version":"0.11.29","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.3-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 3b5874f2d7501f87a5e3049242b028abba2e580251401e961c3f6e4c15b6958c
MD5 b2aaadcc54fea5b6cc645528f086fd15
BLAKE2b-256 793a645940ef25864adc31217060a41a953a3f4bbd63afd8a8cfe80aadf08ad9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_novel-0.10.3-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.29 {"installer":{"name":"uv","version":"0.11.29","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.3-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 616db9fd183b9d93cbf832d5fe180e33160530c9d6bf610dc98bb228f2c53d18
MD5 c578ac9e61c88f78a7d260bac06e55e3
BLAKE2b-256 52ab99a34b8f6ffcb40b65eeb06bdaa3a5b09bcf0734e74e143939fd3c784a08

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_novel-0.10.3-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.29 {"installer":{"name":"uv","version":"0.11.29","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.3-cp314-cp314-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 ec0affe343a2cb1a58a56d674b4ae8fcdfc920658961fcfd8d9ddfd491682803
MD5 b725c658af2bed3bac8f62fc7d3d8811
BLAKE2b-256 298944003cd2def4a846e857206ae7da18ebf61f07977d14b3192c0c7ffd6a0e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_novel-0.10.3-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.29 {"installer":{"name":"uv","version":"0.11.29","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.3-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 76f0a91fd7214b2ae77a3c244a03657e8654e3444e2bb319038dfcdef002331d
MD5 a0a57693e44462ce205ed0834585e5b6
BLAKE2b-256 e01ad95b194cf30f2dd39e217a7e698b93c1f667fa68af73920d5db5cff436f3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_novel-0.10.3-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.29 {"installer":{"name":"uv","version":"0.11.29","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.3-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 c3a6d1e0718d584ae9787c0648bf05389d61499cdd18891c977d39606910177f
MD5 3d3618bffd7f93aafa2040639c68c9e2
BLAKE2b-256 220a128a4e2f70a78a1907f17330a5f83a61609c31aa9ad578dc59d5ae218de8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_novel-0.10.3-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.29 {"installer":{"name":"uv","version":"0.11.29","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.3-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 79674c446e1026567dd771e702e1f1ff9295563b0dc914e17686a8a8877d73c6
MD5 5701b560d0f1fecc4ed843ca53f56a3c
BLAKE2b-256 590566875c4ad9df94123327d2285ad3191e4df4d36f9b235ff3023d57f6dcc8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_novel-0.10.3-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.29 {"installer":{"name":"uv","version":"0.11.29","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.3-cp313-cp313-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 64455e1d5203749c10519abbd7ee563fc1963d517c390883a27dce1bc37053ec
MD5 52a6b6022720986d4a30c0237e1de1ab
BLAKE2b-256 8dc065313e9b2a636e2c4fc9e98f39f3a84ef535fb6fcd40be11f841126d74e2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_novel-0.10.3-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.29 {"installer":{"name":"uv","version":"0.11.29","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.3-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b2716070c446dbc7662874d3905deefe62da971f8e75d03dafa20c03c7e86a33
MD5 4792befeff33d4e23d1c934e06143b48
BLAKE2b-256 fd7451120b021fe49a0511e207b3e6a7957c48ee932f5a8e7668d38936a08b9f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_novel-0.10.3-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.29 {"installer":{"name":"uv","version":"0.11.29","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.3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 dd9460fbfcd3250a163d2edf6fd3277a4caf501046d3f333dcebcb8cf4608fc8
MD5 835d521662891ed9d3a5641892547da2
BLAKE2b-256 1bde6425d649d81943c954978fa55281418ed0652656875cb0f6d80c58e90cad

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_novel-0.10.3-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.29 {"installer":{"name":"uv","version":"0.11.29","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.3-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 7c824844223b1a539aa256a9988ab217db302f212efd1c9726a74685a14d0e63
MD5 3ee4ff01d057eedce93b8c63c32be8b1
BLAKE2b-256 7881aa30576974baed1d7927f294b37b1221edf3c997461cf74bb5946e50a2b6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_novel-0.10.3-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.29 {"installer":{"name":"uv","version":"0.11.29","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.3-cp312-cp312-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 64fbd63547fc32f9a5007fe94c25b6e9224591283a405479b9b28f822e53789d
MD5 1b667422f499ff6b3a46d2cfd5b12a7e
BLAKE2b-256 3937a3ee76f1a964191dc01da43d831312710dd1ed65fc2f357e599ee20207ae

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_novel-0.10.3-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.29 {"installer":{"name":"uv","version":"0.11.29","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.3-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 42427fa389e9ebc0485dd81ee307a929c2a8059b0be48c5c7ee090f04476aa9c
MD5 9bcbc1d0f9a61e4b45b7fe6d425e8a41
BLAKE2b-256 56f9f7c0d4493682fcd5df8f79b2e062b09e6f6c270ca0af8e83bfe9e2df5a55

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

0.10.6

12 files

This release

0.10.3 This release

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