Skip to main content

An A.I. tool for generating long Kindle ebooks based on a prompt

Project description

long-ebook-generator-ai

Author: Alexis Kirke (narrative.layer)

Overview

long-ebook-generator-ai is a Python library designed to generate long-form eBooks using AI-powered language models. It automates the process of creating structured book outlines, chapters, and converting them into an EPUB format, with optional Kindle compatibility. The package also supports AI-generated book covers and MathML conversion for LaTeX equations in the text.

The package integrates with OpenAI's API to generate book content based on customizable prompts, making it a powerful tool for authors, content creators, or developers looking to create AI-generated books.

Features

  • AI-Powered Outline and Content Generation: Automatically generate book outlines with chapters, sections, and subsections using OpenAI's GPT models.
  • EPUB Book Creation: Convert AI-generated content into an EPUB format, compatible with major eReaders.
  • Customizable Book Structures: Define the number of chapters, sections, and subsections for your book.
  • AI-Generated Book Covers: Automatically generate a cover for your book using image generation AI models.
  • LaTeX Equation Support: Convert LaTeX equations to MathML for display in the eBook.
  • Kindle Compatibility: Optionally force compatibility with Amazon Kindle devices.

Installation

Install the package using pip:

pip install long-ebook-generator-ai

Quick Start

Here's an example of how to generate an outline and an EPUB book using long-ebook-generator-ai.

1. Import and Initialize the Client

from book_writer import BookWriter

# Initialize the BookWriter
title = "The AI Revolution"
writer = BookWriter(title=title, client=client, openai_api_key=openai_api_key))

2. Generate an Outline

outline = writer.generate_outline(
    num_chapters=5, 
    sections_per_chapter=3, 
    subsections_per_section=2, 
    paras_per_subsection=4
)
print(outline)

3. Generate the EPUB Book

writer.generate_ebook(
    author="Your Name",
    generate_cover=True,
    force_kindle_compatibility=True,
    image_prompt="A futuristic book cover showing an AI revolution"
)

Dependencies

  • openai - For OpenAI GPT integration.
  • ebooklib - To create and manage EPUB files.
  • Pillow - For image manipulation (used in cover generation).
  • tiktoken - Token management for GPT models.
  • json, html, re - Standard libraries for handling text formatting and file management.

License

This project is licensed under the MIT License. See the LICENSE file for more details.

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

long-ebook-generator-ai-1.0.4.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

long_ebook_generator_ai-1.0.4-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file long-ebook-generator-ai-1.0.4.tar.gz.

File metadata

File hashes

Hashes for long-ebook-generator-ai-1.0.4.tar.gz
Algorithm Hash digest
SHA256 2fa48d935730501cf067aaa7e283c89c8cbea4e86144f3ee999121612308a142
MD5 fac577fe5b191e85b36b6730ef4e482a
BLAKE2b-256 9014c65e151922a22d5cc6fa0f4a1e0d19c81fa04a8e570f91b2191f99058751

See more details on using hashes here.

File details

Details for the file long_ebook_generator_ai-1.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for long_ebook_generator_ai-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 58d3b867ef089616e8a09e44e079125f26901bfdf40c282ca1bf91a2d5f1b1c7
MD5 b051ef1ded2b9863c7e0e22949dcaf71
BLAKE2b-256 8002af5d305d1f14d70651203541bab52dd4bd1abdbc835c8dadafc611520321

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page