opensourceprojects.dev

A broadsheet for software that doesn't ask for your email

Generate entire books from a one-line prompt with Groq and Llama
GitHub RepoImpressions3

Project Description

View on GitHub

Generate a Whole Book From a Single Sentence With Groq and Llama

You've got a topic you want to learn about, but every book on the shelf is either too dense, too shallow, or written for someone who isn't you. What if you could just describe the book you wish existed and have it appear? That's the idea behind Infinite Bookshelf, a Streamlit app that turns a one-line prompt into a complete, structured book in seconds.

What It Does

Infinite Bookshelf scaffolds the creation of books from a one-line prompt using Llama models running on Groq. You type in something like "The Basics of Large Language Models" or "Data Structures and Algorithms in Java," and the app generates a full book with chapters, content, and structure. The README's own framing is a good illustration: ask for a book on Natural Language Processing and you get a hundred pages with chapters and structure. Find it too technical? Change the prompt and the whole thing adapts. Want code examples in Python? Ask for that instead, and every chapter gets code alongside the instructional text.

Architecturally, it's a Streamlit app that mixes two models. A larger model handles generating the book's structure, while a smaller one writes the actual content. That split is deliberate, and it's the core of how the project keeps things fast. Right now, the content generation only uses the context of the section title to write each chapter. The README is upfront that this limits it—it works well for nonfiction, and expanding to fuller book context is on the roadmap so it can handle fiction too.

Why It's Cool

  • The two-model split is a smart tradeoff. Rather than throwing the biggest model at every task, Infinite Bookshelf uses the larger model for structure and the smaller one for content. You get the quality where it matters most (the skeleton of the book) and speed where volume matters (the chapters). Each chapter generates within seconds, which is the whole point of the project.

  • It's built for iteration, not just generation. The pitch isn't "generate a book once and hope it's good." It's that you can rewrite your prompt and the entire book reshapes around your needs. Too technical? Ask again. Want code? Ask again. That reframing—books as something you tune rather than something you're stuck with—is the genuinely interesting part.

  • The output is actually readable. The app uses markdown styling to render an aesthetic book inside Streamlit, including tables and code blocks. That matters more than it sounds. A wall of plain text is hard to skim; a properly formatted document with headings and tables is something you can actually learn from.

  • You can take the book with you. There's a download option that gives you a text file with the entire book contents. No lock-in, no weird export format—just the text.

  • It's honest about its limits. The README doesn't pretend this works for everything. It says plainly that it works well on nonfiction and that fiction needs fuller context before it'll be good. That kind of candor is refreshing and tells you exactly what you're getting.

How to Try It

The fastest path is the hosted version at infinite.benjamin.sh. No setup, no API key wrangling—just open it and start prompting.

If you'd rather run it locally, the README walks through it with Streamlit. First, set your Groq API key as an environment variable:

export GROQ_API_KEY="gsk_yA..."

That step is optional—it just lets you skip entering the key later inside the app. Then set up a virtual environment and install the dependencies:

python3 -m venv venv
source venv/bin/activate # Bash

venv\Scripts\activate.bat # Windows
pip3 install -r requirements.txt

From there you launch the Streamlit app and start generating. If you want to see what the output looks like before committing, the repo includes example generated books—one on LLM basics and one on data structures and algorithms in Java—so you can judge the quality for yourself.

The full source is at github.com/bklieger/groqbook. It's MIT licensed, so you're free to fork it and take it in your own direction.

Final Thoughts

Infinite Bookshelf is best suited for anyone who wants a fast, structured first pass at a nonfiction topic—students, developers picking up a new technology, or anyone who learns better from something shaped around their own question. It's not going to replace a well-written textbook on a subject you're serious about, and the README doesn't claim otherwise. But as a way to get a personalized, skimmable overview in seconds, it's a genuinely useful tool. The planned expansion to fuller book context is the thing to watch—if that lands, the fiction limitation goes away and the project gets considerably more interesting.

Back to Projects
Project ID: dffffa05-90ca-4f0b-b66a-07f6d5c676f9Last updated: September 13, 2026 at 06:30 AM