Skip to content

Book Generator

The LLM Automatic Computer Framework (L2MAC) excels at generating any user-directed text output of any length; it can be used to effectively write books or long documents from a single input prompt.

The following provides a complete example of creating an entire book. Run:

python
from l2mac import generate_book

book: dict = generate_book(
    r"""
Write a complete recipe book for the following book title of "Twirls & Tastes: A Journey Through Italian Pasta"

Description: "Twirls & Tastes" invites you on a flavorful expedition across Italy, exploring the diverse pasta landscape from the sun-drenched hills of Tuscany to the bustling streets of Naples. Discover regional specialties, learn the stories behind each dish, and master the art of pasta making with easy-to-follow recipes that promise to delight your senses.
""",
    steps=30,
)

print(book) # it will print the book folder complete with all the files as a dictionary

This will create a new workspace folder in your local directory where you run this script, including all the files generated while running and when L2MAC has completed. The final output book folder will be within the newly generated folder in the local workspace directory, organized by the time and date as the sub-folder name.

The output should look something like this.

bash
italian_pasta_recipe_book
├── title_page.txt
├── dedication_page.txt
├── detailed_outline.txt
├── table_of_contents.txt
├── introduction.txt
├── chapter_1_tuscany.txt
├── chapter_2_campania.txt
├── chapter_3_sicily.txt
├── chapter_4_lombardy.txt
├── chapter_5_pasta_making_techniques.txt
├── chapter_6_sauces_and_accompaniments.txt
├── conclusion.txt
└── index.txt

The complete raw output generated by the above is given below.

Entire Book | Italian Pasta Recipe Book

Click here for the complete book; L2MAC produced all the text for the book, and all images were created with DALLE.

The complete output text files are on github; you can download them here. The code and prompt to generate this is here.

Released under the MIT License.