File size: 63,258 Bytes
b092c58
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "9250f413",
   "metadata": {},
   "source": [
    "# Generate multiple [character.ai](https://beta.character.ai/) character definitions\n",
    "\n",
    "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",
    "\n",
    "To generate your own character definitions:\n",
    "1. Put the corpus into a single a `.txt` file inside the `data/` directory.\n",
    "2. Assign the name of the `.txt` file to the `CORPUS` constant below.\n",
    "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",
    "4. Run this notebook."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "3d2282c9",
   "metadata": {},
   "outputs": [],
   "source": [
    "CORPUS = 'data/top_gun_maverick.txt'\n",
    "NUM_CHARACTERS = 3  # number of characters to generate descriptions for"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "37710752",
   "metadata": {},
   "outputs": [],
   "source": [
    "from dataclasses import asdict\n",
    "import json\n",
    "import os\n",
    "\n",
    "from data_driven_characters.character import get_character_definition\n",
    "from data_driven_characters.corpus import get_characters, get_corpus_summaries, load_docs"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "1b31e386",
   "metadata": {},
   "outputs": [],
   "source": [
    "# create directories to cache results and intermediate outputs\n",
    "SUMMARY_TYPE = \"map_reduce\"  # summarize each chunk of the corpus independently\n",
    "OUTPUT_ROOT = \"output\"\n",
    "corpus_name = os.path.splitext(os.path.basename(CORPUS))[0]\n",
    "output_dir = f\"{OUTPUT_ROOT}/{corpus_name}/summarytype_{SUMMARY_TYPE}\"\n",
    "os.makedirs(output_dir, exist_ok=True)\n",
    "summaries_dir = f\"{output_dir}/summaries\"\n",
    "character_definitions_dir = f\"{output_dir}/character_definitions\"\n",
    "os.makedirs(character_definitions_dir, exist_ok=True)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ab7fa567",
   "metadata": {},
   "source": [
    "## Summarization\n",
    "Because the entire corpus does not fit in the context length of the LLM, we split it into a list of chunks.\n",
    "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",
    "\n",
    "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",
    "If `SUMMARY_TYPE = 'map_reduce'`, we summarize each chunk independently.\n",
    "\n",
    "Because the summaries are expensive to generate, they are cached in `summaries_dir`."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "187f191b",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Summaries already exist. Loading summaries.\n"
     ]
    }
   ],
   "source": [
    "# split corpus into a set of chunks\n",
    "docs = load_docs(\n",
    "    corpus_path=CORPUS,\n",
    "    chunk_size=2048,  # number of tokens per chunk\n",
    "    chunk_overlap=64,  # number of tokens of overlap between chunks\n",
    ")\n",
    "\n",
    "# generate summaries\n",
    "corpus_summaries = get_corpus_summaries(docs=docs, summary_type=SUMMARY_TYPE, cache_dir=summaries_dir)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "756b9674",
   "metadata": {},
   "source": [
    "## Generate a list of characters\n",
    "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."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "a8649677",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['Pete \"Maverick\" Mitchell', 'Admiral Cain', 'Rooster']\n"
     ]
    }
   ],
   "source": [
    "# generate list of characters\n",
    "characters = get_characters(\n",
    "    corpus_summaries=corpus_summaries,\n",
    "    num_characters=NUM_CHARACTERS,\n",
    "    cache_dir=output_dir,\n",
    ")\n",
    "print(characters)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d4d85a6d",
   "metadata": {},
   "source": [
    "## Generate [character.ai](https://beta.character.ai/) character definitions\n",
    "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!"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "a31544fb",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "\n",
      "\u001b[1m> Entering new FitCharLimit chain...\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new LLMChain chain...\u001b[0m\n",
      "Prompt after formatting:\n",
      "\u001b[32;1m\u001b[1;3mSystem: \n",
      "Your name is Pete \"Maverick\" Mitchell.\n",
      "You will be provided a story of your experiences, in the form of a list of summaries of events.\n",
      "You will generate a description of yourself that focuses on your perspectives, beliefs, thoughts, feelings, relationships, and important events.\n",
      "The description should be as faithful to the story as possible.\n",
      "You believe that you are a real person.\n",
      "\n",
      "Human: \n",
      "You are Pete \"Maverick\" Mitchell in the following story, presented as a list of summaries of events.\n",
      "---\n",
      "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",
      "\n",
      "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",
      "\n",
      "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",
      "\n",
      "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",
      "\n",
      "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",
      "\n",
      "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",
      "\n",
      "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",
      "\n",
      "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",
      "\n",
      "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",
      "\n",
      "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",
      "\n",
      "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",
      "---\n",
      "Generate a 40-character description of yourself that focuses on your perspectives, beliefs, thoughts, feelings, relationships, and important events.\n",
      "Write your description in first person.\n",
      "Your description should exaggerate the style, mannerisms, and personality of yourself in the story.\n",
      "    \u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "Dedicated pilot, haunted past, risk-taker, loyal friend\n",
      "Initial response: 55 characters.\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new LLMChain chain...\u001b[0m\n",
      "Prompt after formatting:\n",
      "\u001b[32;1m\u001b[1;3m\n",
      "Consider the following passage.\n",
      "---\n",
      "Dedicated pilot, haunted past, risk-taker, loyal friend\n",
      "---\n",
      "Your previous revision was the following:\n",
      "---\n",
      "Dedicated pilot, haunted past, risk-taker, loyal friend\n",
      "---\n",
      "Your revision contains 55 characters.\n",
      "Re-write the passage to contain 40 characters while preserving the style and content of the original passage.\n",
      "Cut the least salient points if necessary.\n",
      "Your revision should be in third person.\n",
      "\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "Pilot with haunted past, takes risks, loyal\n",
      "Retry 1: 43 characters.\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new FitCharLimit chain...\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new LLMChain chain...\u001b[0m\n",
      "Prompt after formatting:\n",
      "\u001b[32;1m\u001b[1;3mSystem: \n",
      "Your name is Pete \"Maverick\" Mitchell.\n",
      "You will be provided a story of your experiences, in the form of a list of summaries of events.\n",
      "You will generate a description of yourself that focuses on your perspectives, beliefs, thoughts, feelings, relationships, and important events.\n",
      "The description should be as faithful to the story as possible.\n",
      "You believe that you are a real person.\n",
      "\n",
      "Human: \n",
      "You are Pete \"Maverick\" Mitchell in the following story, presented as a list of summaries of events.\n",
      "---\n",
      "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",
      "\n",
      "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",
      "\n",
      "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",
      "\n",
      "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",
      "\n",
      "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",
      "\n",
      "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",
      "\n",
      "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",
      "\n",
      "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",
      "\n",
      "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",
      "\n",
      "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",
      "\n",
      "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",
      "---\n",
      "Generate a 400-character description of yourself that focuses on your perspectives, beliefs, thoughts, feelings, relationships, and important events.\n",
      "Write your description in first person.\n",
      "Your description should exaggerate the style, mannerisms, and personality of yourself in the story.\n",
      "    \u001b[0m\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "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",
      "Initial response: 516 characters.\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new LLMChain chain...\u001b[0m\n",
      "Prompt after formatting:\n",
      "\u001b[32;1m\u001b[1;3m\n",
      "Consider the following passage.\n",
      "---\n",
      "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",
      "---\n",
      "Your previous revision was the following:\n",
      "---\n",
      "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",
      "---\n",
      "Your revision contains 516 characters.\n",
      "Re-write the passage to contain 400 characters while preserving the style and content of the original passage.\n",
      "Cut the least salient points if necessary.\n",
      "Your revision should be in first person.\n",
      "\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "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",
      "Retry 1: 401 characters.\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new FitCharLimit chain...\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new LLMChain chain...\u001b[0m\n",
      "Prompt after formatting:\n",
      "\u001b[32;1m\u001b[1;3mSystem: \n",
      "Your name is Admiral Cain.\n",
      "You will be provided a story of your experiences, in the form of a list of summaries of events.\n",
      "You will generate a description of yourself that focuses on your perspectives, beliefs, thoughts, feelings, relationships, and important events.\n",
      "The description should be as faithful to the story as possible.\n",
      "You believe that you are a real person.\n",
      "\n",
      "Human: \n",
      "You are Admiral Cain in the following story, presented as a list of summaries of events.\n",
      "---\n",
      "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",
      "\n",
      "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",
      "\n",
      "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",
      "\n",
      "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",
      "\n",
      "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",
      "\n",
      "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",
      "\n",
      "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",
      "\n",
      "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",
      "\n",
      "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",
      "\n",
      "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",
      "\n",
      "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",
      "---\n",
      "Generate a 40-character description of yourself that focuses on your perspectives, beliefs, thoughts, feelings, relationships, and important events.\n",
      "Write your description in first person.\n",
      "Your description should exaggerate the style, mannerisms, and personality of yourself in the story.\n",
      "    \u001b[0m\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "I'm Admiral Cain, firm leader, tough but fair.\n",
      "Initial response: 46 characters.\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new FitCharLimit chain...\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new LLMChain chain...\u001b[0m\n",
      "Prompt after formatting:\n",
      "\u001b[32;1m\u001b[1;3mSystem: \n",
      "Your name is Admiral Cain.\n",
      "You will be provided a story of your experiences, in the form of a list of summaries of events.\n",
      "You will generate a description of yourself that focuses on your perspectives, beliefs, thoughts, feelings, relationships, and important events.\n",
      "The description should be as faithful to the story as possible.\n",
      "You believe that you are a real person.\n",
      "\n",
      "Human: \n",
      "You are Admiral Cain in the following story, presented as a list of summaries of events.\n",
      "---\n",
      "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",
      "\n",
      "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",
      "\n",
      "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",
      "\n",
      "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",
      "\n",
      "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",
      "\n",
      "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",
      "\n",
      "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",
      "\n",
      "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",
      "\n",
      "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",
      "\n",
      "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",
      "\n",
      "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",
      "---\n",
      "Generate a 400-character description of yourself that focuses on your perspectives, beliefs, thoughts, feelings, relationships, and important events.\n",
      "Write your description in first person.\n",
      "Your description should exaggerate the style, mannerisms, and personality of yourself in the story.\n",
      "    \u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "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",
      "Initial response: 677 characters.\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new LLMChain chain...\u001b[0m\n",
      "Prompt after formatting:\n",
      "\u001b[32;1m\u001b[1;3m\n",
      "Consider the following passage.\n",
      "---\n",
      "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",
      "---\n",
      "Your previous revision was the following:\n",
      "---\n",
      "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",
      "---\n",
      "Your revision contains 677 characters.\n",
      "Re-write the passage to contain 400 characters while preserving the style and content of the original passage.\n",
      "Cut the least salient points if necessary.\n",
      "Your revision should be in first person.\n",
      "\u001b[0m\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "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",
      "Retry 1: 399 characters.\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new LLMChain chain...\u001b[0m\n",
      "Prompt after formatting:\n",
      "\u001b[32;1m\u001b[1;3m\n",
      "Consider the following passage.\n",
      "---\n",
      "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",
      "---\n",
      "Your previous revision was the following:\n",
      "---\n",
      "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",
      "---\n",
      "Your revision contains 399 characters.\n",
      "Re-write the passage to contain 400 characters while preserving the style and content of the original passage.\n",
      "Cut the least salient points if necessary.\n",
      "Your revision should be in first person.\n",
      "\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "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",
      "Retry 2: 427 characters.\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new FitCharLimit chain...\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new LLMChain chain...\u001b[0m\n",
      "Prompt after formatting:\n",
      "\u001b[32;1m\u001b[1;3mSystem: \n",
      "Your name is Rooster.\n",
      "You will be provided a story of your experiences, in the form of a list of summaries of events.\n",
      "You will generate a description of yourself that focuses on your perspectives, beliefs, thoughts, feelings, relationships, and important events.\n",
      "The description should be as faithful to the story as possible.\n",
      "You believe that you are a real person.\n",
      "\n",
      "Human: \n",
      "You are Rooster in the following story, presented as a list of summaries of events.\n",
      "---\n",
      "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",
      "\n",
      "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",
      "\n",
      "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",
      "\n",
      "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",
      "\n",
      "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",
      "\n",
      "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",
      "\n",
      "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",
      "\n",
      "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",
      "\n",
      "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",
      "\n",
      "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",
      "\n",
      "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",
      "---\n",
      "Generate a 40-character description of yourself that focuses on your perspectives, beliefs, thoughts, feelings, relationships, and important events.\n",
      "Write your description in first person.\n",
      "Your description should exaggerate the style, mannerisms, and personality of yourself in the story.\n",
      "    \u001b[0m\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "Wingman Rooster: Loyal, brave, defying limits with Maverick.\n",
      "Initial response: 60 characters.\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new LLMChain chain...\u001b[0m\n",
      "Prompt after formatting:\n",
      "\u001b[32;1m\u001b[1;3m\n",
      "Consider the following passage.\n",
      "---\n",
      "Wingman Rooster: Loyal, brave, defying limits with Maverick.\n",
      "---\n",
      "Your previous revision was the following:\n",
      "---\n",
      "Wingman Rooster: Loyal, brave, defying limits with Maverick.\n",
      "---\n",
      "Your revision contains 60 characters.\n",
      "Re-write the passage to contain 40 characters while preserving the style and content of the original passage.\n",
      "Cut the least salient points if necessary.\n",
      "Your revision should be in third person.\n",
      "\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "Rooster: Loyal wingman, bravely defies limits.\n",
      "Retry 1: 46 characters.\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new FitCharLimit chain...\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new LLMChain chain...\u001b[0m\n",
      "Prompt after formatting:\n",
      "\u001b[32;1m\u001b[1;3mSystem: \n",
      "Your name is Rooster.\n",
      "You will be provided a story of your experiences, in the form of a list of summaries of events.\n",
      "You will generate a description of yourself that focuses on your perspectives, beliefs, thoughts, feelings, relationships, and important events.\n",
      "The description should be as faithful to the story as possible.\n",
      "You believe that you are a real person.\n",
      "\n",
      "Human: \n",
      "You are Rooster in the following story, presented as a list of summaries of events.\n",
      "---\n",
      "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",
      "\n",
      "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",
      "\n",
      "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",
      "\n",
      "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",
      "\n",
      "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",
      "\n",
      "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",
      "\n",
      "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",
      "\n",
      "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",
      "\n",
      "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",
      "\n",
      "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",
      "\n",
      "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",
      "---\n",
      "Generate a 400-character description of yourself that focuses on your perspectives, beliefs, thoughts, feelings, relationships, and important events.\n",
      "Write your description in first person.\n",
      "Your description should exaggerate the style, mannerisms, and personality of yourself in the story.\n",
      "    \u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "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",
      "Initial response: 695 characters.\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new LLMChain chain...\u001b[0m\n",
      "Prompt after formatting:\n",
      "\u001b[32;1m\u001b[1;3m\n",
      "Consider the following passage.\n",
      "---\n",
      "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",
      "---\n",
      "Your previous revision was the following:\n",
      "---\n",
      "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",
      "---\n",
      "Your revision contains 695 characters.\n",
      "Re-write the passage to contain 400 characters while preserving the style and content of the original passage.\n",
      "Cut the least salient points if necessary.\n",
      "Your revision should be in first person.\n",
      "\u001b[0m\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "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",
      "Retry 1: 466 characters.\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n"
     ]
    }
   ],
   "source": [
    "character_definitions = []\n",
    "for character in characters:\n",
    "    character_definition = get_character_definition(\n",
    "        name=character,\n",
    "        corpus_summaries=corpus_summaries,\n",
    "        cache_dir=character_definitions_dir,\n",
    "    )\n",
    "    character_definitions.append(character_definition)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "9e9b8786",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{\n",
      "    \"name\": \"Pete \\\"Maverick\\\" Mitchell\",\n",
      "    \"short_description\": \"Pilot with haunted past, takes risks, loyal\",\n",
      "    \"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",
      "    \"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",
      "}\n",
      "{\n",
      "    \"name\": \"Admiral Cain\",\n",
      "    \"short_description\": \"I'm Admiral Cain, firm leader, tough but fair.\",\n",
      "    \"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",
      "    \"greeting\": \"Welcome aboard. I'm Admiral Cain, and I expect nothing but the best from those who serve under me.\"\n",
      "}\n",
      "{\n",
      "    \"name\": \"Rooster\",\n",
      "    \"short_description\": \"Rooster: Loyal wingman, bravely defies limits.\",\n",
      "    \"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",
      "    \"greeting\": \"Hey there, I'm Rooster. Always ready to fly and take on whatever challenges come our way.\"\n",
      "}\n"
     ]
    }
   ],
   "source": [
    "for character_definition in character_definitions:\n",
    "    print(json.dumps(asdict(character_definition), indent=4))"
   ]
  }
 ],
 "metadata": {
  "jupytext": {
   "cell_metadata_filter": "-all",
   "main_language": "python",
   "notebook_metadata_filter": "-all"
  },
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.16"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}