Giter Site home page Giter Site logo

zestor / muses Goto Github PK

View Code? Open in Web Editor NEW
13.0 3.0 1.0 226 KB

Artificial Intelligence (AI) Long Form Fiction Writer using OpenAI or NLP Cloud

License: MIT License

Python 99.49% Shell 0.51%
auto book muse nlpcloud novel openai writing artificial-intelligence

muses's Introduction

Muses

The intent of this program is to produce long open-ended fiction using cloud based AI engines like OpenAI and NLP Cloud Playground.

The code expects your tokens to be stored in environment variables as OPENAI_API_KEY or NLPCLOUD_API_KEY, or both.

start the program with % python muses.py

  1. The program has been primed with a previous_scene, characters, summary, and protagonist. The main loop writes 14 paragraphs to avoid writing forever, but the loop could be increased or decreased.

    • previous scene - what happened last. If you are going to restart the program to pickup where it left off, start with a short previous scene summary instead of the long text produced as an AI response.
    • characters - you can add a name and short description of your character. The program will continue to add to this description as the story continues and things happen to your characters.
    • summary - an ongoing summarization of what has happened.
    • protagonist - a name of a character who cannot die. Prompt is written to not kill or injure this character.
  2. The output will be written to the file story.txt. It will also clear this file on every restart.

  3. The generated scenes will be written to SceneOutput. It will also clear this directory/folder on every restart.

  4. The program will insert randomness to drive the story in different directions using a plot queue. These are simple little text strings that are something like: someone in this story is battling with a past mistake. This helps the program to generate an open-ended ongoing story with some variety from scene to scene.

  5. Main Loop

  • Create a new scene using the previous scene, characters, plot, summary, and protagonist data
  • This program supports parallelism, and can call the AI cloud engine simulaneously multiple times for the same scene generation. The intent is to pick the best of X scene generations. Best is determined by text length. Meaning the longest text length will be selected. Default is best of 3 attempts. Parallel calls work fine for openAI, but you will want to scale the parallelism down for NLP Cloud to probably 1 to avoid errors depending on your engine used and paid plan.
  • once the longest scene text is generated, it is sent again to the cloud AI engine to enhance the scene description with vivid sensory details. This increases the text length with further sensory details while keeping within the original intent of the scene.
  • there is logic to avoid duplicate output or repeating verbatim sentences in future scenes if it's already been written.
  • Next the program determines if any new characters have been added to the story by the AI engine
  • Character details are updated based on what just happened in this scene, and any duplicate character descriptions are summarized to the character and any duplication removed.
  • The summary is updated with what just happened in this scene.

muses's People

Contributors

zestor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

xiaoxieshop

muses's Issues

The Install Not Working

I followed these instructions in muses.py

Created
~/.bash-profile
Added the following two keys
export OPENAI_API_KEY=
export NLPCLOUD_API_KEY=
Saved the file and sourced it.
source ~/.bash-profile_

So far so good. However, when I run the app -
python muses.py

This is the error:

Traceback (most recent call last):
File "/home/robert/Muses/muses.py", line 7, in
from python.MusesHelper import MusesHelper
File "/home/robert/Muses/python/MusesHelper.py", line 9, in
import cohere
ModuleNotFoundError: No module named 'cohere'

So thank you for creating this, but without some assistance I'm unable to use this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.