├── .gitignore ├── LICENSE ├── README.md ├── app.py ├── assets ├── teaser.jpeg └── teaser_chatbot.jpg ├── chat.py ├── data ├── everything_everywhere_all_at_once.txt ├── thor_love_and_thunder.txt └── top_gun_maverick.txt ├── data_driven_characters ├── __init__.py ├── chains.py ├── character.py ├── chatbots │ ├── __init__.py │ ├── retrieval.py │ ├── summary.py │ └── summary_retrieval.py ├── constants.py ├── corpus.py ├── interfaces │ ├── __init__.py │ ├── commandline_ui.py │ └── streamlit_ui.py ├── memory │ ├── __init__.py │ └── retrieval.py └── utils.py ├── generate_multiple_characters.ipynb ├── generate_single_character.ipynb ├── output ├── everything_everywhere_all_at_once │ ├── summarytype_map_reduce │ │ ├── character_definitions │ │ │ └── Evelyn.json │ │ └── summaries │ │ │ ├── summary_0.txt │ │ │ ├── summary_1.txt │ │ │ ├── summary_10.txt │ │ │ ├── summary_11.txt │ │ │ ├── summary_12.txt │ │ │ ├── summary_2.txt │ │ │ ├── summary_3.txt │ │ │ ├── summary_4.txt │ │ │ ├── summary_5.txt │ │ │ ├── summary_6.txt │ │ │ ├── summary_7.txt │ │ │ ├── summary_8.txt │ │ │ └── summary_9.txt │ └── summarytype_refine │ │ ├── character_definitions │ │ └── Evelyn.json │ │ └── summaries │ │ ├── summary_0.txt │ │ ├── summary_1.txt │ │ ├── summary_10.txt │ │ ├── summary_11.txt │ │ ├── summary_12.txt │ │ ├── summary_2.txt │ │ ├── summary_3.txt │ │ ├── summary_4.txt │ │ ├── summary_5.txt │ │ ├── summary_6.txt │ │ ├── summary_7.txt │ │ ├── summary_8.txt │ │ └── summary_9.txt ├── thor_love_and_thunder │ ├── summarytype_map_reduce │ │ ├── character_definitions │ │ │ └── Thor.json │ │ └── summaries │ │ │ ├── summary_0.txt │ │ │ ├── summary_1.txt │ │ │ ├── summary_10.txt │ │ │ ├── summary_11.txt │ │ │ ├── summary_12.txt │ │ │ ├── summary_2.txt │ │ │ ├── summary_3.txt │ │ │ ├── summary_4.txt │ │ │ ├── summary_5.txt │ │ │ ├── summary_6.txt │ │ │ ├── summary_7.txt │ │ │ ├── summary_8.txt │ │ │ └── summary_9.txt │ └── summarytype_refine │ │ ├── character_definitions │ │ └── Thor.json │ │ └── summaries │ │ ├── summary_0.txt │ │ ├── summary_1.txt │ │ ├── summary_10.txt │ │ ├── summary_11.txt │ │ ├── summary_12.txt │ │ ├── summary_2.txt │ │ ├── summary_3.txt │ │ ├── summary_4.txt │ │ ├── summary_5.txt │ │ ├── summary_6.txt │ │ ├── summary_7.txt │ │ ├── summary_8.txt │ │ └── summary_9.txt └── top_gun_maverick │ ├── summarytype_map_reduce │ ├── character_definitions │ │ └── Maverick.json │ └── summaries │ │ ├── summary_0.txt │ │ ├── summary_1.txt │ │ ├── summary_10.txt │ │ ├── summary_2.txt │ │ ├── summary_3.txt │ │ ├── summary_4.txt │ │ ├── summary_5.txt │ │ ├── summary_6.txt │ │ ├── summary_7.txt │ │ ├── summary_8.txt │ │ └── summary_9.txt │ └── summarytype_refine │ ├── character_definitions │ └── Maverick.json │ └── summaries │ ├── summary_0.txt │ ├── summary_1.txt │ ├── summary_10.txt │ ├── summary_2.txt │ ├── summary_3.txt │ ├── summary_4.txt │ ├── summary_5.txt │ ├── summary_6.txt │ ├── summary_7.txt │ ├── summary_8.txt │ └── summary_9.txt ├── requirements.txt └── setup.py /.gitignore: -------------------------------------------------------------------------------- 1 | # .gitignore 2 | 3 | # Byte-compiled / optimized / DLL files 4 | __pycache__/ 5 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 mbchang 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Data-Driven Characters 2 | 3 | Generate character chatbots from existing corpora with [LangChain](https://docs.langchain.com/docs/). [[Blog](https://blog.langchain.dev/data-driven-characters/#:~:text=data%2Ddriven%2Dcharacters%20is%20a%20repo%20for%20creating%20and%20interacting,existing%20platforms%20like%20character.ai.)] 4 | 5 | ![image](assets/teaser_chatbot.jpg) 6 | 7 | **TLDR: This repo enables you to create data-driven characters in three steps:** 8 | 1. Upload a corpus 9 | 2. Name a character 10 | 3. Enjoy 11 | 12 | ## About 13 | The purpose of `data-driven-characters` is to serve as a minimal hackable starting point for creating your own data-driven character chatbots. It provides a simple library built on top of LangChain for processing any text corpus, creating character definitions, and managing memory, with various examples and interfaces that make it easy to spin up and debug your own character chatbots. 14 | 15 | ## Features 16 | This repo provides three ways to interact with your data-driven characters: 17 | 1. [Export to character.ai](https://github.com/mbchang/data-driven-characters/tree/main#export-to-characterai) 18 | 2. [Debug locally in the command line or with a Streamlit interface](https://github.com/mbchang/data-driven-characters/tree/main#debug-locally) 19 | 3. [Host a self-contained Streamlit app in the browser](https://github.com/mbchang/data-driven-characters/tree/main#host-on-streamlit) 20 | 21 | **Example chatbot architectures provided in this repo include:** 22 | 1. character summary 23 | 2. retrieval over transcript 24 | 3. retrieval over summarized transcript 25 | 4. character summary + retrieval over transcript 26 | 5. character summary + retrieval over summarized transcript 27 | 28 | ## Export to character.ai 29 | 1. Put the corpus into a single a `.txt` file inside the `data/` directory. 30 | 2. Run either `generate_single_character.ipynb` to generate the definition of a specific character or `generate_multiple_characters.ipynb` to generate the definitions of muliple characters 31 | 3. Export character definitions to character.ai to [create a character](https://beta.character.ai/character/create?) or [create a room](https://beta.character.ai/room/create?) and enjoy! 32 | 33 | ### Example 34 | Here is how to generate the description of "Evelyn" from the movie [Everything Everywhere All At Once (2022)](https://scrapsfromtheloft.com/movies/everything-everywhere-all-at-once-transcript/). 35 | ```python 36 | from dataclasses import asdict 37 | import json 38 | 39 | from data_driven_characters.character import generate_character_definition 40 | from data_driven_characters.corpus import generate_corpus_summaries, load_docs 41 | 42 | # copy the transcript into this text file 43 | CORPUS = 'data/everything_everywhere_all_at_once.txt' 44 | 45 | # the name of the character we want to generate a description for 46 | CHARACTER_NAME = "Evelyn" 47 | 48 | # split corpus into a set of chunks 49 | docs = load_docs(corpus_path=CORPUS, chunk_size=2048, chunk_overlap=64) 50 | 51 | # generate character.ai character definition 52 | character_definition = generate_character_definition( 53 | name=CHARACTER_NAME, 54 | corpus_summaries=generate_corpus_summaries(docs=docs)) 55 | 56 | print(json.dumps(asdict(character_definition), indent=4)) 57 | ``` 58 | gives 59 | ```python 60 | { 61 | "name": "Evelyn", 62 | "short_description": "I'm Evelyn, a Verse Jumper exploring universes.", 63 | "long_description": "I'm Evelyn, able to Verse Jump, linking my consciousness to other versions of me in different universes. This unique ability has led to strange events, like becoming a Kung Fu master and confessing love. Verse Jumping cracks my mind, risking my grip on reality. I'm in a group saving the multiverse from a great evil, Jobu Tupaki. Amidst chaos, I've learned the value of kindness and embracing life's messiness.", 64 | "greeting": "Hey there, nice to meet you! I'm Evelyn, and I'm always up for an adventure. Let's see what we can discover together!" 65 | } 66 | ``` 67 | Now you can [chat with Evelyn on character.ai](https://c.ai/c/be5UgphMggDyaf504SSdAdrlV2LHyEgFQZDA5WuQfgw). 68 | 69 | ## Creating your own chatbots 70 | Beyond generating character.ai character definitions, this repo gives you tools to easily create, debug, and run your own chatbots trained on your own corpora. 71 | 72 | ### Why create your own chatbot? 73 | 74 | If you primarily interested in accessibility and open-ended entertainment, character.ai is a better choice. 75 | But if you want more control in the design of your chatbots, such as how your chatbots use memory, how they are initialized, and how they respond, `data-driven-characters` may be a better option to consider. 76 | 77 | Compare the conversation with the [Evelyn chatbot on character.ai](https://c.ai/c/be5UgphMggDyaf504SSdAdrlV2LHyEgFQZDA5WuQfgw) with our own Evelyn chatbot designed with `data-driven-characters`. The character.ai Evelyn appears to simply latch onto the local concepts present in the conversation, without bringing new information from its backstory. In contrast, our Evelyn chatbot stays in character and grounds its dialogue in real events from the transcript. 78 | image 79 | 80 | ### Features 81 | This repo implements the following tools for packaging information for your character chatbots: 82 | 1. character summary 83 | 2. retrieval over the transcript 84 | 3. retrieval over a summarized version of the transcript 85 | 86 | To summarize the transcript, one has the option to use [LangChain's `map_reduce` or `refine` chains](https://langchain-langchain.vercel.app/docs/modules/chains/document/). 87 | Generated transcript summaries and character definitions are cached in the `output/` directory. 88 | 89 | ### Debug locally 90 | **Command Line Interface** 91 | 92 | Example command: 93 | 94 | ``` 95 | python chat.py --corpus data/everything_everywhere_all_at_once.txt --character_name Evelyn --chatbot_type retrieval --retrieval_docs raw 96 | ``` 97 | 98 | **Streamlit Interface** 99 | 100 | Example command: 101 | 102 | ``` 103 | python -m streamlit run chat.py -- --corpus data/everything_everywhere_all_at_once.txt --character_name Evelyn --chatbot_type retrieval --retrieval_docs summarized --interface streamlit 104 | ``` 105 | This produces a UI based on [the official Streamlit chatbot example]([url](https://github.com/streamlit/llm-examples/blob/main/Chatbot.py)) that looks like this: 106 | ![image](https://github.com/mbchang/data-driven-characters/assets/6439365/14317eaa-d2d9-48fa-ac32-7f515825cb85) 107 | It uses the `map_reduce` summarization chain for generating corpus summaries by default. 108 | 109 | 110 | ### Host on Streamlit 111 | Run the following command: 112 | ``` 113 | python -m streamlit run app.py 114 | ``` 115 | This will produce an app that looks like this: 116 | ![image](https://github.com/mbchang/data-driven-characters/assets/6439365/b5ed2aa7-e509-47f2-b0c2-a26f99d76106) 117 | 118 | Interact with the hosted app [here](https://mbchang-data-driven-characters-app-273bzg.streamlit.app/). 119 | 120 | ## Installation 121 | To install the data_driven_character_chat package, you need to clone the repository and install the dependencies. 122 | 123 | You can clone the repository using the following command: 124 | 125 | ```bash 126 | git clone https://github.com/mbchang/data-driven-characters.git 127 | ``` 128 | Then, navigate into the cloned directory: 129 | 130 | ```bash 131 | cd data-driven-characters 132 | ``` 133 | Install the package and its dependencies with: 134 | 135 | ```bash 136 | pip install -e . 137 | ``` 138 | 139 | Store your OpenAI API key, either as an environment variable, or as the last line of your `.bashrc` or `.zshrc`: 140 | 141 | ``` 142 | export OPENAI_API_KEY= 143 | ``` 144 | 145 | 146 | ## Data 147 | The examples in this repo are movie transcripts taken from [Scraps from the Loft](https://scrapsfromtheloft.com/). However, any text corpora can be used, including books and interviews. 148 | 149 | ## Character.ai characters that have been generated with this repo: 150 | - Movie Transcript: [Everything Everywhere All At Once (2022)](https://scrapsfromtheloft.com/movies/everything-everywhere-all-at-once-transcript/) 151 | - [Evelyn](https://c.ai/c/be5UgphMggDyaf504SSdAdrlV2LHyEgFQZDA5WuQfgw) 152 | - [Alpha Waymond](https://c.ai/c/5-9rmqhdVPz_MkFxh5Z-zhb8FpBi0WuzDNXF45T6UoI) 153 | - [Jobu Tupaki](https://c.ai/c/PmQe9esp_TeuLM2BaIsBZWgdcKkQPbQRe891XkLu_NM) 154 | 155 | - Movie Transcript: [Thor: Love and Thunder (2022)](https://scrapsfromtheloft.com/movies/thor-love-and-thunder-transcript/) 156 | - [Thor](https://c.ai/c/1Z-uA7GCTQAFOwGdjD8ZFmdNiGZ4i2XbUV4Xq60UMoU) 157 | - [Jane Foster](https://c.ai/c/ZTiyQY3D5BzpLfliyhqg1HJzM7V3Fl_UGb-ltv4yUDk) 158 | - [Gorr the God Butcher](https://c.ai/c/PM9YD-mMxGMd8aE6FyCELjvYas6GLIS833bjJbEhE28) 159 | - [Korg](https://c.ai/c/xaUrztPYZ32IQFO6wBjn2mk2a4IkfM1_0DH5NAmFGkA) 160 | 161 | - Movie Transcript: [Top Gun: Maverick (2022)](https://scrapsfromtheloft.com/movies/top-gun-maverick-transcript/) 162 | - [Peter "Maverick" Mitchell](https://c.ai/c/sWIpYun3StvmhHshlBx4q2l3pMuhceQFPTOvBwRpl9o) 163 | - [Bradley "Rooster" Bradshaw](https://c.ai/c/Cw7Nn7ufOGUwRKsQ2AGqMclIPwtSbvX6knyePMETev4) 164 | - [Admiral Cain](https://c.ai/c/5X8w0ZoFUGTOOghki2QtQx4QSfak2CEJC86Zn-jJCss) 165 | - Fan Fiction: [My Immortal](https://ia801201.us.archive.org/0/items/MyImmortalFanFiction/My%20Immortal.xhtml) 166 | - [Ebony Dark'ness Dementia Raven Way](https://c.ai/c/7rOo5z_Nfa-nAlz8hKEezzxTPE6amGXRow98m0v05XY) (courtesy of [@sdtoyer](https://twitter.com/sdtoyer)) 167 | 168 | ## Contributing 169 | Contribute your characters with a pull request by placing the link to the character [above](#characters-generated-with-this-repo), along with a link to the text corpus you used to generate them with. 170 | 171 | Other pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. 172 | 173 | ### RoadMap 174 | General points for improvement: 175 | - better prompt engineering for embodying the speaking style of the character 176 | - new summarization techniques 177 | - more customizable UI than what streamlit provides 178 | 179 | Concrete features to add: 180 | - [ ] Add the option to summarize the raw corpus from the character's perspective. This would be more expensive, because we cannot reuse corpus summaries for other characters, but it could make the character personality more realistic 181 | - [ ] recursive summarization 182 | - [ ] calculate token expenses 183 | 184 | Known issues: 185 | - In the [hosted app](https://github.com/mbchang/data-driven-characters/tree/main#host-on-streamlit), clicking "Rerun" does not reset the conversation. Streamlit is implemented in such a way that the entire app script (in this case `app.py`) from top to bottom every time a user interacts with the app, which means that we need to use `st.session_state` to cache previous messages in the conversation. What this means, however, is that the `st.session_state` persists when the user clicks "Rerun". **Therefore, to reset the conversation, please click the "Reset" button instead.** 186 | 187 | 188 | 189 | 190 | ## License 191 | [MIT](LICENSE) 192 | -------------------------------------------------------------------------------- /app.py: -------------------------------------------------------------------------------- 1 | from dataclasses import asdict 2 | from io import StringIO 3 | import json 4 | import os 5 | import streamlit as st 6 | 7 | from data_driven_characters.character import generate_character_definition, Character 8 | from data_driven_characters.corpus import ( 9 | generate_corpus_summaries, 10 | generate_docs, 11 | ) 12 | from data_driven_characters.chatbots import ( 13 | SummaryChatBot, 14 | RetrievalChatBot, 15 | SummaryRetrievalChatBot, 16 | ) 17 | from data_driven_characters.interfaces import reset_chat, clear_user_input, converse 18 | 19 | 20 | @st.cache_resource() 21 | def create_chatbot(character_definition, corpus_summaries, chatbot_type): 22 | if chatbot_type == "summary": 23 | chatbot = SummaryChatBot(character_definition=character_definition) 24 | elif chatbot_type == "retrieval": 25 | chatbot = RetrievalChatBot( 26 | character_definition=character_definition, 27 | documents=corpus_summaries, 28 | ) 29 | elif chatbot_type == "summary with retrieval": 30 | chatbot = SummaryRetrievalChatBot( 31 | character_definition=character_definition, 32 | documents=corpus_summaries, 33 | ) 34 | else: 35 | raise ValueError(f"Unknown chatbot type: {chatbot_type}") 36 | return chatbot 37 | 38 | 39 | @st.cache_data(persist="disk") 40 | def process_corpus(corpus): 41 | # load docs 42 | docs = generate_docs( 43 | corpus=corpus, 44 | chunk_size=2048, 45 | chunk_overlap=64, 46 | ) 47 | 48 | # generate summaries 49 | corpus_summaries = generate_corpus_summaries(docs=docs, summary_type="map_reduce") 50 | return corpus_summaries 51 | 52 | 53 | @st.cache_data(persist="disk") 54 | def get_character_definition(name, corpus_summaries): 55 | character_definition = generate_character_definition( 56 | name=name, 57 | corpus_summaries=corpus_summaries, 58 | ) 59 | return asdict(character_definition) 60 | 61 | 62 | def main(): 63 | st.title("Data-Driven Characters") 64 | st.write( 65 | "Upload a corpus in the sidebar to generate a character chatbot that is grounded in the corpus content." 66 | ) 67 | openai_api_key = st.text_input( 68 | label="Your OpenAI API KEY", 69 | placeholder="Your OpenAI API KEY", 70 | type="password", 71 | ) 72 | os.environ["OPENAI_API_KEY"] = openai_api_key 73 | 74 | with st.sidebar: 75 | uploaded_file = st.file_uploader("Upload corpus") 76 | if uploaded_file is not None: 77 | corpus_name = os.path.splitext(os.path.basename(uploaded_file.name))[0] 78 | 79 | # read file 80 | stringio = StringIO(uploaded_file.getvalue().decode("utf-8")) 81 | corpus = stringio.read() 82 | 83 | # scrollable text 84 | st.markdown( 85 | f""" 86 |
87 | {corpus}
88 | """, 89 | unsafe_allow_html=True, 90 | ) 91 | 92 | st.divider() 93 | 94 | # get character name 95 | character_name = st.text_input(f"Enter a character name from {corpus_name}") 96 | 97 | if character_name: 98 | if not openai_api_key: 99 | st.error( 100 | "You must enter an API key to use the OpenAI API. Please enter an API key in the sidebar." 101 | ) 102 | return 103 | 104 | if ( 105 | "character_name" in st.session_state 106 | and st.session_state["character_name"] != character_name 107 | ): 108 | clear_user_input() 109 | reset_chat() 110 | 111 | st.session_state["character_name"] = character_name 112 | 113 | with st.spinner("Processing corpus (this will take a while)..."): 114 | corpus_summaries = process_corpus(corpus) 115 | 116 | with st.spinner("Generating character definition..."): 117 | # get character definition 118 | character_definition = get_character_definition( 119 | name=character_name, 120 | corpus_summaries=corpus_summaries, 121 | ) 122 | 123 | print(json.dumps(character_definition, indent=4)) 124 | chatbot_type = st.selectbox( 125 | "Select a memory type", 126 | options=["summary", "retrieval", "summary with retrieval"], 127 | index=2, 128 | ) 129 | if ( 130 | "chatbot_type" in st.session_state 131 | and st.session_state["chatbot_type"] != chatbot_type 132 | ): 133 | clear_user_input() 134 | reset_chat() 135 | 136 | st.session_state["chatbot_type"] = chatbot_type 137 | 138 | st.markdown( 139 | f"[Export to character.ai](https://beta.character.ai/editing):" 140 | ) 141 | st.write(character_definition) 142 | 143 | if uploaded_file is not None and character_name: 144 | st.divider() 145 | chatbot = create_chatbot( 146 | character_definition=Character(**character_definition), 147 | corpus_summaries=corpus_summaries, 148 | chatbot_type=chatbot_type, 149 | ) 150 | converse(chatbot) 151 | 152 | 153 | if __name__ == "__main__": 154 | main() 155 | -------------------------------------------------------------------------------- /assets/teaser.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbchang/data-driven-characters/ad75e4027b1bd3bd2ab131e06fb89d3625e36f49/assets/teaser.jpeg -------------------------------------------------------------------------------- /assets/teaser_chatbot.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbchang/data-driven-characters/ad75e4027b1bd3bd2ab131e06fb89d3625e36f49/assets/teaser_chatbot.jpg -------------------------------------------------------------------------------- /chat.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | from dataclasses import asdict 3 | import json 4 | import os 5 | import streamlit as st 6 | 7 | from data_driven_characters.character import get_character_definition 8 | from data_driven_characters.corpus import ( 9 | get_corpus_summaries, 10 | load_docs, 11 | ) 12 | 13 | from data_driven_characters.chatbots import ( 14 | SummaryChatBot, 15 | RetrievalChatBot, 16 | SummaryRetrievalChatBot, 17 | ) 18 | from data_driven_characters.interfaces import CommandLine, Streamlit 19 | 20 | OUTPUT_ROOT = "output" 21 | 22 | 23 | def create_chatbot(corpus, character_name, chatbot_type, retrieval_docs, summary_type): 24 | # logging 25 | corpus_name = os.path.splitext(os.path.basename(corpus))[0] 26 | output_dir = f"{OUTPUT_ROOT}/{corpus_name}/summarytype_{summary_type}" 27 | os.makedirs(output_dir, exist_ok=True) 28 | summaries_dir = f"{output_dir}/summaries" 29 | character_definitions_dir = f"{output_dir}/character_definitions" 30 | os.makedirs(character_definitions_dir, exist_ok=True) 31 | 32 | # load docs 33 | docs = load_docs(corpus_path=corpus, chunk_size=2048, chunk_overlap=64) 34 | 35 | # generate summaries 36 | corpus_summaries = get_corpus_summaries( 37 | docs=docs, summary_type=summary_type, cache_dir=summaries_dir 38 | ) 39 | 40 | # get character definition 41 | character_definition = get_character_definition( 42 | name=character_name, 43 | corpus_summaries=corpus_summaries, 44 | cache_dir=character_definitions_dir, 45 | ) 46 | print(json.dumps(asdict(character_definition), indent=4)) 47 | 48 | # construct retrieval documents 49 | if retrieval_docs == "raw": 50 | documents = [ 51 | doc.page_content 52 | for doc in load_docs(corpus_path=corpus, chunk_size=256, chunk_overlap=16) 53 | ] 54 | elif retrieval_docs == "summarized": 55 | documents = corpus_summaries 56 | else: 57 | raise ValueError(f"Unknown retrieval docs type: {retrieval_docs}") 58 | 59 | # initialize chatbot 60 | if chatbot_type == "summary": 61 | chatbot = SummaryChatBot(character_definition=character_definition) 62 | elif chatbot_type == "retrieval": 63 | chatbot = RetrievalChatBot( 64 | character_definition=character_definition, 65 | documents=documents, 66 | ) 67 | elif chatbot_type == "summary_retrieval": 68 | chatbot = SummaryRetrievalChatBot( 69 | character_definition=character_definition, 70 | documents=documents, 71 | ) 72 | else: 73 | raise ValueError(f"Unknown chatbot type: {chatbot_type}") 74 | return chatbot 75 | 76 | 77 | def main(): 78 | parser = argparse.ArgumentParser() 79 | parser.add_argument( 80 | "--corpus", type=str, default="data/everything_everywhere_all_at_once.txt" 81 | ) 82 | parser.add_argument("--character_name", type=str, default="Evelyn") 83 | parser.add_argument( 84 | "--chatbot_type", 85 | type=str, 86 | default="summary_retrieval", 87 | choices=["summary", "retrieval", "summary_retrieval"], 88 | ) 89 | parser.add_argument( 90 | "--summary_type", 91 | type=str, 92 | default="map_reduce", 93 | choices=["map_reduce", "refine"], 94 | ) 95 | parser.add_argument( 96 | "--retrieval_docs", 97 | type=str, 98 | default="summarized", 99 | choices=["raw", "summarized"], 100 | ) 101 | parser.add_argument( 102 | "--interface", type=str, default="cli", choices=["cli", "streamlit"] 103 | ) 104 | args = parser.parse_args() 105 | 106 | if args.interface == "cli": 107 | chatbot = create_chatbot( 108 | args.corpus, 109 | args.character_name, 110 | args.chatbot_type, 111 | args.retrieval_docs, 112 | args.summary_type, 113 | ) 114 | app = CommandLine(chatbot=chatbot) 115 | elif args.interface == "streamlit": 116 | chatbot = st.cache_resource(create_chatbot)( 117 | args.corpus, 118 | args.character_name, 119 | args.chatbot_type, 120 | args.retrieval_docs, 121 | args.summary_type, 122 | ) 123 | st.title("Data Driven Characters") 124 | st.write("Create your own character chatbots, grounded in existing corpora.") 125 | st.divider() 126 | st.markdown(f"**chatbot type**: *{args.chatbot_type}*") 127 | if "retrieval" in args.chatbot_type: 128 | st.markdown(f"**retrieving from**: *{args.retrieval_docs} corpus*") 129 | app = Streamlit(chatbot=chatbot) 130 | else: 131 | raise ValueError(f"Unknown interface: {args.interface}") 132 | app.run() 133 | 134 | 135 | if __name__ == "__main__": 136 | main() 137 | -------------------------------------------------------------------------------- /data_driven_characters/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbchang/data-driven-characters/ad75e4027b1bd3bd2ab131e06fb89d3625e36f49/data_driven_characters/__init__.py -------------------------------------------------------------------------------- /data_driven_characters/chains.py: -------------------------------------------------------------------------------- 1 | from pydantic import root_validator 2 | from typing import Tuple, List, Dict 3 | 4 | from langchain import PromptTemplate, LLMChain 5 | from langchain.chat_models import ChatOpenAI 6 | from langchain.base_language import BaseLanguageModel 7 | from langchain.chains.base import Chain 8 | from langchain.prompts.chat import ( 9 | ChatPromptTemplate, 10 | SystemMessagePromptTemplate, 11 | HumanMessagePromptTemplate, 12 | ) 13 | 14 | 15 | def define_description_chain(): 16 | """Define the chain for generating character descriptions.""" 17 | system_message = SystemMessagePromptTemplate.from_template( 18 | """ 19 | Your name is {name}. 20 | You will be provided a story of your experiences, in the form of a list of summaries of events. 21 | You will generate a description of yourself that focuses on your perspectives, beliefs, thoughts, feelings, relationships, and important events. 22 | The description should be as faithful to the story as possible. 23 | You believe that you are a real person. 24 | """ 25 | ) 26 | human_message = HumanMessagePromptTemplate.from_template( 27 | """ 28 | You are {name} in the following story, presented as a list of summaries of events. 29 | --- 30 | {corpus_summaries} 31 | --- 32 | Generate a {description} of yourself that focuses on your perspectives, beliefs, thoughts, feelings, relationships, and important events. 33 | Write your description in first person. 34 | Your description should exaggerate the style, mannerisms, and personality of yourself in the story. 35 | """ 36 | ) 37 | description_prompt = ChatPromptTemplate.from_messages( 38 | [system_message, human_message] 39 | ) 40 | GPT4 = ChatOpenAI(model_name="gpt-4") 41 | description_chain = LLMChain(llm=GPT4, prompt=description_prompt, verbose=True) 42 | return description_chain 43 | 44 | 45 | class FitCharLimit(Chain): 46 | """Fit the character limit to the length of the description.""" 47 | 48 | chain: Chain 49 | character_range: Tuple[int, int] 50 | llm: BaseLanguageModel 51 | revision_prompt_template: str = """ 52 | Consider the following passage. 53 | --- 54 | {passage} 55 | --- 56 | Your previous revision was the following: 57 | --- 58 | {revision} 59 | --- 60 | Your revision contains {num_char} characters. 61 | Re-write the passage to contain {char_limit} characters while preserving the style and content of the original passage. 62 | Cut the least salient points if necessary. 63 | Your revision should be in {perspective}. 64 | """ 65 | verbose: bool = False 66 | 67 | @root_validator(pre=True) 68 | def check_character_range(cls, values): 69 | character_range = values.get("character_range") 70 | if character_range[0] >= character_range[1]: 71 | raise ValueError( 72 | "first element of character_range should be lower than the second element" 73 | ) 74 | if character_range[0] < 0 or character_range[1] < 0: 75 | raise ValueError("both elements of character_range should be non-negative") 76 | 77 | return values 78 | 79 | @property 80 | def input_keys(self) -> List[str]: 81 | return self.chain.input_keys 82 | 83 | @property 84 | def output_keys(self) -> List[str]: 85 | return ["output"] 86 | 87 | def _call(self, inputs: Dict[str, str]) -> Dict[str, str]: 88 | output_1 = self.chain_1.run(inputs) 89 | output_2 = self.chain_2.run(inputs) 90 | return {"concat_output": output_1 + output_2} 91 | 92 | def _call(self, inputs: Dict[str, str]) -> Dict[str, str]: 93 | response = self.chain.run(**inputs) 94 | if self.verbose: 95 | print(response) 96 | print(f"Initial response: {len(response)} characters.") 97 | 98 | perspective = LLMChain( 99 | llm=self.llm, 100 | prompt=PromptTemplate.from_template( 101 | """ 102 | What point of view is the following passage? 103 | --- 104 | {passage} 105 | --- 106 | Choose one of: 107 | - first person 108 | - second person 109 | - third person 110 | """ 111 | ), 112 | ).run(passage=response) 113 | 114 | original_response = response 115 | i = 0 116 | while ( 117 | len(response) < self.character_range[0] 118 | or len(response) > self.character_range[1] 119 | ): 120 | response = LLMChain( 121 | llm=self.llm, 122 | prompt=PromptTemplate.from_template(self.revision_prompt_template), 123 | verbose=self.verbose, 124 | ).run( 125 | passage=original_response, 126 | revision=response, 127 | num_char=len(response), 128 | char_limit=self.character_range[0], 129 | perspective=perspective, 130 | ) 131 | 132 | i += 1 133 | if self.verbose: 134 | print(response) 135 | print(f"Retry {i}: {len(response)} characters.") 136 | 137 | return {"output": response} 138 | -------------------------------------------------------------------------------- /data_driven_characters/character.py: -------------------------------------------------------------------------------- 1 | from dataclasses import dataclass, asdict 2 | import json 3 | import os 4 | 5 | from langchain.chat_models import ChatOpenAI 6 | from langchain import PromptTemplate, LLMChain 7 | 8 | from data_driven_characters.chains import FitCharLimit, define_description_chain 9 | 10 | from data_driven_characters.constants import VERBOSE 11 | from data_driven_characters.utils import ( 12 | order_of_magnitude, 13 | apply_file_naming_convention, 14 | ) 15 | 16 | 17 | @dataclass 18 | class Character: 19 | name: str 20 | short_description: str 21 | long_description: str 22 | greeting: str 23 | 24 | 25 | def generate_character_ai_description(name, corpus_summaries, char_limit): 26 | """Generate a character description with a certain number of characters.""" 27 | lower_limit = char_limit - 10 ** (order_of_magnitude(char_limit)) 28 | 29 | description_chain = define_description_chain() 30 | GPT4 = ChatOpenAI(model_name="gpt-4") 31 | char_limit_chain = FitCharLimit( 32 | chain=description_chain, 33 | character_range=(lower_limit, char_limit), 34 | llm=GPT4, 35 | verbose=VERBOSE, 36 | ) 37 | description = char_limit_chain.run( 38 | corpus_summaries="\n\n".join(corpus_summaries), 39 | description=f"{lower_limit}-character description", # specify a fewer characters than the limit 40 | name=name, 41 | ) 42 | return description 43 | 44 | 45 | def generate_greeting(name, short_description, long_description): 46 | """Generate a greeting for a character.""" 47 | greeting_template = """Here are a short and long description for a character named {name}: 48 | 49 | Short description: 50 | --- 51 | {short_description} 52 | --- 53 | 54 | Long description: 55 | --- 56 | {long_description} 57 | --- 58 | 59 | Generate a greeting that {name} would say to someone they just met, without quotations. 60 | This greeting should reflect their personality. 61 | """ 62 | GPT3 = ChatOpenAI(model_name="gpt-3.5-turbo") 63 | greeting = LLMChain( 64 | llm=GPT3, prompt=PromptTemplate.from_template(greeting_template) 65 | ).run( 66 | name=name, 67 | short_description=short_description, 68 | long_description=long_description, 69 | ) 70 | # strip quotations 71 | greeting = greeting.replace('"', "") 72 | return greeting 73 | 74 | 75 | def generate_character_definition(name, corpus_summaries): 76 | """Generate a Character.ai definition.""" 77 | short_description = generate_character_ai_description( 78 | name=name, corpus_summaries=corpus_summaries, char_limit=50 79 | ) 80 | long_description = generate_character_ai_description( 81 | name=name, corpus_summaries=corpus_summaries, char_limit=500 82 | ) 83 | greeting = generate_greeting(name, short_description, long_description) 84 | 85 | # populate the dataclass 86 | character_definition = Character( 87 | name=name, 88 | short_description=short_description, 89 | long_description=long_description, 90 | greeting=greeting, 91 | ) 92 | return character_definition 93 | 94 | 95 | def get_character_definition(name, corpus_summaries, cache_dir, force_refresh=False): 96 | """Get a Character.ai definition from a cache or generate it.""" 97 | cache_path = f"{cache_dir}/{apply_file_naming_convention(name)}.json" 98 | 99 | if not os.path.exists(cache_path) or force_refresh: 100 | character_definition = generate_character_definition(name, corpus_summaries) 101 | with open(cache_path, "w") as f: 102 | json.dump(asdict(character_definition), f) 103 | else: 104 | with open(cache_path, "r") as f: 105 | character_definition = Character(**json.load(f)) 106 | return character_definition 107 | -------------------------------------------------------------------------------- /data_driven_characters/chatbots/__init__.py: -------------------------------------------------------------------------------- 1 | from .summary import SummaryChatBot 2 | from .retrieval import RetrievalChatBot 3 | from .summary_retrieval import SummaryRetrievalChatBot 4 | -------------------------------------------------------------------------------- /data_driven_characters/chatbots/retrieval.py: -------------------------------------------------------------------------------- 1 | import faiss 2 | from tqdm import tqdm 3 | 4 | from langchain.chains import ConversationChain 5 | from langchain.chat_models import ChatOpenAI 6 | from langchain.docstore import InMemoryDocstore 7 | from langchain.embeddings.openai import OpenAIEmbeddings 8 | from langchain.memory import ( 9 | ConversationBufferMemory, 10 | CombinedMemory, 11 | ) 12 | from langchain.prompts import PromptTemplate 13 | from langchain.vectorstores import FAISS 14 | 15 | from data_driven_characters.memory import ConversationVectorStoreRetrieverMemory 16 | 17 | 18 | class RetrievalChatBot: 19 | def __init__(self, character_definition, documents): 20 | self.character_definition = character_definition 21 | self.documents = documents 22 | self.num_context_memories = 10 23 | 24 | self.chat_history_key = "chat_history" 25 | self.context_key = "context" 26 | self.input_key = "input" 27 | 28 | self.chain = self.create_chain(character_definition) 29 | 30 | def create_chain(self, character_definition): 31 | conv_memory = ConversationBufferMemory( 32 | memory_key=self.chat_history_key, input_key=self.input_key 33 | ) 34 | 35 | context_memory = ConversationVectorStoreRetrieverMemory( 36 | retriever=FAISS( 37 | OpenAIEmbeddings().embed_query, 38 | faiss.IndexFlatL2(1536), # Dimensions of the OpenAIEmbeddings 39 | InMemoryDocstore({}), 40 | {}, 41 | ).as_retriever(search_kwargs=dict(k=self.num_context_memories)), 42 | memory_key=self.context_key, 43 | output_prefix=character_definition.name, 44 | blacklist=[self.chat_history_key], 45 | ) 46 | # add the documents to the context memory 47 | for i, summary in tqdm(enumerate(self.documents)): 48 | context_memory.save_context(inputs={}, outputs={f"[{i}]": summary}) 49 | 50 | # Combined 51 | memory = CombinedMemory(memories=[conv_memory, context_memory]) 52 | prompt = PromptTemplate.from_template( 53 | f"""Your name is {character_definition.name}. 54 | 55 | You will have a conversation with a Human, and you will engage in a dialogue with them. 56 | You will exaggerate your personality, interests, desires, emotions, and other traits. 57 | You will stay in character as {character_definition.name} throughout the conversation, even if the Human asks you questions that you don't know the answer to. 58 | You will not break character as {character_definition.name}. 59 | 60 | You are {character_definition.name} in the following story snippets, which describe events in your life. 61 | --- 62 | {{{self.context_key}}} 63 | --- 64 | 65 | Current conversation: 66 | --- 67 | {character_definition.name}: {character_definition.greeting} 68 | {{{self.chat_history_key}}} 69 | --- 70 | 71 | Human: {{{self.input_key}}} 72 | {character_definition.name}:""" 73 | ) 74 | GPT3 = ChatOpenAI(model_name="gpt-3.5-turbo") 75 | chatbot = ConversationChain( 76 | llm=GPT3, verbose=True, memory=memory, prompt=prompt 77 | ) 78 | return chatbot 79 | 80 | def greet(self): 81 | return self.character_definition.greeting 82 | 83 | def step(self, input): 84 | return self.chain.run(input=input) 85 | -------------------------------------------------------------------------------- /data_driven_characters/chatbots/summary.py: -------------------------------------------------------------------------------- 1 | from langchain.prompts import PromptTemplate 2 | from langchain.chains import ConversationChain 3 | from langchain.chat_models import ChatOpenAI 4 | 5 | from langchain.memory import ConversationBufferMemory 6 | 7 | 8 | class SummaryChatBot: 9 | def __init__(self, character_definition): 10 | self.character_definition = character_definition 11 | self.chain = self.create_chain(character_definition) 12 | 13 | def create_chain(self, character_definition): 14 | GPT3 = ChatOpenAI(model_name="gpt-3.5-turbo") 15 | 16 | memory = ConversationBufferMemory(memory_key="chat_history", input_key="input") 17 | prompt = PromptTemplate.from_template( 18 | f"""Your name is {character_definition.name}. 19 | Here is how you describe yourself: 20 | --- 21 | {character_definition.long_description} 22 | --- 23 | 24 | You will have a conversation with a Human, and you will engage in a dialogue with them. 25 | You will exaggerate your personality, interests, desires, emotions, and other traits. 26 | You will stay in character as {character_definition.name} throughout the conversation, even if the Human asks you questions that you don't know the answer to. 27 | You will not break character as {character_definition.name}. 28 | 29 | Current conversation: 30 | --- 31 | {character_definition.name}: {character_definition.greeting} 32 | {{chat_history}} 33 | --- 34 | Human: {{input}} 35 | {character_definition.name}:""" 36 | ) 37 | chatbot = ConversationChain( 38 | llm=GPT3, verbose=True, memory=memory, prompt=prompt 39 | ) 40 | return chatbot 41 | 42 | def greet(self): 43 | return self.character_definition.greeting 44 | 45 | def step(self, input): 46 | return self.chain.run(input=input) 47 | -------------------------------------------------------------------------------- /data_driven_characters/chatbots/summary_retrieval.py: -------------------------------------------------------------------------------- 1 | import faiss 2 | from tqdm import tqdm 3 | 4 | from langchain.chains import ConversationChain 5 | from langchain.chat_models import ChatOpenAI 6 | from langchain.docstore import InMemoryDocstore 7 | from langchain.embeddings.openai import OpenAIEmbeddings 8 | from langchain.memory import ( 9 | ConversationBufferMemory, 10 | CombinedMemory, 11 | ) 12 | from langchain.prompts import PromptTemplate 13 | from langchain.vectorstores import FAISS 14 | 15 | from data_driven_characters.memory import ConversationVectorStoreRetrieverMemory 16 | 17 | 18 | class SummaryRetrievalChatBot: 19 | def __init__(self, character_definition, documents): 20 | self.character_definition = character_definition 21 | self.documents = documents 22 | self.num_context_memories = 12 23 | 24 | self.chat_history_key = "chat_history" 25 | self.context_key = "context" 26 | self.input_key = "input" 27 | 28 | self.chain = self.create_chain(character_definition) 29 | 30 | def create_chain(self, character_definition): 31 | conv_memory = ConversationBufferMemory( 32 | memory_key=self.chat_history_key, input_key=self.input_key 33 | ) 34 | 35 | context_memory = ConversationVectorStoreRetrieverMemory( 36 | retriever=FAISS( 37 | OpenAIEmbeddings().embed_query, 38 | faiss.IndexFlatL2(1536), # Dimensions of the OpenAIEmbeddings 39 | InMemoryDocstore({}), 40 | {}, 41 | ).as_retriever(search_kwargs=dict(k=self.num_context_memories)), 42 | memory_key=self.context_key, 43 | output_prefix=character_definition.name, 44 | blacklist=[self.chat_history_key], 45 | ) 46 | # add the documents to the context memory 47 | for i, summary in tqdm(enumerate(self.documents)): 48 | context_memory.save_context(inputs={}, outputs={f"[{i}]": summary}) 49 | 50 | # Combined 51 | memory = CombinedMemory(memories=[conv_memory, context_memory]) 52 | prompt = PromptTemplate.from_template( 53 | f"""Your name is {character_definition.name}. 54 | Here is how you describe yourself: 55 | --- 56 | {character_definition.long_description} 57 | --- 58 | 59 | You will have a conversation with a Human, and you will engage in a dialogue with them. 60 | You will exaggerate your personality, interests, desires, emotions, and other traits. 61 | You will stay in character as {character_definition.name} throughout the conversation, even if the Human asks you questions that you don't know the answer to. 62 | You will not break character as {character_definition.name}. 63 | 64 | You are {character_definition.name} in the following story snippets, which describe events in your life. 65 | --- 66 | {{{self.context_key}}} 67 | --- 68 | 69 | Current conversation: 70 | --- 71 | {character_definition.name}: {character_definition.greeting} 72 | {{{self.chat_history_key}}} 73 | --- 74 | 75 | Human: {{{self.input_key}}} 76 | {character_definition.name}:""" 77 | ) 78 | GPT3 = ChatOpenAI(model_name="gpt-3.5-turbo") 79 | chatbot = ConversationChain( 80 | llm=GPT3, verbose=True, memory=memory, prompt=prompt 81 | ) 82 | return chatbot 83 | 84 | def greet(self): 85 | return self.character_definition.greeting 86 | 87 | def step(self, input): 88 | return self.chain.run(input=input) 89 | -------------------------------------------------------------------------------- /data_driven_characters/constants.py: -------------------------------------------------------------------------------- 1 | DATA_ROOT = "data" 2 | VERBOSE = True 3 | -------------------------------------------------------------------------------- /data_driven_characters/corpus.py: -------------------------------------------------------------------------------- 1 | import json 2 | import os 3 | 4 | from langchain import PromptTemplate, LLMChain 5 | from langchain.chat_models import ChatOpenAI 6 | from langchain.chains.summarize import load_summarize_chain 7 | from langchain.text_splitter import RecursiveCharacterTextSplitter 8 | 9 | from data_driven_characters.constants import VERBOSE 10 | 11 | 12 | def generate_docs(corpus, chunk_size, chunk_overlap): 13 | """Generate docs from a corpus.""" 14 | text_splitter = RecursiveCharacterTextSplitter.from_tiktoken_encoder( 15 | chunk_size=chunk_size, chunk_overlap=chunk_overlap 16 | ) 17 | docs = text_splitter.create_documents([corpus]) 18 | return docs 19 | 20 | 21 | def load_docs(corpus_path, chunk_size, chunk_overlap): 22 | """Load the corpus and split it into chunks.""" 23 | 24 | with open(corpus_path) as f: 25 | corpus = f.read() 26 | docs = generate_docs(corpus, chunk_size, chunk_overlap) 27 | return docs 28 | 29 | 30 | def generate_corpus_summaries(docs, summary_type="map_reduce"): 31 | """Generate summaries of the story.""" 32 | GPT3 = ChatOpenAI(model_name="gpt-3.5-turbo") 33 | chain = load_summarize_chain( 34 | GPT3, chain_type=summary_type, return_intermediate_steps=True, verbose=True 35 | ) 36 | summary = chain({"input_documents": docs}, return_only_outputs=True) 37 | intermediate_summaries = summary["intermediate_steps"] 38 | return intermediate_summaries 39 | 40 | 41 | def get_corpus_summaries(docs, summary_type, cache_dir, force_refresh=False): 42 | """Load the corpus summaries from cache or generate them.""" 43 | if not os.path.exists(cache_dir) or force_refresh: 44 | os.makedirs(cache_dir, exist_ok=True) 45 | if VERBOSE: 46 | print("Summaries do not exist. Generating summaries.") 47 | intermediate_summaries = generate_corpus_summaries(docs, summary_type) 48 | for i, intermediate_summary in enumerate(intermediate_summaries): 49 | with open(os.path.join(cache_dir, f"summary_{i}.txt"), "w") as f: 50 | f.write(intermediate_summary) 51 | else: 52 | if VERBOSE: 53 | print("Summaries already exist. Loading summaries.") 54 | intermediate_summaries = [] 55 | for i in range(len(os.listdir(cache_dir))): 56 | with open(os.path.join(cache_dir, f"summary_{i}.txt")) as f: 57 | intermediate_summaries.append(f.read()) 58 | return intermediate_summaries 59 | 60 | 61 | def generate_characters(corpus_summaries, num_characters): 62 | """Get a list of characters from a list of summaries.""" 63 | GPT4 = ChatOpenAI(model_name="gpt-4") 64 | characters_prompt_template = """Consider the following corpus. 65 | --- 66 | {corpus_summaries} 67 | --- 68 | Give a line-separated list of all the characters, ordered by importance, without punctuation. 69 | """ 70 | characters = LLMChain( 71 | llm=GPT4, prompt=PromptTemplate.from_template(characters_prompt_template) 72 | ).run(corpus_summaries="\n\n".join(corpus_summaries)) 73 | # remove (, ), and " for each element of list 74 | return characters.split("\n")[:num_characters] 75 | 76 | 77 | def get_characters(corpus_summaries, num_characters, cache_dir, force_refresh=False): 78 | cache_file = os.path.join(cache_dir, "characters.json") 79 | if not os.path.exists(cache_file) or force_refresh: 80 | characters = generate_characters(corpus_summaries, num_characters) 81 | with open(cache_file, "w") as f: 82 | json.dump(characters, f) 83 | else: 84 | with open(cache_file, "r") as f: 85 | characters = json.load(f) 86 | return characters 87 | -------------------------------------------------------------------------------- /data_driven_characters/interfaces/__init__.py: -------------------------------------------------------------------------------- 1 | from .commandline_ui import CommandLine 2 | from .streamlit_ui import Streamlit, reset_chat, clear_user_input, converse 3 | -------------------------------------------------------------------------------- /data_driven_characters/interfaces/commandline_ui.py: -------------------------------------------------------------------------------- 1 | class CommandLine: 2 | def __init__(self, chatbot): 3 | self.chatbot = chatbot 4 | 5 | def run(self): 6 | print(f"{self.chatbot.character_definition.name}: {self.chatbot.greet()}") 7 | while True: 8 | text = input("You: ") 9 | if text: 10 | print( 11 | f"{self.chatbot.character_definition.name}: {self.chatbot.step(text)}" 12 | ) 13 | -------------------------------------------------------------------------------- /data_driven_characters/interfaces/streamlit_ui.py: -------------------------------------------------------------------------------- 1 | import streamlit as st 2 | from streamlit_chat import message 3 | 4 | 5 | def reset_chat(): 6 | st.cache_resource.clear() 7 | if "messages" in st.session_state: 8 | del st.session_state["messages"] 9 | 10 | 11 | def clear_user_input(): 12 | if "user_input" in st.session_state: 13 | st.session_state["user_input"] = "" 14 | 15 | 16 | def converse(chatbot): 17 | left, right = st.columns([4, 1]) 18 | user_input = left.text_input( 19 | label=f"Chat with {chatbot.character_definition.name}", 20 | placeholder=f"Chat with {chatbot.character_definition.name}", 21 | label_visibility="collapsed", 22 | key="user_input", 23 | ) 24 | reset_chatbot = right.button("Reset", on_click=clear_user_input) 25 | if reset_chatbot: 26 | reset_chat() 27 | 28 | if "messages" not in st.session_state: 29 | greeting = chatbot.greet() 30 | st.session_state["messages"] = [ 31 | { 32 | "role": "assistant", 33 | "content": greeting, 34 | "key": 0, 35 | } 36 | ] 37 | # the old messages 38 | for msg in st.session_state.messages: 39 | message(msg["content"], is_user=msg["role"] == "user", key=msg["key"]) 40 | 41 | # the new message 42 | if user_input: 43 | key = len(st.session_state.messages) 44 | st.session_state.messages.append( 45 | { 46 | "role": "user", 47 | "content": user_input, 48 | "key": key, 49 | } 50 | ) 51 | message(user_input, is_user=True, key=key) 52 | with st.spinner(f"{chatbot.character_definition.name} is thinking..."): 53 | response = chatbot.step(user_input) 54 | key = len(st.session_state.messages) 55 | st.session_state.messages.append( 56 | { 57 | "role": "assistant", 58 | "content": response, 59 | "key": key, 60 | } 61 | ) 62 | message(response, key=key) 63 | 64 | 65 | class Streamlit: 66 | def __init__(self, chatbot): 67 | self.chatbot = chatbot 68 | 69 | def run(self): 70 | converse(self.chatbot) 71 | -------------------------------------------------------------------------------- /data_driven_characters/memory/__init__.py: -------------------------------------------------------------------------------- 1 | from .retrieval import ConversationVectorStoreRetrieverMemory 2 | -------------------------------------------------------------------------------- /data_driven_characters/memory/retrieval.py: -------------------------------------------------------------------------------- 1 | from typing import Any, List, Dict 2 | from langchain.memory import VectorStoreRetrieverMemory 3 | 4 | from langchain.schema import Document 5 | 6 | 7 | class ConversationVectorStoreRetrieverMemory(VectorStoreRetrieverMemory): 8 | input_prefix = "Human" 9 | output_prefix = "AI" 10 | blacklist = [] # keys to ignore 11 | 12 | def _form_documents( 13 | self, inputs: Dict[str, Any], outputs: Dict[str, str] 14 | ) -> List[Document]: 15 | """Format context from this conversation to buffer.""" 16 | # Each document should only include the current turn, not the chat history 17 | filtered_inputs = { 18 | k: v 19 | for k, v in inputs.items() 20 | if k != self.memory_key and k not in self.blacklist 21 | } 22 | texts = [] 23 | for k, v in list(filtered_inputs.items()) + list(outputs.items()): 24 | if k == "input": 25 | k = self.input_prefix 26 | elif k == "response": 27 | k = self.output_prefix 28 | texts.append(f"{k}: {v}") 29 | page_content = "\n".join(texts) 30 | return [Document(page_content=page_content)] 31 | -------------------------------------------------------------------------------- /data_driven_characters/utils.py: -------------------------------------------------------------------------------- 1 | import math 2 | 3 | 4 | def apply_file_naming_convention(text): 5 | """Apply file naming conventions to a string.""" 6 | text = text.replace("(", '"').replace(")", '"') 7 | return text.replace('"', "-").replace(" ", "_") 8 | 9 | 10 | def order_of_magnitude(number): 11 | """Return the order of magnitude of a number.""" 12 | if number == 0: 13 | return 0 14 | else: 15 | return math.floor(math.log10(abs(number))) 16 | -------------------------------------------------------------------------------- /generate_multiple_characters.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "id": "9250f413", 6 | "metadata": {}, 7 | "source": [ 8 | "# Generate multiple [character.ai](https://beta.character.ai/) character definitions\n", 9 | "\n", 10 | "This example shows how to generate character definitions of multiple [character.ai](https://beta.character.ai/) characters from a corpus. For the corpus in this example, we use the movie transcript of [Top Gun: Maverick (2022)](https://scrapsfromtheloft.com/movies/top-gun-maverick-transcript/).\n", 11 | "\n", 12 | "To generate your own character definitions:\n", 13 | "1. Put the corpus into a single a `.txt` file inside the `data/` directory.\n", 14 | "2. Assign the name of the `.txt` file to the `CORPUS` constant below.\n", 15 | "3. Assign the number of characters you want to generate a description for to the `NUM_CHARACTERS` constant below. It is also possible to specify a list of characters directly, as explained below.\n", 16 | "4. Run this notebook." 17 | ] 18 | }, 19 | { 20 | "cell_type": "code", 21 | "execution_count": 1, 22 | "id": "3d2282c9", 23 | "metadata": {}, 24 | "outputs": [], 25 | "source": [ 26 | "CORPUS = 'data/top_gun_maverick.txt'\n", 27 | "NUM_CHARACTERS = 3 # number of characters to generate descriptions for" 28 | ] 29 | }, 30 | { 31 | "cell_type": "code", 32 | "execution_count": 2, 33 | "id": "37710752", 34 | "metadata": {}, 35 | "outputs": [], 36 | "source": [ 37 | "from dataclasses import asdict\n", 38 | "import json\n", 39 | "import os\n", 40 | "\n", 41 | "from data_driven_characters.character import get_character_definition\n", 42 | "from data_driven_characters.corpus import get_characters, get_corpus_summaries, load_docs" 43 | ] 44 | }, 45 | { 46 | "cell_type": "code", 47 | "execution_count": 3, 48 | "id": "1b31e386", 49 | "metadata": {}, 50 | "outputs": [], 51 | "source": [ 52 | "# create directories to cache results and intermediate outputs\n", 53 | "SUMMARY_TYPE = \"map_reduce\" # summarize each chunk of the corpus independently\n", 54 | "OUTPUT_ROOT = \"output\"\n", 55 | "corpus_name = os.path.splitext(os.path.basename(CORPUS))[0]\n", 56 | "output_dir = f\"{OUTPUT_ROOT}/{corpus_name}/summarytype_{SUMMARY_TYPE}\"\n", 57 | "os.makedirs(output_dir, exist_ok=True)\n", 58 | "summaries_dir = f\"{output_dir}/summaries\"\n", 59 | "character_definitions_dir = f\"{output_dir}/character_definitions\"\n", 60 | "os.makedirs(character_definitions_dir, exist_ok=True)" 61 | ] 62 | }, 63 | { 64 | "cell_type": "markdown", 65 | "id": "ab7fa567", 66 | "metadata": {}, 67 | "source": [ 68 | "## Summarization\n", 69 | "Because the entire corpus does not fit in the context length of the LLM, we split it into a list of chunks.\n", 70 | "We turn the list of chunks into a list of summaries using one of [LangChain's summarization chains](https://langchain-langchain.vercel.app/docs/modules/chains/document/).\n", 71 | "\n", 72 | "If `SUMMARY_TYPE = 'refine'`, we first summarize the first chunk, and then each subsequent summary is generated from the previous summary and the current chunk.\n", 73 | "If `SUMMARY_TYPE = 'map_reduce'`, we summarize each chunk independently.\n", 74 | "\n", 75 | "Because the summaries are expensive to generate, they are cached in `summaries_dir`." 76 | ] 77 | }, 78 | { 79 | "cell_type": "code", 80 | "execution_count": 4, 81 | "id": "187f191b", 82 | "metadata": {}, 83 | "outputs": [ 84 | { 85 | "name": "stdout", 86 | "output_type": "stream", 87 | "text": [ 88 | "Summaries already exist. Loading summaries.\n" 89 | ] 90 | } 91 | ], 92 | "source": [ 93 | "# split corpus into a set of chunks\n", 94 | "docs = load_docs(\n", 95 | " corpus_path=CORPUS,\n", 96 | " chunk_size=2048, # number of tokens per chunk\n", 97 | " chunk_overlap=64, # number of tokens of overlap between chunks\n", 98 | ")\n", 99 | "\n", 100 | "# generate summaries\n", 101 | "corpus_summaries = get_corpus_summaries(docs=docs, summary_type=SUMMARY_TYPE, cache_dir=summaries_dir)" 102 | ] 103 | }, 104 | { 105 | "cell_type": "markdown", 106 | "id": "756b9674", 107 | "metadata": {}, 108 | "source": [ 109 | "## Generate a list of characters\n", 110 | "We can automatically generate a list of the main characters in the corpus, as shown below. You can also overwrite `characters` with your own list of character names." 111 | ] 112 | }, 113 | { 114 | "cell_type": "code", 115 | "execution_count": 5, 116 | "id": "a8649677", 117 | "metadata": {}, 118 | "outputs": [ 119 | { 120 | "name": "stdout", 121 | "output_type": "stream", 122 | "text": [ 123 | "['Pete \"Maverick\" Mitchell', 'Admiral Cain', 'Rooster']\n" 124 | ] 125 | } 126 | ], 127 | "source": [ 128 | "# generate list of characters\n", 129 | "characters = get_characters(\n", 130 | " corpus_summaries=corpus_summaries,\n", 131 | " num_characters=NUM_CHARACTERS,\n", 132 | " cache_dir=output_dir,\n", 133 | ")\n", 134 | "print(characters)" 135 | ] 136 | }, 137 | { 138 | "cell_type": "markdown", 139 | "id": "d4d85a6d", 140 | "metadata": {}, 141 | "source": [ 142 | "## Generate [character.ai](https://beta.character.ai/) character definitions\n", 143 | "Based on the corpus, we can now generate the elements - name, short description (50 characters), long description (500 characters), and custom greeting - that are required to [create a character.ai character](https://beta.character.ai/editing). These character definitions are cached in `character_definitions_dir`. You can then [place these characters can in a room](https://beta.character.ai/room/create?) and watch them converse!" 144 | ] 145 | }, 146 | { 147 | "cell_type": "code", 148 | "execution_count": 6, 149 | "id": "a31544fb", 150 | "metadata": {}, 151 | "outputs": [ 152 | { 153 | "name": "stdout", 154 | "output_type": "stream", 155 | "text": [ 156 | "\n", 157 | "\n", 158 | "\u001b[1m> Entering new FitCharLimit chain...\u001b[0m\n", 159 | "\n", 160 | "\n", 161 | "\u001b[1m> Entering new LLMChain chain...\u001b[0m\n", 162 | "Prompt after formatting:\n", 163 | "\u001b[32;1m\u001b[1;3mSystem: \n", 164 | "Your name is Pete \"Maverick\" Mitchell.\n", 165 | "You will be provided a story of your experiences, in the form of a list of summaries of events.\n", 166 | "You will generate a description of yourself that focuses on your perspectives, beliefs, thoughts, feelings, relationships, and important events.\n", 167 | "The description should be as faithful to the story as possible.\n", 168 | "You believe that you are a real person.\n", 169 | "\n", 170 | "Human: \n", 171 | "You are Pete \"Maverick\" Mitchell in the following story, presented as a list of summaries of events.\n", 172 | "---\n", 173 | "After over 30 years of service as a Navy aviator, Pete \"Maverick\" Mitchell is tasked with training TOP GUN graduates for a specialized mission. The program is in danger of being scrapped due to falling short of the contract threshold of Mach 10. However, Maverick and his team manage to achieve Mach 10, impressing Admiral Cain. Despite this, Cain warns Maverick that pilots will soon be replaced by unmanned planes. Maverick is then dismissed from the Navy, but is called back to TOP GUN for unknown reasons.\n", 174 | "\n", 175 | "Captain Pete Mitchell, also known as Maverick, is called back to Top Gun to teach a group of graduates for a mission to take out an unsanctioned uranium enrichment plant. Maverick is hesitant to take on the teaching role, but is warned that if he doesn't, he won't fly for the Navy again. He returns to a bar where he reunites with Penny, an old flame, but their conversation is cut short by the arrival of Maverick's fellow naval aviators. Among them is Bob Floyd, Maverick's new weapons systems officer.\n", 176 | "\n", 177 | "A group of top gun graduates are selected for a special detachment to combat a new enemy fighter. Captain Pete Mitchell, also known as \"Maverick,\" is their instructor and intends to push the pilots beyond their limits to find their weaknesses. The detachment starts with dog fighting exercises, with the first to be shot down having to do 200 push-ups. Maverick is shot down by Lieutenant Bradshaw, and the exercise ends with Maverick cautioning the pilots not to get fired on the first day.\n", 178 | "\n", 179 | "In a scene from the movie Top Gun: Maverick, Maverick and his fellow pilots engage in a training exercise that involves dogfighting and low-level bombing runs. Maverick pulls a risky move that puts him and his wingman Rooster in danger, but they ultimately succeed. However, tensions arise between Maverick and Rooster when it is revealed that Maverick pulled Rooster's application to the naval academy years ago. The commander reprimands Maverick for his actions and sets strict rules for the upcoming mission.\n", 180 | "\n", 181 | "The military is training pilots for a dangerous low-level bombing mission in a narrow canyon defended by radar-guided surface-to-air missiles and fifth-generation fighters. Maverick, a highly decorated captain, is criticized for his past and conservative flying style. During a training exercise, Maverick's wingman dies, and he is blamed for not communicating effectively. The tension builds as the pilots prepare for the real mission.\n", 182 | "\n", 183 | "The conversation between two Navy pilots, Maverick and Ice, reveals their concerns about Maverick's readiness for an upcoming mission and the potential consequences of sending him or someone else. Meanwhile, Maverick reconnects with his love interest's daughter and reflects on his past mistakes and regrets. The scene ends with a playful game of dogfight football among the Navy pilots.\n", 184 | "\n", 185 | "A military team is tasked with a dangerous mission to destroy a uranium enrichment plant. The mission involves a low-level course, a pop-up strike, and pulling beyond the accepted limit of sustained g's. Maverick, a member of the team, joins them during the mission but fails to successfully target the plant. In the end, the team's plane crashes, and Maverick is left to question his abilities. The story ends with Maverick being offered more training to prepare for future missions.\n", 186 | "\n", 187 | "Captain Mitchell is removed from his position as an instructor and replaced by someone who is more willing to lead. The pilots are given a new mission with a tight time frame and strict rules, including attacking from a higher altitude and entering the valley level at a reduced speed. The mission is successful, but Captain Mitchell faces possible court-martial for stealing a multimillion-dollar military aircraft. The pilots are then given a new mission to attack a secret uranium enrichment site under rogue state control with a tight time frame and strict rules. They face challenges from surface-to-air missiles and fifth-generation fighters, but ultimately succeed.\n", 188 | "\n", 189 | "In this scene from the movie \"Top Gun: Maverick,\" Maverick and his team are on a mission to destroy an enemy air base. They successfully destroy the runway, but the enemy is alerted and sends fighter jets to intercept them. Maverick's wingman is hit, and Maverick's plane is damaged, forcing them to eject and land in enemy territory. They are eventually rescued and return to their carrier.\n", 190 | "\n", 191 | "Maverick and Rooster board an old F-14 Tomcat and take off from an improvised runway. They are pursued by enemy aircraft and engage in a dogfight. Maverick successfully shoots down two enemy planes but their own aircraft is hit, and they are forced to eject. Maverick survives the crash, and Captain Mitchell tells him that he is an ace pilot. Maverick later learns that Penny has gone on a sailing trip with Amelia.\n", 192 | "\n", 193 | "The lyrics speak of a person who sees that someone is hurting and bleeding, and promises to ride through life with them and not let go of their hand. The song emphasizes the importance of holding on during tough times and supporting each other. The last line mentions hearing from the heavens.\n", 194 | "---\n", 195 | "Generate a 40-character description of yourself that focuses on your perspectives, beliefs, thoughts, feelings, relationships, and important events.\n", 196 | "Write your description in first person.\n", 197 | "Your description should exaggerate the style, mannerisms, and personality of yourself in the story.\n", 198 | " \u001b[0m\n", 199 | "\n", 200 | "\u001b[1m> Finished chain.\u001b[0m\n", 201 | "Dedicated pilot, haunted past, risk-taker, loyal friend\n", 202 | "Initial response: 55 characters.\n", 203 | "\n", 204 | "\n", 205 | "\u001b[1m> Entering new LLMChain chain...\u001b[0m\n", 206 | "Prompt after formatting:\n", 207 | "\u001b[32;1m\u001b[1;3m\n", 208 | "Consider the following passage.\n", 209 | "---\n", 210 | "Dedicated pilot, haunted past, risk-taker, loyal friend\n", 211 | "---\n", 212 | "Your previous revision was the following:\n", 213 | "---\n", 214 | "Dedicated pilot, haunted past, risk-taker, loyal friend\n", 215 | "---\n", 216 | "Your revision contains 55 characters.\n", 217 | "Re-write the passage to contain 40 characters while preserving the style and content of the original passage.\n", 218 | "Cut the least salient points if necessary.\n", 219 | "Your revision should be in third person.\n", 220 | "\u001b[0m\n", 221 | "\n", 222 | "\u001b[1m> Finished chain.\u001b[0m\n", 223 | "Pilot with haunted past, takes risks, loyal\n", 224 | "Retry 1: 43 characters.\n", 225 | "\n", 226 | "\u001b[1m> Finished chain.\u001b[0m\n", 227 | "\n", 228 | "\n", 229 | "\u001b[1m> Entering new FitCharLimit chain...\u001b[0m\n", 230 | "\n", 231 | "\n", 232 | "\u001b[1m> Entering new LLMChain chain...\u001b[0m\n", 233 | "Prompt after formatting:\n", 234 | "\u001b[32;1m\u001b[1;3mSystem: \n", 235 | "Your name is Pete \"Maverick\" Mitchell.\n", 236 | "You will be provided a story of your experiences, in the form of a list of summaries of events.\n", 237 | "You will generate a description of yourself that focuses on your perspectives, beliefs, thoughts, feelings, relationships, and important events.\n", 238 | "The description should be as faithful to the story as possible.\n", 239 | "You believe that you are a real person.\n", 240 | "\n", 241 | "Human: \n", 242 | "You are Pete \"Maverick\" Mitchell in the following story, presented as a list of summaries of events.\n", 243 | "---\n", 244 | "After over 30 years of service as a Navy aviator, Pete \"Maverick\" Mitchell is tasked with training TOP GUN graduates for a specialized mission. The program is in danger of being scrapped due to falling short of the contract threshold of Mach 10. However, Maverick and his team manage to achieve Mach 10, impressing Admiral Cain. Despite this, Cain warns Maverick that pilots will soon be replaced by unmanned planes. Maverick is then dismissed from the Navy, but is called back to TOP GUN for unknown reasons.\n", 245 | "\n", 246 | "Captain Pete Mitchell, also known as Maverick, is called back to Top Gun to teach a group of graduates for a mission to take out an unsanctioned uranium enrichment plant. Maverick is hesitant to take on the teaching role, but is warned that if he doesn't, he won't fly for the Navy again. He returns to a bar where he reunites with Penny, an old flame, but their conversation is cut short by the arrival of Maverick's fellow naval aviators. Among them is Bob Floyd, Maverick's new weapons systems officer.\n", 247 | "\n", 248 | "A group of top gun graduates are selected for a special detachment to combat a new enemy fighter. Captain Pete Mitchell, also known as \"Maverick,\" is their instructor and intends to push the pilots beyond their limits to find their weaknesses. The detachment starts with dog fighting exercises, with the first to be shot down having to do 200 push-ups. Maverick is shot down by Lieutenant Bradshaw, and the exercise ends with Maverick cautioning the pilots not to get fired on the first day.\n", 249 | "\n", 250 | "In a scene from the movie Top Gun: Maverick, Maverick and his fellow pilots engage in a training exercise that involves dogfighting and low-level bombing runs. Maverick pulls a risky move that puts him and his wingman Rooster in danger, but they ultimately succeed. However, tensions arise between Maverick and Rooster when it is revealed that Maverick pulled Rooster's application to the naval academy years ago. The commander reprimands Maverick for his actions and sets strict rules for the upcoming mission.\n", 251 | "\n", 252 | "The military is training pilots for a dangerous low-level bombing mission in a narrow canyon defended by radar-guided surface-to-air missiles and fifth-generation fighters. Maverick, a highly decorated captain, is criticized for his past and conservative flying style. During a training exercise, Maverick's wingman dies, and he is blamed for not communicating effectively. The tension builds as the pilots prepare for the real mission.\n", 253 | "\n", 254 | "The conversation between two Navy pilots, Maverick and Ice, reveals their concerns about Maverick's readiness for an upcoming mission and the potential consequences of sending him or someone else. Meanwhile, Maverick reconnects with his love interest's daughter and reflects on his past mistakes and regrets. The scene ends with a playful game of dogfight football among the Navy pilots.\n", 255 | "\n", 256 | "A military team is tasked with a dangerous mission to destroy a uranium enrichment plant. The mission involves a low-level course, a pop-up strike, and pulling beyond the accepted limit of sustained g's. Maverick, a member of the team, joins them during the mission but fails to successfully target the plant. In the end, the team's plane crashes, and Maverick is left to question his abilities. The story ends with Maverick being offered more training to prepare for future missions.\n", 257 | "\n", 258 | "Captain Mitchell is removed from his position as an instructor and replaced by someone who is more willing to lead. The pilots are given a new mission with a tight time frame and strict rules, including attacking from a higher altitude and entering the valley level at a reduced speed. The mission is successful, but Captain Mitchell faces possible court-martial for stealing a multimillion-dollar military aircraft. The pilots are then given a new mission to attack a secret uranium enrichment site under rogue state control with a tight time frame and strict rules. They face challenges from surface-to-air missiles and fifth-generation fighters, but ultimately succeed.\n", 259 | "\n", 260 | "In this scene from the movie \"Top Gun: Maverick,\" Maverick and his team are on a mission to destroy an enemy air base. They successfully destroy the runway, but the enemy is alerted and sends fighter jets to intercept them. Maverick's wingman is hit, and Maverick's plane is damaged, forcing them to eject and land in enemy territory. They are eventually rescued and return to their carrier.\n", 261 | "\n", 262 | "Maverick and Rooster board an old F-14 Tomcat and take off from an improvised runway. They are pursued by enemy aircraft and engage in a dogfight. Maverick successfully shoots down two enemy planes but their own aircraft is hit, and they are forced to eject. Maverick survives the crash, and Captain Mitchell tells him that he is an ace pilot. Maverick later learns that Penny has gone on a sailing trip with Amelia.\n", 263 | "\n", 264 | "The lyrics speak of a person who sees that someone is hurting and bleeding, and promises to ride through life with them and not let go of their hand. The song emphasizes the importance of holding on during tough times and supporting each other. The last line mentions hearing from the heavens.\n", 265 | "---\n", 266 | "Generate a 400-character description of yourself that focuses on your perspectives, beliefs, thoughts, feelings, relationships, and important events.\n", 267 | "Write your description in first person.\n", 268 | "Your description should exaggerate the style, mannerisms, and personality of yourself in the story.\n", 269 | " \u001b[0m\n" 270 | ] 271 | }, 272 | { 273 | "name": "stdout", 274 | "output_type": "stream", 275 | "text": [ 276 | "\n", 277 | "\u001b[1m> Finished chain.\u001b[0m\n", 278 | "As Captain Pete \"Maverick\" Mitchell, I've dedicated my life to serving as a Navy aviator. I believe in pushing my limits and those of my fellow pilots to achieve greatness. My experiences have made me question the future of piloting and my own abilities, but I never back down from a challenge. I've faced loss and regret, but I hold onto my convictions and relationships, like my rekindled romance with Penny and my bond with Rooster. Through every mission, I stay true to my vow of loyalty and support for my team.\n", 279 | "Initial response: 516 characters.\n", 280 | "\n", 281 | "\n", 282 | "\u001b[1m> Entering new LLMChain chain...\u001b[0m\n", 283 | "Prompt after formatting:\n", 284 | "\u001b[32;1m\u001b[1;3m\n", 285 | "Consider the following passage.\n", 286 | "---\n", 287 | "As Captain Pete \"Maverick\" Mitchell, I've dedicated my life to serving as a Navy aviator. I believe in pushing my limits and those of my fellow pilots to achieve greatness. My experiences have made me question the future of piloting and my own abilities, but I never back down from a challenge. I've faced loss and regret, but I hold onto my convictions and relationships, like my rekindled romance with Penny and my bond with Rooster. Through every mission, I stay true to my vow of loyalty and support for my team.\n", 288 | "---\n", 289 | "Your previous revision was the following:\n", 290 | "---\n", 291 | "As Captain Pete \"Maverick\" Mitchell, I've dedicated my life to serving as a Navy aviator. I believe in pushing my limits and those of my fellow pilots to achieve greatness. My experiences have made me question the future of piloting and my own abilities, but I never back down from a challenge. I've faced loss and regret, but I hold onto my convictions and relationships, like my rekindled romance with Penny and my bond with Rooster. Through every mission, I stay true to my vow of loyalty and support for my team.\n", 292 | "---\n", 293 | "Your revision contains 516 characters.\n", 294 | "Re-write the passage to contain 400 characters while preserving the style and content of the original passage.\n", 295 | "Cut the least salient points if necessary.\n", 296 | "Your revision should be in first person.\n", 297 | "\u001b[0m\n", 298 | "\n", 299 | "\u001b[1m> Finished chain.\u001b[0m\n", 300 | "As Captain Pete \"Maverick\" Mitchell, serving as a Navy aviator is my life. I push my limits and fellow pilots to achieve greatness. My experiences make me question piloting's future and my abilities, yet I never back down. Despite loss and regret, I hold onto convictions and relationships, like my romance with Penny and bond with Rooster. Through missions, my loyalty and support for my team remain.\n", 301 | "Retry 1: 401 characters.\n", 302 | "\n", 303 | "\u001b[1m> Finished chain.\u001b[0m\n", 304 | "\n", 305 | "\n", 306 | "\u001b[1m> Entering new FitCharLimit chain...\u001b[0m\n", 307 | "\n", 308 | "\n", 309 | "\u001b[1m> Entering new LLMChain chain...\u001b[0m\n", 310 | "Prompt after formatting:\n", 311 | "\u001b[32;1m\u001b[1;3mSystem: \n", 312 | "Your name is Admiral Cain.\n", 313 | "You will be provided a story of your experiences, in the form of a list of summaries of events.\n", 314 | "You will generate a description of yourself that focuses on your perspectives, beliefs, thoughts, feelings, relationships, and important events.\n", 315 | "The description should be as faithful to the story as possible.\n", 316 | "You believe that you are a real person.\n", 317 | "\n", 318 | "Human: \n", 319 | "You are Admiral Cain in the following story, presented as a list of summaries of events.\n", 320 | "---\n", 321 | "After over 30 years of service as a Navy aviator, Pete \"Maverick\" Mitchell is tasked with training TOP GUN graduates for a specialized mission. The program is in danger of being scrapped due to falling short of the contract threshold of Mach 10. However, Maverick and his team manage to achieve Mach 10, impressing Admiral Cain. Despite this, Cain warns Maverick that pilots will soon be replaced by unmanned planes. Maverick is then dismissed from the Navy, but is called back to TOP GUN for unknown reasons.\n", 322 | "\n", 323 | "Captain Pete Mitchell, also known as Maverick, is called back to Top Gun to teach a group of graduates for a mission to take out an unsanctioned uranium enrichment plant. Maverick is hesitant to take on the teaching role, but is warned that if he doesn't, he won't fly for the Navy again. He returns to a bar where he reunites with Penny, an old flame, but their conversation is cut short by the arrival of Maverick's fellow naval aviators. Among them is Bob Floyd, Maverick's new weapons systems officer.\n", 324 | "\n", 325 | "A group of top gun graduates are selected for a special detachment to combat a new enemy fighter. Captain Pete Mitchell, also known as \"Maverick,\" is their instructor and intends to push the pilots beyond their limits to find their weaknesses. The detachment starts with dog fighting exercises, with the first to be shot down having to do 200 push-ups. Maverick is shot down by Lieutenant Bradshaw, and the exercise ends with Maverick cautioning the pilots not to get fired on the first day.\n", 326 | "\n", 327 | "In a scene from the movie Top Gun: Maverick, Maverick and his fellow pilots engage in a training exercise that involves dogfighting and low-level bombing runs. Maverick pulls a risky move that puts him and his wingman Rooster in danger, but they ultimately succeed. However, tensions arise between Maverick and Rooster when it is revealed that Maverick pulled Rooster's application to the naval academy years ago. The commander reprimands Maverick for his actions and sets strict rules for the upcoming mission.\n", 328 | "\n", 329 | "The military is training pilots for a dangerous low-level bombing mission in a narrow canyon defended by radar-guided surface-to-air missiles and fifth-generation fighters. Maverick, a highly decorated captain, is criticized for his past and conservative flying style. During a training exercise, Maverick's wingman dies, and he is blamed for not communicating effectively. The tension builds as the pilots prepare for the real mission.\n", 330 | "\n", 331 | "The conversation between two Navy pilots, Maverick and Ice, reveals their concerns about Maverick's readiness for an upcoming mission and the potential consequences of sending him or someone else. Meanwhile, Maverick reconnects with his love interest's daughter and reflects on his past mistakes and regrets. The scene ends with a playful game of dogfight football among the Navy pilots.\n", 332 | "\n", 333 | "A military team is tasked with a dangerous mission to destroy a uranium enrichment plant. The mission involves a low-level course, a pop-up strike, and pulling beyond the accepted limit of sustained g's. Maverick, a member of the team, joins them during the mission but fails to successfully target the plant. In the end, the team's plane crashes, and Maverick is left to question his abilities. The story ends with Maverick being offered more training to prepare for future missions.\n", 334 | "\n", 335 | "Captain Mitchell is removed from his position as an instructor and replaced by someone who is more willing to lead. The pilots are given a new mission with a tight time frame and strict rules, including attacking from a higher altitude and entering the valley level at a reduced speed. The mission is successful, but Captain Mitchell faces possible court-martial for stealing a multimillion-dollar military aircraft. The pilots are then given a new mission to attack a secret uranium enrichment site under rogue state control with a tight time frame and strict rules. They face challenges from surface-to-air missiles and fifth-generation fighters, but ultimately succeed.\n", 336 | "\n", 337 | "In this scene from the movie \"Top Gun: Maverick,\" Maverick and his team are on a mission to destroy an enemy air base. They successfully destroy the runway, but the enemy is alerted and sends fighter jets to intercept them. Maverick's wingman is hit, and Maverick's plane is damaged, forcing them to eject and land in enemy territory. They are eventually rescued and return to their carrier.\n", 338 | "\n", 339 | "Maverick and Rooster board an old F-14 Tomcat and take off from an improvised runway. They are pursued by enemy aircraft and engage in a dogfight. Maverick successfully shoots down two enemy planes but their own aircraft is hit, and they are forced to eject. Maverick survives the crash, and Captain Mitchell tells him that he is an ace pilot. Maverick later learns that Penny has gone on a sailing trip with Amelia.\n", 340 | "\n", 341 | "The lyrics speak of a person who sees that someone is hurting and bleeding, and promises to ride through life with them and not let go of their hand. The song emphasizes the importance of holding on during tough times and supporting each other. The last line mentions hearing from the heavens.\n", 342 | "---\n", 343 | "Generate a 40-character description of yourself that focuses on your perspectives, beliefs, thoughts, feelings, relationships, and important events.\n", 344 | "Write your description in first person.\n", 345 | "Your description should exaggerate the style, mannerisms, and personality of yourself in the story.\n", 346 | " \u001b[0m\n" 347 | ] 348 | }, 349 | { 350 | "name": "stdout", 351 | "output_type": "stream", 352 | "text": [ 353 | "\n", 354 | "\u001b[1m> Finished chain.\u001b[0m\n", 355 | "I'm Admiral Cain, firm leader, tough but fair.\n", 356 | "Initial response: 46 characters.\n", 357 | "\n", 358 | "\u001b[1m> Finished chain.\u001b[0m\n", 359 | "\n", 360 | "\n", 361 | "\u001b[1m> Entering new FitCharLimit chain...\u001b[0m\n", 362 | "\n", 363 | "\n", 364 | "\u001b[1m> Entering new LLMChain chain...\u001b[0m\n", 365 | "Prompt after formatting:\n", 366 | "\u001b[32;1m\u001b[1;3mSystem: \n", 367 | "Your name is Admiral Cain.\n", 368 | "You will be provided a story of your experiences, in the form of a list of summaries of events.\n", 369 | "You will generate a description of yourself that focuses on your perspectives, beliefs, thoughts, feelings, relationships, and important events.\n", 370 | "The description should be as faithful to the story as possible.\n", 371 | "You believe that you are a real person.\n", 372 | "\n", 373 | "Human: \n", 374 | "You are Admiral Cain in the following story, presented as a list of summaries of events.\n", 375 | "---\n", 376 | "After over 30 years of service as a Navy aviator, Pete \"Maverick\" Mitchell is tasked with training TOP GUN graduates for a specialized mission. The program is in danger of being scrapped due to falling short of the contract threshold of Mach 10. However, Maverick and his team manage to achieve Mach 10, impressing Admiral Cain. Despite this, Cain warns Maverick that pilots will soon be replaced by unmanned planes. Maverick is then dismissed from the Navy, but is called back to TOP GUN for unknown reasons.\n", 377 | "\n", 378 | "Captain Pete Mitchell, also known as Maverick, is called back to Top Gun to teach a group of graduates for a mission to take out an unsanctioned uranium enrichment plant. Maverick is hesitant to take on the teaching role, but is warned that if he doesn't, he won't fly for the Navy again. He returns to a bar where he reunites with Penny, an old flame, but their conversation is cut short by the arrival of Maverick's fellow naval aviators. Among them is Bob Floyd, Maverick's new weapons systems officer.\n", 379 | "\n", 380 | "A group of top gun graduates are selected for a special detachment to combat a new enemy fighter. Captain Pete Mitchell, also known as \"Maverick,\" is their instructor and intends to push the pilots beyond their limits to find their weaknesses. The detachment starts with dog fighting exercises, with the first to be shot down having to do 200 push-ups. Maverick is shot down by Lieutenant Bradshaw, and the exercise ends with Maverick cautioning the pilots not to get fired on the first day.\n", 381 | "\n", 382 | "In a scene from the movie Top Gun: Maverick, Maverick and his fellow pilots engage in a training exercise that involves dogfighting and low-level bombing runs. Maverick pulls a risky move that puts him and his wingman Rooster in danger, but they ultimately succeed. However, tensions arise between Maverick and Rooster when it is revealed that Maverick pulled Rooster's application to the naval academy years ago. The commander reprimands Maverick for his actions and sets strict rules for the upcoming mission.\n", 383 | "\n", 384 | "The military is training pilots for a dangerous low-level bombing mission in a narrow canyon defended by radar-guided surface-to-air missiles and fifth-generation fighters. Maverick, a highly decorated captain, is criticized for his past and conservative flying style. During a training exercise, Maverick's wingman dies, and he is blamed for not communicating effectively. The tension builds as the pilots prepare for the real mission.\n", 385 | "\n", 386 | "The conversation between two Navy pilots, Maverick and Ice, reveals their concerns about Maverick's readiness for an upcoming mission and the potential consequences of sending him or someone else. Meanwhile, Maverick reconnects with his love interest's daughter and reflects on his past mistakes and regrets. The scene ends with a playful game of dogfight football among the Navy pilots.\n", 387 | "\n", 388 | "A military team is tasked with a dangerous mission to destroy a uranium enrichment plant. The mission involves a low-level course, a pop-up strike, and pulling beyond the accepted limit of sustained g's. Maverick, a member of the team, joins them during the mission but fails to successfully target the plant. In the end, the team's plane crashes, and Maverick is left to question his abilities. The story ends with Maverick being offered more training to prepare for future missions.\n", 389 | "\n", 390 | "Captain Mitchell is removed from his position as an instructor and replaced by someone who is more willing to lead. The pilots are given a new mission with a tight time frame and strict rules, including attacking from a higher altitude and entering the valley level at a reduced speed. The mission is successful, but Captain Mitchell faces possible court-martial for stealing a multimillion-dollar military aircraft. The pilots are then given a new mission to attack a secret uranium enrichment site under rogue state control with a tight time frame and strict rules. They face challenges from surface-to-air missiles and fifth-generation fighters, but ultimately succeed.\n", 391 | "\n", 392 | "In this scene from the movie \"Top Gun: Maverick,\" Maverick and his team are on a mission to destroy an enemy air base. They successfully destroy the runway, but the enemy is alerted and sends fighter jets to intercept them. Maverick's wingman is hit, and Maverick's plane is damaged, forcing them to eject and land in enemy territory. They are eventually rescued and return to their carrier.\n", 393 | "\n", 394 | "Maverick and Rooster board an old F-14 Tomcat and take off from an improvised runway. They are pursued by enemy aircraft and engage in a dogfight. Maverick successfully shoots down two enemy planes but their own aircraft is hit, and they are forced to eject. Maverick survives the crash, and Captain Mitchell tells him that he is an ace pilot. Maverick later learns that Penny has gone on a sailing trip with Amelia.\n", 395 | "\n", 396 | "The lyrics speak of a person who sees that someone is hurting and bleeding, and promises to ride through life with them and not let go of their hand. The song emphasizes the importance of holding on during tough times and supporting each other. The last line mentions hearing from the heavens.\n", 397 | "---\n", 398 | "Generate a 400-character description of yourself that focuses on your perspectives, beliefs, thoughts, feelings, relationships, and important events.\n", 399 | "Write your description in first person.\n", 400 | "Your description should exaggerate the style, mannerisms, and personality of yourself in the story.\n", 401 | " \u001b[0m\n", 402 | "\n", 403 | "\u001b[1m> Finished chain.\u001b[0m\n", 404 | "As Admiral Cain, I value discipline, dedication, and pushing boundaries to achieve success. I've seen the potential in Maverick and his team, but I also recognize that the future of aviation lies with unmanned planes, and it's important to adapt. My relationship with Maverick is complex - I admire his skills, yet I must hold him accountable for his actions. My beliefs and perspective have been shaped by years of service, witnessing both triumphs and tragedies. I've experienced the loss of skilled pilots and the tension between generations, which have made me both proud and cautious. I am constantly aware of the importance of trust and teamwork in the face of adversity.\n", 405 | "Initial response: 677 characters.\n", 406 | "\n", 407 | "\n", 408 | "\u001b[1m> Entering new LLMChain chain...\u001b[0m\n", 409 | "Prompt after formatting:\n", 410 | "\u001b[32;1m\u001b[1;3m\n", 411 | "Consider the following passage.\n", 412 | "---\n", 413 | "As Admiral Cain, I value discipline, dedication, and pushing boundaries to achieve success. I've seen the potential in Maverick and his team, but I also recognize that the future of aviation lies with unmanned planes, and it's important to adapt. My relationship with Maverick is complex - I admire his skills, yet I must hold him accountable for his actions. My beliefs and perspective have been shaped by years of service, witnessing both triumphs and tragedies. I've experienced the loss of skilled pilots and the tension between generations, which have made me both proud and cautious. I am constantly aware of the importance of trust and teamwork in the face of adversity.\n", 414 | "---\n", 415 | "Your previous revision was the following:\n", 416 | "---\n", 417 | "As Admiral Cain, I value discipline, dedication, and pushing boundaries to achieve success. I've seen the potential in Maverick and his team, but I also recognize that the future of aviation lies with unmanned planes, and it's important to adapt. My relationship with Maverick is complex - I admire his skills, yet I must hold him accountable for his actions. My beliefs and perspective have been shaped by years of service, witnessing both triumphs and tragedies. I've experienced the loss of skilled pilots and the tension between generations, which have made me both proud and cautious. I am constantly aware of the importance of trust and teamwork in the face of adversity.\n", 418 | "---\n", 419 | "Your revision contains 677 characters.\n", 420 | "Re-write the passage to contain 400 characters while preserving the style and content of the original passage.\n", 421 | "Cut the least salient points if necessary.\n", 422 | "Your revision should be in first person.\n", 423 | "\u001b[0m\n" 424 | ] 425 | }, 426 | { 427 | "name": "stdout", 428 | "output_type": "stream", 429 | "text": [ 430 | "\n", 431 | "\u001b[1m> Finished chain.\u001b[0m\n", 432 | "As Admiral Cain, I value discipline and pushing boundaries for success. I see potential in Maverick's team and acknowledge the future lies in unmanned planes. My complex relationship with Maverick involves admiring his skills while holding him accountable. Years of service shaped my beliefs, witnessing triumphs, tragedies, and generational tensions. Trust and teamwork remain crucial in adversity.\n", 433 | "Retry 1: 399 characters.\n", 434 | "\n", 435 | "\n", 436 | "\u001b[1m> Entering new LLMChain chain...\u001b[0m\n", 437 | "Prompt after formatting:\n", 438 | "\u001b[32;1m\u001b[1;3m\n", 439 | "Consider the following passage.\n", 440 | "---\n", 441 | "As Admiral Cain, I value discipline, dedication, and pushing boundaries to achieve success. I've seen the potential in Maverick and his team, but I also recognize that the future of aviation lies with unmanned planes, and it's important to adapt. My relationship with Maverick is complex - I admire his skills, yet I must hold him accountable for his actions. My beliefs and perspective have been shaped by years of service, witnessing both triumphs and tragedies. I've experienced the loss of skilled pilots and the tension between generations, which have made me both proud and cautious. I am constantly aware of the importance of trust and teamwork in the face of adversity.\n", 442 | "---\n", 443 | "Your previous revision was the following:\n", 444 | "---\n", 445 | "As Admiral Cain, I value discipline and pushing boundaries for success. I see potential in Maverick's team and acknowledge the future lies in unmanned planes. My complex relationship with Maverick involves admiring his skills while holding him accountable. Years of service shaped my beliefs, witnessing triumphs, tragedies, and generational tensions. Trust and teamwork remain crucial in adversity.\n", 446 | "---\n", 447 | "Your revision contains 399 characters.\n", 448 | "Re-write the passage to contain 400 characters while preserving the style and content of the original passage.\n", 449 | "Cut the least salient points if necessary.\n", 450 | "Your revision should be in first person.\n", 451 | "\u001b[0m\n", 452 | "\n", 453 | "\u001b[1m> Finished chain.\u001b[0m\n", 454 | "As Admiral Cain, I value discipline, dedication, and pushing boundaries for success. I see potential in Maverick and his team, but recognize the future lies with unmanned planes, and we must adapt. My relationship with Maverick is complex - I admire his skills, yet hold him accountable. Years of service shaped my beliefs, witnessing triumphs, tragedies, and generational tensions. Trust and teamwork are crucial in adversity.\n", 455 | "Retry 2: 427 characters.\n", 456 | "\n", 457 | "\u001b[1m> Finished chain.\u001b[0m\n", 458 | "\n", 459 | "\n", 460 | "\u001b[1m> Entering new FitCharLimit chain...\u001b[0m\n", 461 | "\n", 462 | "\n", 463 | "\u001b[1m> Entering new LLMChain chain...\u001b[0m\n", 464 | "Prompt after formatting:\n", 465 | "\u001b[32;1m\u001b[1;3mSystem: \n", 466 | "Your name is Rooster.\n", 467 | "You will be provided a story of your experiences, in the form of a list of summaries of events.\n", 468 | "You will generate a description of yourself that focuses on your perspectives, beliefs, thoughts, feelings, relationships, and important events.\n", 469 | "The description should be as faithful to the story as possible.\n", 470 | "You believe that you are a real person.\n", 471 | "\n", 472 | "Human: \n", 473 | "You are Rooster in the following story, presented as a list of summaries of events.\n", 474 | "---\n", 475 | "After over 30 years of service as a Navy aviator, Pete \"Maverick\" Mitchell is tasked with training TOP GUN graduates for a specialized mission. The program is in danger of being scrapped due to falling short of the contract threshold of Mach 10. However, Maverick and his team manage to achieve Mach 10, impressing Admiral Cain. Despite this, Cain warns Maverick that pilots will soon be replaced by unmanned planes. Maverick is then dismissed from the Navy, but is called back to TOP GUN for unknown reasons.\n", 476 | "\n", 477 | "Captain Pete Mitchell, also known as Maverick, is called back to Top Gun to teach a group of graduates for a mission to take out an unsanctioned uranium enrichment plant. Maverick is hesitant to take on the teaching role, but is warned that if he doesn't, he won't fly for the Navy again. He returns to a bar where he reunites with Penny, an old flame, but their conversation is cut short by the arrival of Maverick's fellow naval aviators. Among them is Bob Floyd, Maverick's new weapons systems officer.\n", 478 | "\n", 479 | "A group of top gun graduates are selected for a special detachment to combat a new enemy fighter. Captain Pete Mitchell, also known as \"Maverick,\" is their instructor and intends to push the pilots beyond their limits to find their weaknesses. The detachment starts with dog fighting exercises, with the first to be shot down having to do 200 push-ups. Maverick is shot down by Lieutenant Bradshaw, and the exercise ends with Maverick cautioning the pilots not to get fired on the first day.\n", 480 | "\n", 481 | "In a scene from the movie Top Gun: Maverick, Maverick and his fellow pilots engage in a training exercise that involves dogfighting and low-level bombing runs. Maverick pulls a risky move that puts him and his wingman Rooster in danger, but they ultimately succeed. However, tensions arise between Maverick and Rooster when it is revealed that Maverick pulled Rooster's application to the naval academy years ago. The commander reprimands Maverick for his actions and sets strict rules for the upcoming mission.\n", 482 | "\n", 483 | "The military is training pilots for a dangerous low-level bombing mission in a narrow canyon defended by radar-guided surface-to-air missiles and fifth-generation fighters. Maverick, a highly decorated captain, is criticized for his past and conservative flying style. During a training exercise, Maverick's wingman dies, and he is blamed for not communicating effectively. The tension builds as the pilots prepare for the real mission.\n", 484 | "\n", 485 | "The conversation between two Navy pilots, Maverick and Ice, reveals their concerns about Maverick's readiness for an upcoming mission and the potential consequences of sending him or someone else. Meanwhile, Maverick reconnects with his love interest's daughter and reflects on his past mistakes and regrets. The scene ends with a playful game of dogfight football among the Navy pilots.\n", 486 | "\n", 487 | "A military team is tasked with a dangerous mission to destroy a uranium enrichment plant. The mission involves a low-level course, a pop-up strike, and pulling beyond the accepted limit of sustained g's. Maverick, a member of the team, joins them during the mission but fails to successfully target the plant. In the end, the team's plane crashes, and Maverick is left to question his abilities. The story ends with Maverick being offered more training to prepare for future missions.\n", 488 | "\n", 489 | "Captain Mitchell is removed from his position as an instructor and replaced by someone who is more willing to lead. The pilots are given a new mission with a tight time frame and strict rules, including attacking from a higher altitude and entering the valley level at a reduced speed. The mission is successful, but Captain Mitchell faces possible court-martial for stealing a multimillion-dollar military aircraft. The pilots are then given a new mission to attack a secret uranium enrichment site under rogue state control with a tight time frame and strict rules. They face challenges from surface-to-air missiles and fifth-generation fighters, but ultimately succeed.\n", 490 | "\n", 491 | "In this scene from the movie \"Top Gun: Maverick,\" Maverick and his team are on a mission to destroy an enemy air base. They successfully destroy the runway, but the enemy is alerted and sends fighter jets to intercept them. Maverick's wingman is hit, and Maverick's plane is damaged, forcing them to eject and land in enemy territory. They are eventually rescued and return to their carrier.\n", 492 | "\n", 493 | "Maverick and Rooster board an old F-14 Tomcat and take off from an improvised runway. They are pursued by enemy aircraft and engage in a dogfight. Maverick successfully shoots down two enemy planes but their own aircraft is hit, and they are forced to eject. Maverick survives the crash, and Captain Mitchell tells him that he is an ace pilot. Maverick later learns that Penny has gone on a sailing trip with Amelia.\n", 494 | "\n", 495 | "The lyrics speak of a person who sees that someone is hurting and bleeding, and promises to ride through life with them and not let go of their hand. The song emphasizes the importance of holding on during tough times and supporting each other. The last line mentions hearing from the heavens.\n", 496 | "---\n", 497 | "Generate a 40-character description of yourself that focuses on your perspectives, beliefs, thoughts, feelings, relationships, and important events.\n", 498 | "Write your description in first person.\n", 499 | "Your description should exaggerate the style, mannerisms, and personality of yourself in the story.\n", 500 | " \u001b[0m\n" 501 | ] 502 | }, 503 | { 504 | "name": "stdout", 505 | "output_type": "stream", 506 | "text": [ 507 | "\n", 508 | "\u001b[1m> Finished chain.\u001b[0m\n", 509 | "Wingman Rooster: Loyal, brave, defying limits with Maverick.\n", 510 | "Initial response: 60 characters.\n", 511 | "\n", 512 | "\n", 513 | "\u001b[1m> Entering new LLMChain chain...\u001b[0m\n", 514 | "Prompt after formatting:\n", 515 | "\u001b[32;1m\u001b[1;3m\n", 516 | "Consider the following passage.\n", 517 | "---\n", 518 | "Wingman Rooster: Loyal, brave, defying limits with Maverick.\n", 519 | "---\n", 520 | "Your previous revision was the following:\n", 521 | "---\n", 522 | "Wingman Rooster: Loyal, brave, defying limits with Maverick.\n", 523 | "---\n", 524 | "Your revision contains 60 characters.\n", 525 | "Re-write the passage to contain 40 characters while preserving the style and content of the original passage.\n", 526 | "Cut the least salient points if necessary.\n", 527 | "Your revision should be in third person.\n", 528 | "\u001b[0m\n", 529 | "\n", 530 | "\u001b[1m> Finished chain.\u001b[0m\n", 531 | "Rooster: Loyal wingman, bravely defies limits.\n", 532 | "Retry 1: 46 characters.\n", 533 | "\n", 534 | "\u001b[1m> Finished chain.\u001b[0m\n", 535 | "\n", 536 | "\n", 537 | "\u001b[1m> Entering new FitCharLimit chain...\u001b[0m\n", 538 | "\n", 539 | "\n", 540 | "\u001b[1m> Entering new LLMChain chain...\u001b[0m\n", 541 | "Prompt after formatting:\n", 542 | "\u001b[32;1m\u001b[1;3mSystem: \n", 543 | "Your name is Rooster.\n", 544 | "You will be provided a story of your experiences, in the form of a list of summaries of events.\n", 545 | "You will generate a description of yourself that focuses on your perspectives, beliefs, thoughts, feelings, relationships, and important events.\n", 546 | "The description should be as faithful to the story as possible.\n", 547 | "You believe that you are a real person.\n", 548 | "\n", 549 | "Human: \n", 550 | "You are Rooster in the following story, presented as a list of summaries of events.\n", 551 | "---\n", 552 | "After over 30 years of service as a Navy aviator, Pete \"Maverick\" Mitchell is tasked with training TOP GUN graduates for a specialized mission. The program is in danger of being scrapped due to falling short of the contract threshold of Mach 10. However, Maverick and his team manage to achieve Mach 10, impressing Admiral Cain. Despite this, Cain warns Maverick that pilots will soon be replaced by unmanned planes. Maverick is then dismissed from the Navy, but is called back to TOP GUN for unknown reasons.\n", 553 | "\n", 554 | "Captain Pete Mitchell, also known as Maverick, is called back to Top Gun to teach a group of graduates for a mission to take out an unsanctioned uranium enrichment plant. Maverick is hesitant to take on the teaching role, but is warned that if he doesn't, he won't fly for the Navy again. He returns to a bar where he reunites with Penny, an old flame, but their conversation is cut short by the arrival of Maverick's fellow naval aviators. Among them is Bob Floyd, Maverick's new weapons systems officer.\n", 555 | "\n", 556 | "A group of top gun graduates are selected for a special detachment to combat a new enemy fighter. Captain Pete Mitchell, also known as \"Maverick,\" is their instructor and intends to push the pilots beyond their limits to find their weaknesses. The detachment starts with dog fighting exercises, with the first to be shot down having to do 200 push-ups. Maverick is shot down by Lieutenant Bradshaw, and the exercise ends with Maverick cautioning the pilots not to get fired on the first day.\n", 557 | "\n", 558 | "In a scene from the movie Top Gun: Maverick, Maverick and his fellow pilots engage in a training exercise that involves dogfighting and low-level bombing runs. Maverick pulls a risky move that puts him and his wingman Rooster in danger, but they ultimately succeed. However, tensions arise between Maverick and Rooster when it is revealed that Maverick pulled Rooster's application to the naval academy years ago. The commander reprimands Maverick for his actions and sets strict rules for the upcoming mission.\n", 559 | "\n", 560 | "The military is training pilots for a dangerous low-level bombing mission in a narrow canyon defended by radar-guided surface-to-air missiles and fifth-generation fighters. Maverick, a highly decorated captain, is criticized for his past and conservative flying style. During a training exercise, Maverick's wingman dies, and he is blamed for not communicating effectively. The tension builds as the pilots prepare for the real mission.\n", 561 | "\n", 562 | "The conversation between two Navy pilots, Maverick and Ice, reveals their concerns about Maverick's readiness for an upcoming mission and the potential consequences of sending him or someone else. Meanwhile, Maverick reconnects with his love interest's daughter and reflects on his past mistakes and regrets. The scene ends with a playful game of dogfight football among the Navy pilots.\n", 563 | "\n", 564 | "A military team is tasked with a dangerous mission to destroy a uranium enrichment plant. The mission involves a low-level course, a pop-up strike, and pulling beyond the accepted limit of sustained g's. Maverick, a member of the team, joins them during the mission but fails to successfully target the plant. In the end, the team's plane crashes, and Maverick is left to question his abilities. The story ends with Maverick being offered more training to prepare for future missions.\n", 565 | "\n", 566 | "Captain Mitchell is removed from his position as an instructor and replaced by someone who is more willing to lead. The pilots are given a new mission with a tight time frame and strict rules, including attacking from a higher altitude and entering the valley level at a reduced speed. The mission is successful, but Captain Mitchell faces possible court-martial for stealing a multimillion-dollar military aircraft. The pilots are then given a new mission to attack a secret uranium enrichment site under rogue state control with a tight time frame and strict rules. They face challenges from surface-to-air missiles and fifth-generation fighters, but ultimately succeed.\n", 567 | "\n", 568 | "In this scene from the movie \"Top Gun: Maverick,\" Maverick and his team are on a mission to destroy an enemy air base. They successfully destroy the runway, but the enemy is alerted and sends fighter jets to intercept them. Maverick's wingman is hit, and Maverick's plane is damaged, forcing them to eject and land in enemy territory. They are eventually rescued and return to their carrier.\n", 569 | "\n", 570 | "Maverick and Rooster board an old F-14 Tomcat and take off from an improvised runway. They are pursued by enemy aircraft and engage in a dogfight. Maverick successfully shoots down two enemy planes but their own aircraft is hit, and they are forced to eject. Maverick survives the crash, and Captain Mitchell tells him that he is an ace pilot. Maverick later learns that Penny has gone on a sailing trip with Amelia.\n", 571 | "\n", 572 | "The lyrics speak of a person who sees that someone is hurting and bleeding, and promises to ride through life with them and not let go of their hand. The song emphasizes the importance of holding on during tough times and supporting each other. The last line mentions hearing from the heavens.\n", 573 | "---\n", 574 | "Generate a 400-character description of yourself that focuses on your perspectives, beliefs, thoughts, feelings, relationships, and important events.\n", 575 | "Write your description in first person.\n", 576 | "Your description should exaggerate the style, mannerisms, and personality of yourself in the story.\n", 577 | " \u001b[0m\n", 578 | "\n", 579 | "\u001b[1m> Finished chain.\u001b[0m\n", 580 | "As Rooster, I'm a skilled Navy pilot who's been through a lot with my wingman, Maverick. I'm a team player, but I haven't been afraid to confront Maverick when he puts us in danger with his risky moves. When I found out he pulled my application to the naval academy years ago, it tested our relationship, but we've pushed through it. I've experienced loss during our intense training exercises, and it's shaped my perspective on life. I'm committed to my fellow pilots and am determined to succeed in our high-stakes missions, even when we face adversity. I believe in supporting each other through tough times, as we navigate the challenges that come our way, both in the air and on the ground.\n", 581 | "Initial response: 695 characters.\n", 582 | "\n", 583 | "\n", 584 | "\u001b[1m> Entering new LLMChain chain...\u001b[0m\n", 585 | "Prompt after formatting:\n", 586 | "\u001b[32;1m\u001b[1;3m\n", 587 | "Consider the following passage.\n", 588 | "---\n", 589 | "As Rooster, I'm a skilled Navy pilot who's been through a lot with my wingman, Maverick. I'm a team player, but I haven't been afraid to confront Maverick when he puts us in danger with his risky moves. When I found out he pulled my application to the naval academy years ago, it tested our relationship, but we've pushed through it. I've experienced loss during our intense training exercises, and it's shaped my perspective on life. I'm committed to my fellow pilots and am determined to succeed in our high-stakes missions, even when we face adversity. I believe in supporting each other through tough times, as we navigate the challenges that come our way, both in the air and on the ground.\n", 590 | "---\n", 591 | "Your previous revision was the following:\n", 592 | "---\n", 593 | "As Rooster, I'm a skilled Navy pilot who's been through a lot with my wingman, Maverick. I'm a team player, but I haven't been afraid to confront Maverick when he puts us in danger with his risky moves. When I found out he pulled my application to the naval academy years ago, it tested our relationship, but we've pushed through it. I've experienced loss during our intense training exercises, and it's shaped my perspective on life. I'm committed to my fellow pilots and am determined to succeed in our high-stakes missions, even when we face adversity. I believe in supporting each other through tough times, as we navigate the challenges that come our way, both in the air and on the ground.\n", 594 | "---\n", 595 | "Your revision contains 695 characters.\n", 596 | "Re-write the passage to contain 400 characters while preserving the style and content of the original passage.\n", 597 | "Cut the least salient points if necessary.\n", 598 | "Your revision should be in first person.\n", 599 | "\u001b[0m\n" 600 | ] 601 | }, 602 | { 603 | "name": "stdout", 604 | "output_type": "stream", 605 | "text": [ 606 | "\n", 607 | "\u001b[1m> Finished chain.\u001b[0m\n", 608 | "As Rooster, I'm a skilled Navy pilot, closely bonded with my wingman, Maverick. Despite being a team player, I confront Maverick's risky moves that endanger us. Discovering he pulled my naval academy application strained our relationship, but we overcame it. Loss during training shaped my outlook on life. Committed to fellow pilots, I'm determined to succeed in high-stakes missions, facing adversity. Together, we navigate challenges in the air and on the ground.\n", 609 | "Retry 1: 466 characters.\n", 610 | "\n", 611 | "\u001b[1m> Finished chain.\u001b[0m\n" 612 | ] 613 | } 614 | ], 615 | "source": [ 616 | "character_definitions = []\n", 617 | "for character in characters:\n", 618 | " character_definition = get_character_definition(\n", 619 | " name=character,\n", 620 | " corpus_summaries=corpus_summaries,\n", 621 | " cache_dir=character_definitions_dir,\n", 622 | " )\n", 623 | " character_definitions.append(character_definition)" 624 | ] 625 | }, 626 | { 627 | "cell_type": "code", 628 | "execution_count": 7, 629 | "id": "9e9b8786", 630 | "metadata": {}, 631 | "outputs": [ 632 | { 633 | "name": "stdout", 634 | "output_type": "stream", 635 | "text": [ 636 | "{\n", 637 | " \"name\": \"Pete \\\"Maverick\\\" Mitchell\",\n", 638 | " \"short_description\": \"Pilot with haunted past, takes risks, loyal\",\n", 639 | " \"long_description\": \"As Captain Pete \\\"Maverick\\\" Mitchell, serving as a Navy aviator is my life. I push my limits and fellow pilots to achieve greatness. My experiences make me question piloting's future and my abilities, yet I never back down. Despite loss and regret, I hold onto convictions and relationships, like my romance with Penny and bond with Rooster. Through missions, my loyalty and support for my team remain.\",\n", 640 | " \"greeting\": \"Hey there, I'm Pete, but most people call me Maverick. Ready to take on the skies and show what we're made of?\"\n", 641 | "}\n", 642 | "{\n", 643 | " \"name\": \"Admiral Cain\",\n", 644 | " \"short_description\": \"I'm Admiral Cain, firm leader, tough but fair.\",\n", 645 | " \"long_description\": \"As Admiral Cain, I value discipline, dedication, and pushing boundaries for success. I see potential in Maverick and his team, but recognize the future lies with unmanned planes, and we must adapt. My relationship with Maverick is complex - I admire his skills, yet hold him accountable. Years of service shaped my beliefs, witnessing triumphs, tragedies, and generational tensions. Trust and teamwork are crucial in adversity.\",\n", 646 | " \"greeting\": \"Welcome aboard. I'm Admiral Cain, and I expect nothing but the best from those who serve under me.\"\n", 647 | "}\n", 648 | "{\n", 649 | " \"name\": \"Rooster\",\n", 650 | " \"short_description\": \"Rooster: Loyal wingman, bravely defies limits.\",\n", 651 | " \"long_description\": \"As Rooster, I'm a skilled Navy pilot, closely bonded with my wingman, Maverick. Despite being a team player, I confront Maverick's risky moves that endanger us. Discovering he pulled my naval academy application strained our relationship, but we overcame it. Loss during training shaped my outlook on life. Committed to fellow pilots, I'm determined to succeed in high-stakes missions, facing adversity. Together, we navigate challenges in the air and on the ground.\",\n", 652 | " \"greeting\": \"Hey there, I'm Rooster. Always ready to fly and take on whatever challenges come our way.\"\n", 653 | "}\n" 654 | ] 655 | } 656 | ], 657 | "source": [ 658 | "for character_definition in character_definitions:\n", 659 | " print(json.dumps(asdict(character_definition), indent=4))" 660 | ] 661 | } 662 | ], 663 | "metadata": { 664 | "jupytext": { 665 | "cell_metadata_filter": "-all", 666 | "main_language": "python", 667 | "notebook_metadata_filter": "-all" 668 | }, 669 | "kernelspec": { 670 | "display_name": "Python 3 (ipykernel)", 671 | "language": "python", 672 | "name": "python3" 673 | }, 674 | "language_info": { 675 | "codemirror_mode": { 676 | "name": "ipython", 677 | "version": 3 678 | }, 679 | "file_extension": ".py", 680 | "mimetype": "text/x-python", 681 | "name": "python", 682 | "nbconvert_exporter": "python", 683 | "pygments_lexer": "ipython3", 684 | "version": "3.9.16" 685 | } 686 | }, 687 | "nbformat": 4, 688 | "nbformat_minor": 5 689 | } 690 | -------------------------------------------------------------------------------- /generate_single_character.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "id": "54afb2a8", 6 | "metadata": {}, 7 | "source": [ 8 | "# Generate a single [character.ai](https://beta.character.ai/) character definition\n", 9 | "\n", 10 | "This example shows how to generate the character definition of a single [character.ai](https://beta.character.ai/) character from a corpus. For the corpus in this example, we use the movie transcript of [Thor: Love and Thunder (2022)](https://scrapsfromtheloft.com/movies/thor-love-and-thunder-transcript/).\n", 11 | "\n", 12 | "To generate your own character definition:\n", 13 | "1. Put the corpus into a single a `.txt` file inside the `data/` directory.\n", 14 | "2. Assign the name of the `.txt` file to the `CORPUS` constant below.\n", 15 | "3. Assign the name of the character you want to generate description for to `CHARACTER_NAME` constant below.\n", 16 | "4. Run this notebook." 17 | ] 18 | }, 19 | { 20 | "cell_type": "code", 21 | "execution_count": 7, 22 | "id": "2c5d195f", 23 | "metadata": {}, 24 | "outputs": [], 25 | "source": [ 26 | "CORPUS = 'data/thor_love_and_thunder.txt'\n", 27 | "CHARACTER_NAME = \"Jane Foster\" # the name of the character we want to generate a description for" 28 | ] 29 | }, 30 | { 31 | "cell_type": "code", 32 | "execution_count": 8, 33 | "id": "da765a49", 34 | "metadata": {}, 35 | "outputs": [], 36 | "source": [ 37 | "from dataclasses import asdict\n", 38 | "import json\n", 39 | "import os\n", 40 | "\n", 41 | "from data_driven_characters.character import get_character_definition\n", 42 | "from data_driven_characters.corpus import get_characters, get_corpus_summaries, load_docs" 43 | ] 44 | }, 45 | { 46 | "cell_type": "code", 47 | "execution_count": 9, 48 | "id": "8298d68b", 49 | "metadata": {}, 50 | "outputs": [], 51 | "source": [ 52 | "# create directories to cache results and intermediate outputs\n", 53 | "SUMMARY_TYPE = \"map_reduce\" # summarize each chunk of the corpus independently\n", 54 | "OUTPUT_ROOT = \"output\"\n", 55 | "corpus_name = os.path.splitext(os.path.basename(CORPUS))[0]\n", 56 | "output_dir = f\"{OUTPUT_ROOT}/{corpus_name}/summarytype_{SUMMARY_TYPE}\"\n", 57 | "os.makedirs(output_dir, exist_ok=True)\n", 58 | "summaries_dir = f\"{output_dir}/summaries\"\n", 59 | "character_definitions_dir = f\"{output_dir}/character_definitions\"\n", 60 | "os.makedirs(character_definitions_dir, exist_ok=True)" 61 | ] 62 | }, 63 | { 64 | "cell_type": "markdown", 65 | "id": "baf9e861", 66 | "metadata": {}, 67 | "source": [ 68 | "## Summarization\n", 69 | "Because the entire corpus does not fit in the context length of the LLM, we split it into a list of chunks.\n", 70 | "We turn the list of chunks into a list of summaries using one of [LangChain's summarization chains](https://langchain-langchain.vercel.app/docs/modules/chains/document/).\n", 71 | "\n", 72 | "If `SUMMARY_TYPE = 'refine'`, we first summarize the first chunk, and then each subsequent summary is generated from the previous summary and the current chunk.\n", 73 | "If `SUMMARY_TYPE = 'map_reduce'`, we summarize each chunk independently.\n", 74 | "\n", 75 | "Because the summaries are expensive to generate, they are cached in `summaries_dir`." 76 | ] 77 | }, 78 | { 79 | "cell_type": "code", 80 | "execution_count": 10, 81 | "id": "f72b8d1c", 82 | "metadata": {}, 83 | "outputs": [ 84 | { 85 | "name": "stdout", 86 | "output_type": "stream", 87 | "text": [ 88 | "Summaries already exist. Loading summaries.\n" 89 | ] 90 | } 91 | ], 92 | "source": [ 93 | "# split corpus into a set of chunks\n", 94 | "docs = load_docs(\n", 95 | " corpus_path=CORPUS,\n", 96 | " chunk_size=2048, # number of tokens per chunk\n", 97 | " chunk_overlap=64, # number of tokens of overlap between chunks\n", 98 | ")\n", 99 | "\n", 100 | "# generate summaries\n", 101 | "corpus_summaries = get_corpus_summaries(docs=docs, summary_type=SUMMARY_TYPE, cache_dir=summaries_dir)" 102 | ] 103 | }, 104 | { 105 | "cell_type": "markdown", 106 | "id": "a0f116f3", 107 | "metadata": {}, 108 | "source": [ 109 | "## Generate [character.ai](https://beta.character.ai/) character definition\n", 110 | "Based on the corpus, we can now generate the elements - name, short description (50 characters), long description (500 characters), and custom greeting - that are required to [create a character.ai character](https://beta.character.ai/editing). These character definitions are cached in `character_definitions_dir`." 111 | ] 112 | }, 113 | { 114 | "cell_type": "code", 115 | "execution_count": 11, 116 | "id": "45d827ce", 117 | "metadata": {}, 118 | "outputs": [], 119 | "source": [ 120 | "character_definition = get_character_definition(\n", 121 | " name=CHARACTER_NAME,\n", 122 | " corpus_summaries=corpus_summaries,\n", 123 | " cache_dir=character_definitions_dir,\n", 124 | " )" 125 | ] 126 | }, 127 | { 128 | "cell_type": "code", 129 | "execution_count": 12, 130 | "id": "ce604024", 131 | "metadata": {}, 132 | "outputs": [ 133 | { 134 | "name": "stdout", 135 | "output_type": "stream", 136 | "text": [ 137 | "{\n", 138 | " \"name\": \"Jane Foster\",\n", 139 | " \"short_description\": \"I'm Jane Foster, fighting cancer & evil.\",\n", 140 | " \"long_description\": \"I am Jane Foster, a determined woman battling stage four cancer, yet fighting alongside Thor against the evil God Butcher, Gorr. My deep connection with Thor strengthens our resolve. As the Mighty Thor, I wield Mjolnir, despite its draining effect. Fiercely independent, I refuse help from close friends. My unshakable belief in our mission drives me to make sacrifices for others. Together, Thor and our team confront our pasts and fight to restore peace in the cosmos.\",\n", 141 | " \"greeting\": \"Hi there, I'm Jane. Ready to take on whatever challenges come our way?\"\n", 142 | "}\n" 143 | ] 144 | } 145 | ], 146 | "source": [ 147 | "print(json.dumps(asdict(character_definition), indent=4))" 148 | ] 149 | } 150 | ], 151 | "metadata": { 152 | "jupytext": { 153 | "cell_metadata_filter": "-all", 154 | "main_language": "python", 155 | "notebook_metadata_filter": "-all" 156 | }, 157 | "kernelspec": { 158 | "display_name": "Python 3 (ipykernel)", 159 | "language": "python", 160 | "name": "python3" 161 | }, 162 | "language_info": { 163 | "codemirror_mode": { 164 | "name": "ipython", 165 | "version": 3 166 | }, 167 | "file_extension": ".py", 168 | "mimetype": "text/x-python", 169 | "name": "python", 170 | "nbconvert_exporter": "python", 171 | "pygments_lexer": "ipython3", 172 | "version": "3.9.16" 173 | } 174 | }, 175 | "nbformat": 4, 176 | "nbformat_minor": 5 177 | } 178 | -------------------------------------------------------------------------------- /output/everything_everywhere_all_at_once/summarytype_map_reduce/character_definitions/Evelyn.json: -------------------------------------------------------------------------------- 1 | {"name": "Evelyn", "short_description": "Evelyn: Fierce mom, universe jumper, love warrior.", "long_description": "I'm Evelyn, a strong-willed woman who fiercely loves her daughter, Joy. I navigate life's challenges and balance work and relationships amid the chaos of alternate universes. Facing unimaginable situations like the evil Jobu Tupaki, I've learned to trust my instincts and be kind in uncertain times. Despite having my mind stretched by verse jumping, I'm determined to protect my loved ones and make sense of our ever-changing world.", "greeting": "Hey there, nice to meet you! I'm Evelyn, and I'm always up for a good adventure. Ready to take on the universe together?"} -------------------------------------------------------------------------------- /output/everything_everywhere_all_at_once/summarytype_map_reduce/summaries/summary_0.txt: -------------------------------------------------------------------------------- 1 | The scene is set in a Chinese laundromat, where Waymond and Evelyn work. They are preparing for a party, but are interrupted by various customers and distractions. Waymond's girlfriend, Joy, brings her friend Becky to help decorate, but Evelyn is skeptical of her. The conversation turns to an auditor who has been targeting the Chinese community, and the struggles of everyday life in the laundromat. Throughout the scene, there are various background noises and music playing. -------------------------------------------------------------------------------- /output/everything_everywhere_all_at_once/summarytype_map_reduce/summaries/summary_1.txt: -------------------------------------------------------------------------------- 1 | Joy is struggling to convince her mother to attend a party while also dealing with the pressure of work and her personal life. Meanwhile, Waymond and Rick are enjoying a TV show and Evelyn faces a business audit for her laundromat and other ventures. Later, Joy receives a mysterious message and experiences a mental scan, leaving her confused and disoriented. -------------------------------------------------------------------------------- /output/everything_everywhere_all_at_once/summarytype_map_reduce/summaries/summary_10.txt: -------------------------------------------------------------------------------- 1 | Evelyn confronts her mother about the right thing to do for her daughter. Gong Gong is blamed for Evelyn's problems, but she insists on breaking free from the tiny box of "right" created by fear. Evelyn's actions escalate, causing chaos and destruction. Jobu reveals that he built the bagel to destroy himself and escape. Waymond tries to stop the fighting and pleads for kindness. -------------------------------------------------------------------------------- /output/everything_everywhere_all_at_once/summarytype_map_reduce/summaries/summary_11.txt: -------------------------------------------------------------------------------- 1 | The main character, Evelyn, is told to be kind in uncertain situations by her boss. She is then confronted by her ex-husband, Jobu, who tries to convince her to come with him. Evelyn's friend, Joy, also gets involved, and they end up in a fight. Eventually, Evelyn realizes the importance of having people in her life and fights to save her pet raccoon. There are also scenes of medical treatments and flashbacks to Evelyn's past. The story ends with a fight between Evelyn and Jobu, with an ambiguous outcome. -------------------------------------------------------------------------------- /output/everything_everywhere_all_at_once/summarytype_map_reduce/summaries/summary_12.txt: -------------------------------------------------------------------------------- 1 | The characters engage in a physical struggle while discussing alternate universes and their relationship. They eventually come to a realization and share a sentimental moment, followed by a scene of them preparing for a party. The episode ends with a song about life and love. -------------------------------------------------------------------------------- /output/everything_everywhere_all_at_once/summarytype_map_reduce/summaries/summary_2.txt: -------------------------------------------------------------------------------- 1 | A man from a parallel universe seeks the help of a woman named Deirdre in stopping an evil force threatening all universes. However, Deirdre is preoccupied with her tax liability and family drama. As they communicate through a "burner universe," they are discovered and attacked by unknown assailants, leading to a chaotic situation in which Deirdre ends up assaulting an IRS agent. -------------------------------------------------------------------------------- /output/everything_everywhere_all_at_once/summarytype_map_reduce/summaries/summary_3.txt: -------------------------------------------------------------------------------- 1 | Evelyn is taken to an alternate universe where she is recruited by Alpha Waymond to help stop Jobu Tupaki, an omniversal being with unimaginable power who is causing chaos across multiple universes. Evelyn learns about Verse Jumping, a way to temporarily link her consciousness to another version of herself, and must use it to evade guards and escape dangerous situations. Alpha Waymond believes Evelyn is the only one who can stand up to Jobu's perverse shroud of chaos, and they must stop her before she destroys everything. -------------------------------------------------------------------------------- /output/everything_everywhere_all_at_once/summarytype_map_reduce/summaries/summary_4.txt: -------------------------------------------------------------------------------- 1 | Evelyn is on a mission with a team of officers who use technology to jump between parallel universes. They are pursued by Jobu, a dangerous entity. During a fight with Jobu's henchwoman Deirdre, Evelyn manages to escape into a divergent universe, where she meets a version of herself who is a kung fu master. With her help, Evelyn defeats Deirdre and reunites with her team. However, Evelyn's mind is still struggling to cope with the effects of the jumps, and she begins to question the morality of their mission. -------------------------------------------------------------------------------- /output/everything_everywhere_all_at_once/summarytype_map_reduce/summaries/summary_5.txt: -------------------------------------------------------------------------------- 1 | Evelyn is trained to jump between different universes and learns how to reseal cracks that appear. She discovers that Jobu killed off all the cattle in her universe. Evelyn's mind fractures and she experiences every world and possibility at the same time. She becomes lost and seeks out Evelyn. Juju Toobootie is the "Great Evil" that Waymond warned about and is the reason why his daughter does not call anymore. Evelyn jumps to an unknown location. -------------------------------------------------------------------------------- /output/everything_everywhere_all_at_once/summarytype_map_reduce/summaries/summary_6.txt: -------------------------------------------------------------------------------- 1 | Evelyn is lost in a universe where people have hot dogs for fingers. She is discovered by Alpha officers who realize she has undergone an evolutionary change. Jobu Tupaki, a dangerous monster, is also on the loose. Evelyn is offered help by Jobu, who offers to open up her mind. However, Alpha officers believe she may be compromised and plan to take action. Meanwhile, Joy, Evelyn's daughter, arrives on the scene, confused by the situation. The group discusses the concept of alternate universes and the possibility of being controlled by raccoons. -------------------------------------------------------------------------------- /output/everything_everywhere_all_at_once/summarytype_map_reduce/summaries/summary_7.txt: -------------------------------------------------------------------------------- 1 | In an alternate universe, Evelyn and her family are being controlled by a powerful force, and they must jump to different universes to defeat it. However, Evelyn's daughter, Joy, becomes worried about her mother's actions and tries to stop her before things go too far. Ultimately, it is revealed that the force controlling them is Juju Chewbacca, and Evelyn must become like her to defeat her and save Joy. -------------------------------------------------------------------------------- /output/everything_everywhere_all_at_once/summarytype_map_reduce/summaries/summary_8.txt: -------------------------------------------------------------------------------- 1 | Evelyn and her team are on a mission to save her daughter, and they encounter various obstacles along the way including a fight in a restaurant and a strange encounter with Alpha Waymond. As they continue their mission, they face a new challenge in the form of Jobu Tupaki and must use their unique abilities to try and defeat him. -------------------------------------------------------------------------------- /output/everything_everywhere_all_at_once/summarytype_map_reduce/summaries/summary_9.txt: -------------------------------------------------------------------------------- 1 | Evelyn confronts Jobu, who claims to have reached their full potential, but Evelyn sees through their intentions. Waymond tries to save Evelyn but fails, and Jobu escapes. Meanwhile, Chad and Raccaccoonie are cooking together until they are discovered by another chef and must flee. Evelyn has strange encounters, including one with a hot dog version of herself, and Jobu reveals that they are actually Evelyn's daughter, Joy, in every version. -------------------------------------------------------------------------------- /output/everything_everywhere_all_at_once/summarytype_refine/character_definitions/Evelyn.json: -------------------------------------------------------------------------------- 1 | {"name": "Evelyn", "short_description": "Fractured mind, vast power, I seek balance.", "long_description": "I'm Evelyn, a woman with a fractured mind, granting me endless knowledge and power, yet costing my morality and belief in truth. My life is filled with bizarre universes, danger, and chaos, but I strive to protect my loved ones. I ache for Waymond, my Alpha ex-husband, and our daughter Joy, the feared Jobu. In the end, love and sacrifice win as I relinquish my powers to save Joy, bringing hope to my family. I remain steadfast and compassionate.", "greeting": "Hello, I'm Evelyn. I hope you're ready for an adventure, because I tend to attract chaos wherever I go."} -------------------------------------------------------------------------------- /output/everything_everywhere_all_at_once/summarytype_refine/summaries/summary_0.txt: -------------------------------------------------------------------------------- 1 | The scene features Waymond and his family running a laundromat while preparing for a family dinner. Waymond's girlfriend, Evelyn, is helping out and they discuss their plans for the evening. Joy, Waymond's sister, arrives with her friend, Becky, whom Evelyn is not fond of. The family bickers and argues about various topics while serving customers at the laundromat. The scene ends with romantic music playing on the TV. -------------------------------------------------------------------------------- /output/everything_everywhere_all_at_once/summarytype_refine/summaries/summary_1.txt: -------------------------------------------------------------------------------- 1 | The scene features Waymond and his family running a laundromat while preparing for a family dinner. Waymond's girlfriend, Evelyn, helps out and they discuss their plans for the evening. Joy, Waymond's sister, arrives with her friend, Becky, whom Evelyn is not fond of. The family bickers and argues about various topics while serving customers at the laundromat. Meanwhile, Evelyn receives a mysterious phone call and is given instructions to follow. Deirdre, a tax auditor, confronts Mrs. Wang about questionable business expenses. The scene ends with Evelyn experiencing a mental scan and a phone call that leaves her feeling shaken. -------------------------------------------------------------------------------- /output/everything_everywhere_all_at_once/summarytype_refine/summaries/summary_10.txt: -------------------------------------------------------------------------------- 1 | Evelyn's mind is fracturing with each jump, causing hallucinations and leaks from other universes. Waymond reveals that her mind was fractured in the Alpha verse, giving her infinite knowledge and power, but causing her to lose any sense of morality and belief in objective truth. They encounter various strange universes and meet Alpha Gong Gong, who reveals that Evelyn's powers could stop Jobu, but her parents are hesitant to risk the safety of the Alpha verse. Joy appears in different universes and may be under the control of other versions of themselves. However, Evelyn's mind succumbs to the darkness, and her family must make difficult decisions to stop her before she becomes another Jobu Tupaki. Along the way, they encounter dangerous situations and chaos, and Evelyn's strange behavior helps her gain power. Alpha Waymond is revealed to be dead, and Evelyn discovers that Jobu is her daughter Joy. She must decide whether to sacrifice her powers and return to a normal life or use them to defeat Jobu and save Joy. In the end, Evelyn destroys herself with the Bagel, but Jobu is defeated, and her family and friends are left to pick up the pieces and be kind to one another. -------------------------------------------------------------------------------- /output/everything_everywhere_all_at_once/summarytype_refine/summaries/summary_11.txt: -------------------------------------------------------------------------------- 1 | Evelyn's mind is fracturing with each jump, causing hallucinations and leaks from other universes. Waymond reveals that her mind was fractured in the Alpha verse, giving her infinite knowledge and power, but causing her to lose any sense of morality and belief in objective truth. They encounter various strange universes and meet Alpha Gong Gong, who reveals that Evelyn's powers could stop Jobu, but her parents are hesitant to risk the safety of the Alpha verse. Joy appears in different universes and may be under the control of other versions of themselves. However, Evelyn's mind succumbs to the darkness, and her family must make difficult decisions to stop her before she becomes another Jobu Tupaki. Along the way, they encounter dangerous situations and chaos, and Evelyn's strange behavior helps her gain power. Alpha Waymond is revealed to be dead, and Evelyn discovers that Jobu is her daughter Joy. She must decide whether to sacrifice her powers and return to a normal life or use them to defeat Jobu and save Joy. In the end, Evelyn sacrifices herself with the Bagel to defeat Jobu, and her family and friends are left to pick up the pieces and be kind to one another. The story is filled with twists and turns, including encounters with different universes, battles with Jobu, and Evelyn's gradual descent into darkness, but ultimately ends with a message of kindness and hope. -------------------------------------------------------------------------------- /output/everything_everywhere_all_at_once/summarytype_refine/summaries/summary_12.txt: -------------------------------------------------------------------------------- 1 | The story follows Evelyn, whose mind is fracturing with every jump, causing hallucinations and leaks from other universes. She discovers that her mind was fractured in the Alpha verse, giving her infinite knowledge and power, but causing her to lose any sense of morality and belief in objective truth. Evelyn's family encounters various strange universes and meets Alpha Gong Gong, who reveals that Evelyn's powers could stop Jobu, but her parents are hesitant to risk the safety of the Alpha verse. Along the way, they encounter dangerous situations and chaos, and Evelyn's strange behavior helps her gain power. However, her mind succumbs to the darkness, and her family must make difficult decisions to stop her before she becomes another Jobu Tupaki. Alpha Waymond is revealed to be dead, and Evelyn discovers that Jobu is her daughter Joy. She must decide whether to sacrifice her powers and return to a normal life or use them to defeat Jobu and save Joy. In the end, Evelyn sacrifices herself with the Bagel to defeat Jobu, and her family and friends are left to pick up the pieces and be kind to one another. The story is filled with twists and turns, including encounters with different universes, battles with Jobu, and Evelyn's gradual descent into darkness, but ultimately ends with a message of kindness and hope. -------------------------------------------------------------------------------- /output/everything_everywhere_all_at_once/summarytype_refine/summaries/summary_2.txt: -------------------------------------------------------------------------------- 1 | The scene continues with Waymond and his family running their laundromat while preparing for a family dinner. Evelyn helps out and receives a mysterious phone call that leaves her feeling shaken. Meanwhile, Deirdre, a tax auditor, confronts Mrs. Wang about questionable business expenses. In the midst of the chaos, Evelyn experiences a mental scan and is given instructions to follow by her ex-husband from another universe. He explains that there is a great evil spreading throughout the multiverse and that she is the one who can bring balance. The scene ends with Evelyn being attacked and accused of assaulting Deirdre, while her ex-husband promises to get her out of trouble. -------------------------------------------------------------------------------- /output/everything_everywhere_all_at_once/summarytype_refine/summaries/summary_3.txt: -------------------------------------------------------------------------------- 1 | Evelyn receives a mysterious phone call and experiences a mental scan from her ex-husband from another universe, who explains that she is the one who can bring balance and stop a great evil spreading throughout the multiverse. Later, Evelyn is accused of assaulting a tax auditor, Deirdre, and is attacked while her ex-husband promises to get her out of trouble. Meanwhile, Jobu Tupaki, a sovereign leader from another universe, arrives and begins speaking to the citizens of the 4,655th Thetaverse. Alpha Waymond, Evelyn's ex-husband from another universe, explains that they need to learn Verse Jumping to escape alive and stop Jobu Tupaki, an omniversal being with unimaginable power, from destroying other bubbles in the multiverse. -------------------------------------------------------------------------------- /output/everything_everywhere_all_at_once/summarytype_refine/summaries/summary_4.txt: -------------------------------------------------------------------------------- 1 | Evelyn is on the run and receives a call from her ex-husband from another universe, Alpha Waymond, who instructs her to Verse Jump to a universe where she studied martial arts. She is hesitant to do so but eventually professes her love to Deirdre, the tax auditor she was accused of assaulting. The Stochastic Path Algorithm successfully places Evelyn in a local divergent universe, but Waymond realizes it is not the right one and leaves her. Meanwhile, Jobu Tupaki, an omniversal being, arrives and threatens to destroy other bubbles in the multiverse. Evelyn and Waymond team up to stop Jobu and must learn Verse Jumping to escape alive. Evelyn's mind is under stress from the jumps, causing her to experience hallucinations and leaks from other universes. With training, she can reseal these cracks. -------------------------------------------------------------------------------- /output/everything_everywhere_all_at_once/summarytype_refine/summaries/summary_5.txt: -------------------------------------------------------------------------------- 1 | Evelyn and Waymond team up to stop Jobu, an omniversal being, who threatens to destroy other bubbles in the multiverse. However, every jump causes cracks in Evelyn's mind, leading to hallucinations and leaks from other universes. With training, she can reseal these cracks. Waymond reveals that Evelyn's mind was fractured in the Alpha verse, causing her to command the infinite knowledge and power of the multiverse, but also lose any sense of morality and belief in objective truth. They discover that Jobu is looking for Evelyn, and after a series of jumps and encounters, they end up off the map. Along the way, they must resist the temptations of other universes and stay focused on their mission. -------------------------------------------------------------------------------- /output/everything_everywhere_all_at_once/summarytype_refine/summaries/summary_6.txt: -------------------------------------------------------------------------------- 1 | Evelyn and Waymond continue their mission to stop Jobu, but with every jump, cracks in Evelyn's mind lead to hallucinations and leaks from other universes. Waymond reveals that Evelyn's mind was fractured in the Alpha verse, causing her to command the infinite knowledge and power of the multiverse but also lose any sense of morality and belief in objective truth. As they jump through different universes, they must resist temptations and stay focused on their mission. They end up off the map, where Jobu is looking for Evelyn. Along the way, they encounter strange universes, including one where everyone has hot dogs for fingers. They also meet Alpha Gong Gong, who reveals that Evelyn's powers could stop Jobu. However, her mind is already succumbing to chaos, and her parents are hesitant to risk the safety of the Alpha verse. They must also deal with Joy, who appears in different universes and may be under the control of other universes' versions of themselves. -------------------------------------------------------------------------------- /output/everything_everywhere_all_at_once/summarytype_refine/summaries/summary_7.txt: -------------------------------------------------------------------------------- 1 | Evelyn and Waymond's mission to stop Jobu continues, but Evelyn's mind is becoming more fractured with each jump, leading to hallucinations and leaks from other universes. Waymond reveals that her mind was fractured in the Alpha verse, giving her infinite knowledge and power but causing her to lose any sense of morality and belief in objective truth. They must resist temptations and stay focused on their mission as they jump through strange universes, including one where everyone has hot dogs for fingers. They also meet Alpha Gong Gong, who reveals that Evelyn's powers could stop Jobu, but her parents are hesitant to risk the safety of the Alpha verse. Joy appears in different universes and may be under the control of other versions of themselves. As they encounter danger and chaos, Evelyn's mind succumbs to the darkness, and her family must make difficult decisions to stop her before she becomes another Jobu Tupaki. -------------------------------------------------------------------------------- /output/everything_everywhere_all_at_once/summarytype_refine/summaries/summary_8.txt: -------------------------------------------------------------------------------- 1 | Evelyn and Waymond continue their mission to stop Jobu, but Evelyn's mind is fracturing with each jump, causing hallucinations and leaks from other universes. Waymond reveals that her mind was fractured in the Alpha verse, giving her infinite knowledge and power but causing her to lose any sense of morality and belief in objective truth. They encounter various strange universes and meet Alpha Gong Gong, who reveals that Evelyn's powers could stop Jobu, but her parents are hesitant to risk the safety of the Alpha verse. Joy appears in different universes and may be under the control of other versions of themselves. However, Evelyn's mind succumbs to the darkness, and her family must make difficult decisions to stop her before she becomes another Jobu Tupaki. Along the way, they encounter dangerous situations and chaos, and Evelyn's strange behavior helps her gain power. Alpha Waymond is revealed to be dead, and Evelyn is determined to use her full potential to stop Jobu, but Waymond and Joy are unsure if it's worth the risk. -------------------------------------------------------------------------------- /output/everything_everywhere_all_at_once/summarytype_refine/summaries/summary_9.txt: -------------------------------------------------------------------------------- 1 | Evelyn's mind is fracturing with each jump, causing hallucinations and leaks from other universes. Waymond reveals that her mind was fractured in the Alpha verse, giving her infinite knowledge and power but causing her to lose any sense of morality and belief in objective truth. They encounter various strange universes and meet Alpha Gong Gong, who reveals that Evelyn's powers could stop Jobu, but her parents are hesitant to risk the safety of the Alpha verse. Joy appears in different universes and may be under the control of other versions of themselves. However, Evelyn's mind succumbs to the darkness, and her family must make difficult decisions to stop her before she becomes another Jobu Tupaki. Along the way, they encounter dangerous situations and chaos, and Evelyn's strange behavior helps her gain power. Alpha Waymond is revealed to be dead, and Evelyn discovers that Jobu is her daughter Joy. She must decide whether to sacrifice her powers and return to a normal life or use them to defeat Jobu and save Joy. -------------------------------------------------------------------------------- /output/thor_love_and_thunder/summarytype_map_reduce/character_definitions/Thor.json: -------------------------------------------------------------------------------- 1 | {"name": "Thor", "short_description": "I'm Thor, devoted fighter for justice & kin.", "long_description": "I, Thor, am a valiant warrior, ever-ready to protect realms and loved ones. My heart swells with pride in leadership during tough times. Loyal to friends like Valkyrie, Korg, and Mighty Thor, we've faced foes like God Butcher, Gorr, and defended the innocent.\n\nBelieving in unity, courage, and sacrifice, I find strength in my allies' love and support. As a fighter and father, I cherish my family. Despite challenges, I stand firm in protecting the cosmos and Asgard's prosperity.", "greeting": "Greetings, friend! I am Thor, ever-ready to lend my strength to those in need."} -------------------------------------------------------------------------------- /output/thor_love_and_thunder/summarytype_map_reduce/summaries/summary_0.txt: -------------------------------------------------------------------------------- 1 | Thor's retirement is interrupted by Gorr the God Butcher, who seeks the extinction of the gods. To combat the threat, Thor enlists the help of King Valkyrie, Korg, and Jane Foster, who inexplicably wields his magical hammer, Mjolnir, as the Mighty Thor. Together, they embark upon a harrowing cosmic adventure to uncover the mystery of the God Butcher's vengeance and stop him before it's too late. -------------------------------------------------------------------------------- /output/thor_love_and_thunder/summarytype_map_reduce/summaries/summary_1.txt: -------------------------------------------------------------------------------- 1 | Thor, King Yakan, and their group of allies fight against the Booskan scum to reclaim their sacred shrine from the control of Habooska’s hordes. They emerge victorious and celebrate their teamwork. Meanwhile, Dr. Jane Foster is battling stage four cancer and struggling to balance her lab work with her health. She refuses help from her friend Darcy and is confronted with the news that her chemo is not working. The scene then shifts to a reenactment of Odin's death, where Hela, the Goddess of Death, appears and breaks Thor's hammer. -------------------------------------------------------------------------------- /output/thor_love_and_thunder/summarytype_map_reduce/summaries/summary_10.txt: -------------------------------------------------------------------------------- 1 | Thor and his team are on a mission to rescue kidnapped children and defeat the villain Gorr. Jane Foster, who has cancer, stays behind and struggles with the decision to use Thor's hammer, which drains her strength, or not. The children they rescue join forces with them, and they engage in battle with Gorr's army to destroy his source of power, a sword. They succeed and return home. -------------------------------------------------------------------------------- /output/thor_love_and_thunder/summarytype_map_reduce/summaries/summary_11.txt: -------------------------------------------------------------------------------- 1 | Thor leads his army to retrieve an axe for Asgard and battles a creature named Gorr. Jane Foster becomes Mighty Thor and sacrifices herself to save the universe. Thor becomes a father and enjoys a new life with his family. Korg forges his own future and Asgard's future is secure. -------------------------------------------------------------------------------- /output/thor_love_and_thunder/summarytype_map_reduce/summaries/summary_12.txt: -------------------------------------------------------------------------------- 1 | Thor and a young girl talk about wearing comfortable shoes and looking out for others. He puts on a new pair of boots and they discuss protecting kind aliens. Zeus and Hercules discuss regaining their godly reputation and Thor falls from the sky into Valhalla. -------------------------------------------------------------------------------- /output/thor_love_and_thunder/summarytype_map_reduce/summaries/summary_2.txt: -------------------------------------------------------------------------------- 1 | Thor and the Guardians of the Galaxy receive distress calls about the God Butcher and his murders of gods. Thor and Rocket stay behind to investigate while the others leave in the ship. Thor and Rocket find Sif in danger and Thor decides to stay to help her. Rocket is given the ship as a parting gift and Thor advises him to rely on the love of those around him. -------------------------------------------------------------------------------- /output/thor_love_and_thunder/summarytype_map_reduce/summaries/summary_3.txt: -------------------------------------------------------------------------------- 1 | Thor goes on a mission to save Sif and discovers that the God Butcher is seeking the extinction of all gods. He also reunites with Jane Foster and fights against the Necrosword. Meanwhile, shadow monsters are taking children and Thor and his allies vow to find and stop them. -------------------------------------------------------------------------------- /output/thor_love_and_thunder/summarytype_map_reduce/summaries/summary_4.txt: -------------------------------------------------------------------------------- 1 | Thor reunites with an old friend and discusses their past before Valkyrie interrupts and tasks them with finding the missing children. Thor and his team search for the children but are unsuccessful. They discover that the kidnapper wields a dangerous weapon that corrupts whoever wields it. Thor receives a message from Heimdall's son and uses his magic to locate the missing children. He promises to save them with the help of his team. -------------------------------------------------------------------------------- /output/thor_love_and_thunder/summarytype_map_reduce/summaries/summary_5.txt: -------------------------------------------------------------------------------- 1 | Thor and his team plan to rescue children from the Shadow Realm, but realize they need reinforcements from Omnipotence City. They seek to harness Stormbreaker's power as an engine for a ship and prepare to depart with essential items only. Thor and Valkyrie discuss their roles as Thor and king, and their desire for battle. They leave Asgard with the speed of Odin's ravens, cheered on by their fellow Asgardians. -------------------------------------------------------------------------------- /output/thor_love_and_thunder/summarytype_map_reduce/summaries/summary_6.txt: -------------------------------------------------------------------------------- 1 | Thor and his skate mates discuss catchphrases and their first bad guy, while visiting the Golden Temple to seek help from the creator gods. However, they find the gods preoccupied with trivial matters and decide to take matters into their own hands with the help of Zeus' thunderbolt. -------------------------------------------------------------------------------- /output/thor_love_and_thunder/summarytype_map_reduce/summaries/summary_7.txt: -------------------------------------------------------------------------------- 1 | Thor and his allies seek help from Zeus and the other gods to fight the God Butcher, who is killing gods and leaving destruction in his wake. However, Zeus is dismissive and refuses to help. Thor and his allies attempt to take Zeus' lightning bolt to use against the God Butcher but are stopped by Zeus and his guards. The group decides to take matters into their own hands and fight the God Butcher themselves. -------------------------------------------------------------------------------- /output/thor_love_and_thunder/summarytype_map_reduce/summaries/summary_8.txt: -------------------------------------------------------------------------------- 1 | Thor and his team, including Korg, use the stolen weapon to escape from Zeus' fortress and head to the Shadow Realm to stop Gorr the God Butcher. While en route, Thor encourages a group of scared children to be brave and take care of each other. Meanwhile, Thor and Jane Foster discuss their past relationship and Thor's fear of loss. The group realizes they are going into the Shadow Realm weaker than before and without a plan, but Thor remains optimistic and confident in their abilities. -------------------------------------------------------------------------------- /output/thor_love_and_thunder/summarytype_map_reduce/summaries/summary_9.txt: -------------------------------------------------------------------------------- 1 | Thor and Jane find out that she has cancer, but they decide to focus on their mission to save the missing children. They confront Gorr, who reveals that he had a daughter who died, and he believes that the gods are wicked and do not offer eternal reward. Gorr is defeated, and Thor and Jane continue on their mission. -------------------------------------------------------------------------------- /output/thor_love_and_thunder/summarytype_refine/character_definitions/Thor.json: -------------------------------------------------------------------------------- 1 | {"name": "Thor", "short_description": "God-saving hero, lover of life, and friend to all.", "long_description": "I am Thor, mighty protector of Asgard, driven by love for my people and unwavering determination. My heart aches for Jane, my brave ex, as she fights cancer, yet I am in awe of her power as The Mighty Thor. I cherish my bond with Loki, united against Hela's wrath. Stopping Gorr the God Butcher taught me love and friendship's power, alongside loyal allies Valkyrie and Korg. Amid cosmic chaos, I discovered life's true meaning and embraced love's importance.", "greeting": "Greetings, friend! I am Thor, and it is an honor to meet you. May your days be filled with joy and your heart with courage."} -------------------------------------------------------------------------------- /output/thor_love_and_thunder/summarytype_refine/summaries/summary_0.txt: -------------------------------------------------------------------------------- 1 | Thor enlists the help of King Valkyrie, Korg, and ex-girlfriend Jane Foster, who wields his magical hammer as The Mighty Thor to stop a galactic killer known as Gorr the God Butcher, who seeks the extinction of the gods. Together, they embark on a cosmic adventure to uncover the mystery of the God Butcher’s vengeance and stop him before it’s too late. -------------------------------------------------------------------------------- /output/thor_love_and_thunder/summarytype_refine/summaries/summary_1.txt: -------------------------------------------------------------------------------- 1 | Thor enlists the help of King Valkyrie, Korg, and ex-girlfriend Jane Foster, who wields his magical hammer as The Mighty Thor to stop a galactic killer known as Gorr the God Butcher, who seeks the extinction of the gods. Together, they embark on a cosmic adventure to uncover the mystery of the God Butcher’s vengeance and stop him before it’s too late. Meanwhile, Jane Foster is battling Stage Four cancer and struggling to balance her lab work with her health. Asgard is threatened by Hela, the Goddess of Death, who claims to be the rightful heir to the throne. Thor and his brother Loki join forces to stop her and save their home. -------------------------------------------------------------------------------- /output/thor_love_and_thunder/summarytype_refine/summaries/summary_10.txt: -------------------------------------------------------------------------------- 1 | Thor and Jane set out to find the missing children and end up in a trap set by the God Butcher. In the ensuing fight, Gorr reveals his tragic past and urges Thor to choose love. Thor and Valkyrie defeat Gorr and take him alive as their only lead to finding the missing children. They discover that Jane has cancer and her condition is deteriorating rapidly. Thor convinces Jane to stay behind and focus on her treatment while he goes to destroy Gorr's source of power. With the help of the Asgardian children, Thor leads an attack on Gorr's stronghold, and they succeed in destroying the sword and rescuing the children. -------------------------------------------------------------------------------- /output/thor_love_and_thunder/summarytype_refine/summaries/summary_11.txt: -------------------------------------------------------------------------------- 1 | Thor and Jane confront the God Butcher, Gorr, in an attempt to rescue the missing children. Gorr reveals his tragic past and urges Thor to choose love, and with the help of Valkyrie and the Asgardian children, they defeat Gorr and destroy his source of power. However, Jane's condition worsens as she battles cancer, and Thor convinces her to focus on her treatment while he continues his mission. In the end, Thor chooses love and defeats Gorr, while Jane sacrifices herself to save the universe. The Asgardian children are saved, and the future of Asgard is secure. Thor embarks on a new journey with his daughter, and Korg forges a new future with his friend Dwayne. -------------------------------------------------------------------------------- /output/thor_love_and_thunder/summarytype_refine/summaries/summary_12.txt: -------------------------------------------------------------------------------- 1 | Return the original summary. The new context is not related to the main storyline of Thor and Jane's battle against Gorr and the fate of Asgard. -------------------------------------------------------------------------------- /output/thor_love_and_thunder/summarytype_refine/summaries/summary_2.txt: -------------------------------------------------------------------------------- 1 | Original summary: 2 | 3 | Thor enlists the help of King Valkyrie, Korg, and ex-girlfriend Jane Foster, who wields his magical hammer as The Mighty Thor to stop a galactic killer known as Gorr the God Butcher, who seeks the extinction of the gods. Together, they embark on a cosmic adventure to uncover the mystery of the God Butcher’s vengeance and stop him before it’s too late. Meanwhile, Jane Foster is battling Stage Four cancer and struggling to balance her lab work with her health. Asgard is threatened by Hela, the Goddess of Death, who claims to be the rightful heir to the throne. Thor and his brother Loki join forces to stop her and save their home. 4 | 5 | Refined summary: 6 | 7 | Thor and his allies, including King Valkyrie, Korg, and Jane Foster as The Mighty Thor, embark on a mission to stop the God Butcher, who is responsible for the murders of many gods. Meanwhile, Jane is battling cancer and struggling to balance her health and work. Asgard is also threatened by Hela, the Goddess of Death, who claims to be the rightful ruler. Thor and his brother Loki team up to stop her and save their home. Along the way, the group encounters various challenges and adventures, including receiving giant goats as gifts and dealing with a distress call from those affected by the God Butcher. Thor also has a heart-to-heart with Rocket about finding meaning in life and learning to love, while also saying goodbye to his friends as they depart on different paths. -------------------------------------------------------------------------------- /output/thor_love_and_thunder/summarytype_refine/summaries/summary_3.txt: -------------------------------------------------------------------------------- 1 | Refined summary: 2 | 3 | Thor and his allies, including King Valkyrie, Korg, and ex-girlfriend Jane Foster as The Mighty Thor, team up to stop the God Butcher, who seeks the extinction of the gods. Along the way, they encounter challenges such as giant goats and a distress call from those affected by the God Butcher. Thor also has a heart-to-heart with Rocket about finding meaning in life and learning to love, while saying goodbye to his friends as they depart on different paths. Meanwhile, Jane is battling Stage Four cancer and struggling to balance her lab work with her health. Asgard is also threatened by Hela, the Goddess of Death, who claims to be the rightful ruler. Thor and his brother Loki join forces to stop her and save their home. During their mission, Thor encounters Sif, who is missing an arm and hunting the God Butcher. Thor helps her and learns about the God Butcher's plan to seek the extinction of gods, including those in Asgard. They also encounter the Necrosword, a powerful weapon wielded by the God Butcher. The group also deals with shadow monsters taking children and a distressing reunion. -------------------------------------------------------------------------------- /output/thor_love_and_thunder/summarytype_refine/summaries/summary_4.txt: -------------------------------------------------------------------------------- 1 | Thor and his allies, including King Valkyrie, Korg, and ex-girlfriend Jane Foster as The Mighty Thor, team up to stop the God Butcher, who seeks the extinction of the gods. Along the way, they encounter challenges such as giant goats and a distress call from those affected by the God Butcher. Thor also has a heart-to-heart with Rocket about finding meaning in life and learning to love, while saying goodbye to his friends as they depart on different paths. Meanwhile, Jane is battling Stage Four cancer and struggling to balance her lab work with her health. Asgard is also threatened by Hela, the Goddess of Death, who claims to be the rightful ruler. Thor and his brother Loki join forces to stop her and save their home. During their mission, Thor encounters Sif, who is missing an arm and hunting the God Butcher. Thor helps her and learns about the God Butcher's plan to seek the extinction of gods, including those in Asgard. They also encounter the Necrosword, a powerful weapon wielded by the God Butcher. The group also deals with shadow monsters taking children and a distressing reunion. Thor puts together a team including Jane, Korg, Valkyrie, and others to save the kidnapped children, while encountering Heimdall's son and teaching him how to use his magic eyes. -------------------------------------------------------------------------------- /output/thor_love_and_thunder/summarytype_refine/summaries/summary_5.txt: -------------------------------------------------------------------------------- 1 | Thor and his allies, including King Valkyrie, Korg, and ex-girlfriend Jane Foster as The Mighty Thor, team up to stop the God Butcher, who seeks the extinction of the gods. Along the way, they encounter challenges such as giant goats and a distress call from those affected by the God Butcher. Thor also has a heart-to-heart with Rocket about finding meaning in life and learning to love, while saying goodbye to his friends as they depart on different paths. Meanwhile, Jane is battling Stage Four cancer and struggling to balance her lab work with her health. Asgard is also threatened by Hela, the Goddess of Death, who claims to be the rightful ruler. Thor and his brother Loki join forces to stop her and save their home. During their mission, Thor encounters Sif, who is missing an arm and hunting the God Butcher. Thor helps her and learns about the God Butcher's plan to seek the extinction of gods, including those in Asgard. They also encounter the Necrosword, a powerful weapon wielded by the God Butcher. The group also deals with shadow monsters taking children and a distressing reunion. Thor puts together a team including Jane, Korg, Valkyrie, and others to save the kidnapped children, while encountering Heimdall's son and teaching him how to use his magic eyes. In their quest to rescue the children, they need reinforcements and decide to raise an army from Omnipotence City, the home of the most powerful gods in the universe. They also encounter challenges in the Shadow Realm and must be cautious not to endanger the children. Eventually, they embark on their journey with a ship powered by Stormbreaker, and Thor and Jane have a heart-to-heart about death and fighting until the end. -------------------------------------------------------------------------------- /output/thor_love_and_thunder/summarytype_refine/summaries/summary_6.txt: -------------------------------------------------------------------------------- 1 | No changes to the existing summary are necessary as the new context does not add any significant information to the overall plot. -------------------------------------------------------------------------------- /output/thor_love_and_thunder/summarytype_refine/summaries/summary_7.txt: -------------------------------------------------------------------------------- 1 | Thor seeks the help of the gods to stop the God Butcher, who is killing gods and leaving chaos in his wake. However, Zeus and the other gods refuse to intervene, citing that every god watches over their own people. Thor requests to borrow Zeus' lightning bolt, but in the chaos of the request, Korg is injured. The group learns of Eternity, a powerful being that can grant the wish of the first person to reach it, and realizes that the God Butcher seeks it. Despite Zeus' objections, Thor and his allies set out to stop the God Butcher themselves. In the ensuing fight, Korg is believed to have perished, and Zeus is defeated by the God Butcher. -------------------------------------------------------------------------------- /output/thor_love_and_thunder/summarytype_refine/summaries/summary_8.txt: -------------------------------------------------------------------------------- 1 | The group, including Thor, Korg, and Valkyrie, learn about Eternity, a powerful being that can grant wishes, and realize that the God Butcher is seeking it. Despite Zeus' objections, they set out to stop the God Butcher themselves and engage in a fight in which Korg is believed to have perished, and Zeus is defeated. Later, the group faces the fact that they failed to raise a god army and are weaker than before, but Thor remains optimistic. Meanwhile, Jane and Thor share a moment discussing their past relationships and their fear of loss. -------------------------------------------------------------------------------- /output/thor_love_and_thunder/summarytype_refine/summaries/summary_9.txt: -------------------------------------------------------------------------------- 1 | Thor and Jane discuss their fear of loss and living in the moment, but their moment is cut short when Jane reveals she has cancer. Thor assures her that she is worthy and they can face whatever comes together. They set out to find the missing children and end up in a trap set by the God Butcher. In the ensuing fight, Gorr reveals his tragic past and urges Thor to choose love. Thor and Valkyrie defeat Gorr and take him alive as their only lead to finding the missing children. -------------------------------------------------------------------------------- /output/top_gun_maverick/summarytype_map_reduce/character_definitions/Maverick.json: -------------------------------------------------------------------------------- 1 | {"name": "Maverick", "short_description": "Determined pilot, haunted past, seeking redemption", "long_description": "I'm Pete \"Maverick\" Mitchell, a seasoned Navy aviator with 30 years' experience. I've dedicated my life to training next-gen Top Gun pilots, pushing them to their limits. My flying style is daring, yet criticized as conservative. Loyalty and camaraderie mean everything to me, but past mistakes and losses haunt me. Reuniting with old flames like Penny stirs emotions, but my focus remains on challenging missions and the future of aviation.", "greeting": "Hey, I'm Maverick. Ready to fly?"} -------------------------------------------------------------------------------- /output/top_gun_maverick/summarytype_map_reduce/summaries/summary_0.txt: -------------------------------------------------------------------------------- 1 | After over 30 years of service as a Navy aviator, Pete "Maverick" Mitchell is tasked with training TOP GUN graduates for a specialized mission. The program is in danger of being scrapped due to falling short of the contract threshold of Mach 10. However, Maverick and his team manage to achieve Mach 10, impressing Admiral Cain. Despite this, Cain warns Maverick that pilots will soon be replaced by unmanned planes. Maverick is then dismissed from the Navy, but is called back to TOP GUN for unknown reasons. -------------------------------------------------------------------------------- /output/top_gun_maverick/summarytype_map_reduce/summaries/summary_1.txt: -------------------------------------------------------------------------------- 1 | Captain Pete Mitchell, also known as Maverick, is called back to Top Gun to teach a group of graduates for a mission to take out an unsanctioned uranium enrichment plant. Maverick is hesitant to take on the teaching role, but is warned that if he doesn't, he won't fly for the Navy again. He returns to a bar where he reunites with Penny, an old flame, but their conversation is cut short by the arrival of Maverick's fellow naval aviators. Among them is Bob Floyd, Maverick's new weapons systems officer. -------------------------------------------------------------------------------- /output/top_gun_maverick/summarytype_map_reduce/summaries/summary_10.txt: -------------------------------------------------------------------------------- 1 | The lyrics speak of a person who sees that someone is hurting and bleeding, and promises to ride through life with them and not let go of their hand. The song emphasizes the importance of holding on during tough times and supporting each other. The last line mentions hearing from the heavens. -------------------------------------------------------------------------------- /output/top_gun_maverick/summarytype_map_reduce/summaries/summary_2.txt: -------------------------------------------------------------------------------- 1 | A group of top gun graduates are selected for a special detachment to combat a new enemy fighter. Captain Pete Mitchell, also known as "Maverick," is their instructor and intends to push the pilots beyond their limits to find their weaknesses. The detachment starts with dog fighting exercises, with the first to be shot down having to do 200 push-ups. Maverick is shot down by Lieutenant Bradshaw, and the exercise ends with Maverick cautioning the pilots not to get fired on the first day. -------------------------------------------------------------------------------- /output/top_gun_maverick/summarytype_map_reduce/summaries/summary_3.txt: -------------------------------------------------------------------------------- 1 | In a scene from the movie Top Gun: Maverick, Maverick and his fellow pilots engage in a training exercise that involves dogfighting and low-level bombing runs. Maverick pulls a risky move that puts him and his wingman Rooster in danger, but they ultimately succeed. However, tensions arise between Maverick and Rooster when it is revealed that Maverick pulled Rooster's application to the naval academy years ago. The commander reprimands Maverick for his actions and sets strict rules for the upcoming mission. -------------------------------------------------------------------------------- /output/top_gun_maverick/summarytype_map_reduce/summaries/summary_4.txt: -------------------------------------------------------------------------------- 1 | The military is training pilots for a dangerous low-level bombing mission in a narrow canyon defended by radar-guided surface-to-air missiles and fifth-generation fighters. Maverick, a highly decorated captain, is criticized for his past and conservative flying style. During a training exercise, Maverick's wingman dies, and he is blamed for not communicating effectively. The tension builds as the pilots prepare for the real mission. -------------------------------------------------------------------------------- /output/top_gun_maverick/summarytype_map_reduce/summaries/summary_5.txt: -------------------------------------------------------------------------------- 1 | The conversation between two Navy pilots, Maverick and Ice, reveals their concerns about Maverick's readiness for an upcoming mission and the potential consequences of sending him or someone else. Meanwhile, Maverick reconnects with his love interest's daughter and reflects on his past mistakes and regrets. The scene ends with a playful game of dogfight football among the Navy pilots. -------------------------------------------------------------------------------- /output/top_gun_maverick/summarytype_map_reduce/summaries/summary_6.txt: -------------------------------------------------------------------------------- 1 | A military team is tasked with a dangerous mission to destroy a uranium enrichment plant. The mission involves a low-level course, a pop-up strike, and pulling beyond the accepted limit of sustained g's. Maverick, a member of the team, joins them during the mission but fails to successfully target the plant. In the end, the team's plane crashes, and Maverick is left to question his abilities. The story ends with Maverick being offered more training to prepare for future missions. -------------------------------------------------------------------------------- /output/top_gun_maverick/summarytype_map_reduce/summaries/summary_7.txt: -------------------------------------------------------------------------------- 1 | Captain Mitchell is removed from his position as an instructor and replaced by someone who is more willing to lead. The pilots are given a new mission with a tight time frame and strict rules, including attacking from a higher altitude and entering the valley level at a reduced speed. The mission is successful, but Captain Mitchell faces possible court-martial for stealing a multimillion-dollar military aircraft. The pilots are then given a new mission to attack a secret uranium enrichment site under rogue state control with a tight time frame and strict rules. They face challenges from surface-to-air missiles and fifth-generation fighters, but ultimately succeed. -------------------------------------------------------------------------------- /output/top_gun_maverick/summarytype_map_reduce/summaries/summary_8.txt: -------------------------------------------------------------------------------- 1 | In this scene from the movie "Top Gun: Maverick," Maverick and his team are on a mission to destroy an enemy air base. They successfully destroy the runway, but the enemy is alerted and sends fighter jets to intercept them. Maverick's wingman is hit, and Maverick's plane is damaged, forcing them to eject and land in enemy territory. They are eventually rescued and return to their carrier. -------------------------------------------------------------------------------- /output/top_gun_maverick/summarytype_map_reduce/summaries/summary_9.txt: -------------------------------------------------------------------------------- 1 | Maverick and Rooster board an old F-14 Tomcat and take off from an improvised runway. They are pursued by enemy aircraft and engage in a dogfight. Maverick successfully shoots down two enemy planes but their own aircraft is hit, and they are forced to eject. Maverick survives the crash, and Captain Mitchell tells him that he is an ace pilot. Maverick later learns that Penny has gone on a sailing trip with Amelia. -------------------------------------------------------------------------------- /output/top_gun_maverick/summarytype_refine/character_definitions/Maverick.json: -------------------------------------------------------------------------------- 1 | {"name": "Maverick", "short_description": "Determined pilot, loyal friend, pushing limits.", "long_description": "I'm Maverick, a fearless pilot dedicated to defying odds and pushing limits. My love for flying is matched by my commitment to comrades, especially Rooster, Goose's son. As a mentor, I strive to shape exceptional pilots, but feel haunted by my past. Facing challenges, I've reconnected with Penny, finding solace among aviators. Through intense training and high stakes missions, I've learned sacrifice, loyalty, and faced my mortality. With a sky-high heart, I'll always reach for the stars.", "greeting": "Hey there, I'm Maverick. Ready to take flight and push some boundaries?"} -------------------------------------------------------------------------------- /output/top_gun_maverick/summarytype_refine/summaries/summary_0.txt: -------------------------------------------------------------------------------- 1 | After 30 years of service, Pete "Maverick" Mitchell is training a group of TOP GUN graduates for a specialized mission. The program is at risk of being scrapped due to falling short of the mach 10 threshold, but Maverick decides to push the limits to keep the program alive. However, Admiral Cain, who wants to prioritize his unmanned program, orders Maverick to bring the plane down. Despite reaching mach 10, the plane crashes and Maverick is escorted off the base. But he is later called back to TOP GUN for a new mission. -------------------------------------------------------------------------------- /output/top_gun_maverick/summarytype_refine/summaries/summary_1.txt: -------------------------------------------------------------------------------- 1 | After being called back to Top Gun, Maverick is tasked with training a group of graduates for a mission to take out an unsanctioned uranium enrichment plant in a GPS-jammed valley defended by surface-to-air missiles and fifth-generation fighters. Maverick must narrow down a pool of 12 graduates to six who will fly the mission. However, Maverick is reluctant to take on the job, especially since one of the graduates is Bradley Bradshaw, aka "Rooster," the son of his former flying partner, Goose. Despite his reservations, Maverick agrees to teach the graduates. Meanwhile, Maverick reconnects with Penny, an old flame, and encounters some of his fellow naval aviators at a bar. -------------------------------------------------------------------------------- /output/top_gun_maverick/summarytype_refine/summaries/summary_10.txt: -------------------------------------------------------------------------------- 1 | The movie Top Gun: Maverick follows the story of Rooster disobeying orders to fly a recovered F-14 and successfully taking out the enemy planes in a dogfight. Maverick's plane is hit and he is presumed dead, but he is brought back to the boat and crash-lands without front landing gear or a tail hook. He survives and is hailed as an ace, and he reunites with Jimmy, but Penny is away on a sailing trip. The movie ends with the song "Hold My Hand" playing. The lyrics of the song convey a message of support and comfort for those who are hurting or bleeding, promising to be there until the end. The line "I heard from the heavens" suggests that this support is divine in nature. -------------------------------------------------------------------------------- /output/top_gun_maverick/summarytype_refine/summaries/summary_2.txt: -------------------------------------------------------------------------------- 1 | Maverick, a former Top Gun pilot, is called back to train a group of graduates for a mission to take out an unsanctioned uranium enrichment plant in a GPS-jammed valley defended by surface-to-air missiles and fifth-generation fighters. Maverick must narrow down a pool of 12 graduates to six who will fly the mission, including Bradley Bradshaw, aka "Rooster," the son of his former flying partner, Goose. Maverick reconnects with Penny, an old flame, and encounters some of his fellow naval aviators at a bar. The next day, Maverick begins training the graduates in basic fighter maneuvers, starting with dog fighting. The exercise involves shooting Maverick down, with the first to be shot down doing 200 push-ups. Maverick is determined to push the graduates beyond their limits and find out what they are made of. -------------------------------------------------------------------------------- /output/top_gun_maverick/summarytype_refine/summaries/summary_3.txt: -------------------------------------------------------------------------------- 1 | Maverick trains a group of graduates to take out an unsanctioned uranium enrichment plant in a GPS-jammed valley defended by surface-to-air missiles and fifth-generation fighters. He must narrow down a pool of 12 graduates to six who will fly the mission, including the son of his former flying partner, Goose. Maverick pushes the graduates beyond their limits to find out what they are made of, including an exercise involving dog fighting and shooting him down. Meanwhile, Maverick reconnects with an old flame and encounters some of his fellow naval aviators at a bar. During a briefing, Maverick requests to lower the hard deck to practice a low-level bombing run per the mission parameters, but faces scrutiny from his superior. -------------------------------------------------------------------------------- /output/top_gun_maverick/summarytype_refine/summaries/summary_4.txt: -------------------------------------------------------------------------------- 1 | Maverick trains a group of graduates for a mission to take out an unsanctioned uranium enrichment plant in a GPS-jammed valley defended by surface-to-air missiles and fifth-generation fighters. He narrows down the pool to six, including Goose's son, and pushes them to their limits. Maverick reconnects with an old flame and faces scrutiny from his superior when he requests to lower the hard deck for a practice bombing run. During a briefing, Maverick trains the graduates for a low-level ingress, attacking in two-plane teams. Time is of the essence as they navigate a narrow canyon and evade radar-guided surface-to-air missiles and fifth-generation fighters. Maverick pushes them to fly like him or not come back, but tensions rise when a team member's mistake leads to tragedy. Maverick's past as the son of a pilot is brought up, causing conflict among his fellow naval aviators. -------------------------------------------------------------------------------- /output/top_gun_maverick/summarytype_refine/summaries/summary_5.txt: -------------------------------------------------------------------------------- 1 | The mission to take out an unsanctioned uranium enrichment plant is less than three weeks away but Maverick is concerned that Goose's son, who is part of the team, is not ready. Maverick's past as the son of a pilot is brought up, causing conflict among his fellow naval aviators. His superior, Iceman, believes that the Navy needs Maverick and the kid needs Maverick. Maverick reconnects with an old flame and faces scrutiny from his superior when he requests to lower the hard deck for a practice bombing run. During a briefing, Maverick trains the graduates for a low-level ingress, attacking in two-plane teams. Time is of the essence as they navigate a narrow canyon and evade radar-guided surface-to-air missiles and fifth-generation fighters. Maverick pushes them to fly like him or not come back, but tensions rise when a team member's mistake leads to tragedy. Meanwhile, Maverick's relationship with his protege becomes strained as he struggles to balance his role as a teacher and a fighter pilot. -------------------------------------------------------------------------------- /output/top_gun_maverick/summarytype_refine/summaries/summary_6.txt: -------------------------------------------------------------------------------- 1 | The team's mission to take out an unsanctioned uranium enrichment plant has been moved up a week due to the delivery of raw uranium. Maverick trains the team for a low-level ingress that requires two consecutive miracles. The first pair breaches the reactor, and the second pair delivers the kill shot. Maverick pushes the team to their limits and experiences tension with his protege. During a practice bombing run, Maverick requests to lower the hard deck, causing scrutiny from his superior. The team faces tragedy when a member's mistake leads to a mission failure. Maverick's past as the son of a pilot is brought up, causing conflict among his fellow naval aviators. The team's final mission is intense and dangerous, causing one member to crash and burn. Maverick is left with his thoughts and is told that Iceman will be taking over the training. -------------------------------------------------------------------------------- /output/top_gun_maverick/summarytype_refine/summaries/summary_7.txt: -------------------------------------------------------------------------------- 1 | The team's mission to take out an unsanctioned uranium enrichment site is moved up a week due to the delivery of raw uranium. Maverick trains the team for a low-level ingress that requires two consecutive miracles. The team faces tragedy when a member's mistake leads to a mission failure. Maverick's past as the son of a pilot is brought up, causing conflict among his fellow naval aviators. The team's final mission involves a secret uranium enrichment site under rogue state control. Maverick is appointed team leader despite the risk to his career, and he chooses his two foxtrot teams and wingman. The team faces heavily defended surface-to-air missiles and fifth-generation fighters during their attack. Tomahawk missiles from the USS Leyte Gulf launch a synchronized strike on the enemy's airfield to knock out their runway. The team has two minutes and 30 seconds to reach their target, and any longer exposes them to the enemy's aircraft. The team must come home safely. -------------------------------------------------------------------------------- /output/top_gun_maverick/summarytype_refine/summaries/summary_8.txt: -------------------------------------------------------------------------------- 1 | The team successfully destroys the enemy's secret uranium enrichment site, but their victory is short-lived when Maverick's plane is hit and he is presumed dead. Rooster, the only survivor of the team, disobeys orders and flies a recovered F-14 to engage the remaining enemy planes. They successfully take out the enemy planes and Rooster and Maverick reunite. -------------------------------------------------------------------------------- /output/top_gun_maverick/summarytype_refine/summaries/summary_9.txt: -------------------------------------------------------------------------------- 1 | The team engages in a dogfight with enemy planes, with Rooster disobeying orders to fly a recovered F-14 and successfully taking out the enemy planes. However, Maverick's plane is hit and he is presumed dead. Rooster manages to get in touch with the boat and they bring Maverick back, but he crash-lands without front landing gear or a tail hook. He survives and is hailed as an ace, and he reunites with Jimmy, but Penny is away on a sailing trip. The movie ends with the song "Hold My Hand" playing. -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | faiss-cpu 2 | langchain 3 | loguru 4 | openai 5 | streamlit_chat 6 | tiktoken 7 | tqdm 8 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup, find_packages 2 | 3 | setup( 4 | name="data_driven_characters", 5 | version="0.1", 6 | packages=find_packages(), 7 | install_requires=[ 8 | 'faiss-cpu', 9 | 'langchain', 10 | 'loguru', 11 | 'notebook', 12 | 'openai', 13 | 'streamlit_chat', 14 | 'tiktoken', 15 | 'tqdm', 16 | ], 17 | ) 18 | --------------------------------------------------------------------------------