LLM Book Generator is a powerful Python-based command-line tool that automates the creation of entire books, from initial concept to a fully formatted DOCX manuscript. It leverages Large Language Models (LLMs) via llama.cpp to generate diverse content, including titles, chapter outlines, detailed section text, front and back matter, and even marketing materials.
- llama.cpp Support: Seamlessly integrates with llama.cpp server
(
llama-server). - Comprehensive Content Generation: Creates everything from titles and chapter outlines to front and back matter.
- LaTeX Math Rendering: Converts LaTeX math expressions into high-quality images.
- Advanced DOCX Styling: Produces professionally formatted DOCX files with customizable styles.
- Intelligent Caching: Caches LLM responses to speed up subsequent runs.
- Flexible Configuration: Uses a
config.yamlfile for easy customization.
- Python 3.12+
- A LaTeX distribution (e.g., MiKTeX, MacTeX, TeX Live)
- A running llama.cpp server instance
(
llama-server).
-
Clone the repository:
git clone <repository-url> cd <repository-directory>
-
Install dependencies:
pip install . -
Set up environment (Optional): If using Hugging Face tokenizers requiring authentication, create a
.envfile in the project root:HF_TOKEN="YOUR_HUGGING_FACE_TOKEN"
-
Configure your book: Edit the
config.yamlfile to define your book's topic, author, style, and other parameters. For a detailed explanation of all the available options, see CONFIG.md. -
Run the script:
python main.py
The generated book and marketing materials will be saved in the directory specified in
config.yaml(default is"output").
- LaTeX Math Rendering Issues: Ensure your LaTeX distribution is installed correctly and accessible from your system's PATH.
- API Errors: Ensure that your llama.cpp server is running and accessible
(default:
http://localhost:8080). - File Permissions: Make sure the script has write access to the output and cache directories.
Contributions are welcome! Please feel free to submit a pull request or open an issue.
This project is licensed under GPLv3. See the LICENSE file for details.