GPTAuthor is an AI tool for writing long form, multi-chapter stories given a story prompt.
MIT License
Unleash your storytelling genius: GPTAuthor is an easy to use command-line tool for writing long form, multi-chapter stories given a story prompt.
./_output/
folder for your reading pleasure.The Nov 2023 OpenAI leadership crisis - "In the heart of San Francisco, nestled among the city's tech giants and start-up hopefuls, stood the OpenAI office. A hive of activity, it buzzed with the sound of keyboards clacking, coffee machines hissing, and the occasional drone of a philosophical debate about whether AI could develop a taste for late-night taco runs. It was a typical day, or so everyone thought. Sam Altman, the CEO of OpenAI, was in his office, a space that looked more like a teenager's bedroom than the office of a tech mogul, with posters of space exploration and vintage computers adorning the walls. He was in the middle of explaining to a rubber duck on his desk the intricacies of AI alignment, a method he found surprisingly effective, when his phone buzzed with an email notification." continue reading...
Echoes of Atlantis (based on a blogpost) - "In the dimly lit halls of the British Museum, Aria Seaborne's heart raced with anticipation. Her fingers, delicate yet steady, brushed against the surface of an ancient artifact that had long eluded understanding. It was a curious object, seemingly part of a larger mechanism, its origins shrouded in mystery and its purpose lost to time. Aria, with her keen eye for the arcane, noticed an almost imperceptible seam along its side. With a gentle nudge, the artifact sprang open, revealing a compartment that housed a parchment, brittle with age." continue reading...
You can install gptauthor using pip, ideally into a Python virtual environment.
pip install gptauthor
Alternatively, checkout an example notebook that uses gptauthor and you can run directly in Google Colab.
This example reads the story prompt from the example prompts-openai-drama.yaml file and writes 3 chapters using the gpt-3.5-turbo
model with a temperature of 0.1
. Note that you will need to locally set your OpenAI API Key environment variable.
It's recommended to experiment using the default gpt-3.5-turbo
model as generating a few chapters will only cost a couple cents (as of Jan 2024). Once you are happy with the results you can try one of the more expensive gpt-4
models which will produce better quality results, be slower, and cost more to run. See the OpenAI pricing page for more details.
Set your OpenAI API Key on MacOS/Linux:
export OPENAI_API_KEY=sk-<yourkey>
Or, set your OpenAI API Key on Windows:
setx OPENAI_API_KEY "sk-<yourkey>"
Then run the gptauthor command:
gptauthor --story prompts-openai-drama --total-chapters 3 --llm-model gpt-3.5-turbo --llm-temperature 0.1
--story TEXT
: The name of the yaml file defining the story and prompts--llm-model TEXT
: The model name [default: gpt-3.5-turbo]--llm-temperature FLOAT
: LLM temperature value (0 to 2, OpenAI default is 1) [default: 1]--llm-top-p FLOAT
: LLM top_p probability value (0 to 2, OpenAI default is 1) [default: 1]--llm-use-localhost INTEGER
: LLM use localhost:8081 instead of openai [default: 0]--total-chapters INTEGER
: Total chapters to write [default: 3]--allow-user-input / --no-allow-user-input
: Allow command line user input [default: allow-user-input]--version
: Display gptauthor version--help
: Show usage helpWhile running the app tells your the input paramers, the progress of the writing, and where the output is written to.
In progress and final output is written to the ./_output/
directory, in the sub-folders ./_output/<prompt-file-name>/<model-name>/<datetime>-<parameters>-<book-name>/
.
There are several files, the main output being a Markdown version of the whole book _whole_book.md
and an HTML version of the same _whole_book.html
.
The prompts for creating your own story are defined in a yaml file, for example see: prompts-openai-drama.yaml.
Make a copy, fill in your story details and describe the writing style (while retaining the same structure), and run the app in the same folder as your new yaml file.
For example, if your yaml prompt file is called prompts-my-really-great-story.yaml
:
export OPENAI_API_KEY=sk-<your key>
gptauthor --story prompts-my-really-great-story --total-chapters 5 --llm-model gpt-3.5-turbo --llm-temperature 0.1
Contributions are welcome. Please follow these steps:
While an effort is made to count tokens and estimate OpenAI API costs for each run, they are just estimated and can be wrong. Check your OpenAI billing page to confirm the actual costs.
I'm sure there are bugs, please report them on the Github issues page
Have fun! And please share your results with me if you can (perhaps as a Github documentation issue), I'd love to see them.
This project is MIT licensed.