Skip to content

MARP is a story generation framework based on multi-agent collaboration and role-playing. Agents include Global designer, Scene designer, Controller, Character, Environment Manager, Writer.

License

Notifications You must be signed in to change notification settings

multi-agent-story-generation/MARP-old

 
 

Repository files navigation

MARP

Multi-Agent Story Generation

MARP is a Story Generation Framework based on multi-agent collaboration and role playing. Agents include a Global Designer, a Scene Designer, a Controller, an Environment Manager, a Writer, and several Player agents (the characters).

Getting Started

Installation

There is no particular requirements on the operating system. MARP is compatible with both Windows and macOS.

Package Requirements:

  • Python >= 3.7 (3.11 recommended)
  • OpenAI API key (We use gpt-4-1106-preview as default LLM backend)

Create conda environment:

conda create --name marp python=3.11
conda activate marp

Install dependencies:

pip install -r requirements.txt

To use gpt-4-1106-preview as LLM backend, make sure you have some funds (at least 3 dollars) in your OpenAI account and set your OpenAI API key:

  • Windows:
set OPENAI_API_KEY=sk-xxxx
  • MacOS:
export OPENAI_API_KEY=sk-xxxx

Run code

Optional: You can change the value (string) of the environment_description variable in the story_generation.py file to try out different global prompts.

Within the repo, run the following command in your terminal:

python story_generation.py

The generated agent actions will be printed in terminal. A storys/ directory will be created and the generated story (named with a time stamp) will be saved as a txt file in this directory.

Code structure

│   .gitignore
│   LICENSE
│   README.md
│   requirements.txt
│   story_generation.py  # specify environment and agents for story generation
├───marp
│   │   agent.py    # define agent class
│   │   arena.py    # define how agents run in environment
│   │   config.py
│   │   message.py   # define message system
│   │   utils.py
│   │   __init__.py
│   ├───backends
│   │       bard.py
│   │       base.py
│   │       openai.py  # query GPT-4 api
│   │       __init__.py
│   │
│   └───environments
│           base.py
│           story_environment.py  # environment for story generation
│           __init__.py
│
├───storys   # save generated stories and logs. This sub-directory is ignored by git.
    │            It will be created automatically on your local repo after your first run.
│   │   story_20231126_213925.txt
│   │   ...
│   └───logs
│           log_20231217_104735.txt
│           ...
└───story_samples   # generated stories for evaluation
        ibrusia_gpt.txt
        ibrusia_marp.txt
        ...

Contact

If you have any questions or suggestions, feel free to open an issue or submit a pull request. We will provide timely feedback.

Credits

This code is built on ChatArena, a wonderful open-source framework providing multi-agent language game environments.

About

MARP is a story generation framework based on multi-agent collaboration and role-playing. Agents include Global designer, Scene designer, Controller, Character, Environment Manager, Writer.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Jupyter Notebook 94.5%
  • Python 5.5%