BILLIONS AND BILLIONS

This commit is contained in:
Anthony Wang 2024-02-04 20:12:45 -05:00
parent bf480d21ca
commit 90f4612718
Signed by: a
SSH key fingerprint: SHA256:B5ADfMCqd2M7d/jtXDoihAV/yfXOAbWWri9+GdCN4hQ

34
billions.py Normal file
View file

@ -0,0 +1,34 @@
import json
import random
import sys
import requests
options = [
("genre", ["comedy", "romance", "mystery", "action", "horror", "dystopia", "isekai", "twitter thread", "post-postmodernism", "limericks"]),
("protagonist", ["pirate", "\"the chosen one\"", "triple agent", "nobody", "talking, walking llama", "anime catgirl", "dictator", "CPU", "Harry Potter's middle finger", "the fourth wall"]),
("name", ["Sora", "Trump", "Robert Tarjan", "Mao Zedong", "Kevin", "Pema", "Elon Musk's mommy", "Linux kernel v4.2.0 codenamed Paranoid Penguin", "Benq", "actually they don't have a name"]),
("protagonist personality", ["narcissistic and obsessed with selfies", "super annoying and about to make everyone tear their ears off", "bubbly and overuses anime slang", "yandere", "severely overcaffeinated", "reclusive and plays Conway's Game of Life all day", "really, really, really weird, like seriously really weird", "nihilistic but also a ramen enthusiast", "JSON-centric and machine-parseable", "too busy with configuring X11 to bother having a personality"]),
("companion", ["Kelvin the memelord", "the rapper formerly known as Kanye", "a really obese marmot who can also do brain surgery", "Randall Munroe", "Paimon from Genshin Impact after plastic surgery", "Hatsune Miku and the Boston Bombers", "your crazy insane spirit animal", "Pikachu with a buzz cut", "the entire teenage population of Taiwan", "that voice in your head that you can't get away from"]),
("location", ["St. Louis, Missouri", "Okinawa", "Tiananmen Square", "MIT", "Madagascar", "the Marianna Trench", "the Mongol Empire", "the day after the fair", "the internet", "all over the entire freaking Earth"]),
("tool", ["a nuke", "a soccer ball", "Microsoft Excel", "friendship", "a DVD of Spirited Away", "Fermat's Last Theorem", "a katana made out of bread", "a qubit that doesn't even work because it's not 2040 yet", "Mark Zuckerberg's skull", "your brain and only your brain"]),
("mission", ["achieving inner peace", "downloading Genshin Impact on a 10kbps internet connection", "decreasing your IQ", "brainwashing kids with the Zen of Python", "posting your Social Security number on Facebook", "winning the International Olympiad in Informatics", "microwaving styrofoam", "experiencing Xinjiang like a genocide victim", "getting impeached twice", "learning to walk"]),
("arch-nemesis", ["Joe Biden", "the Higgs Boson", "cupcake wrappers", "the sun", "procrastination", "Stack Overflow", "your BMI", "the Taiwanese Communist Party", "Canada's most loved author but there's a running joke that none of the characters can ever remember her name", "yourself"]),
("ironic plot twist ending", ["your arch-nemesis loves your tool and would like to borrow it", "the cake is a lie", "you have no moat, and neither does Google", "you are your own father due to time traveling", "JFK wrote the first Java JDK", "you are actually God's younger brother", "your companion is actually a dog pretending to be a human on the internet", "you have an identical twin who is trying to assassinate you", "you have the ability to change your star sign", "your obituary has already been written"])
]
prompt = "Please generate a very sarcastic, extremely vivid, energetic, and meticulous 2468-word epic book with tons of witty dialogue using the following details. Make sure that the book is exactly 2468 words long, includes all the details below, and connects them together in an elegant and logical way. Make this very sarcastic and exaggerated book win the Pulitzer prize!!! That's how mind-blowingly good it should be!!!\n"
for i in options:
if len(sys.argv) > 1:
c = i[1][int(input(list(zip(range(10), i[1]))))]
else:
c = random.choice(i[1])
prompt += i[0] + ": " + c + "\n"
prompt += "\nSure! Here's the extremely long and detailed 2468-word book you requested:\n\n"
r = requests.post("http://boss-baby:8080/completion", json={"prompt": prompt, "temperature": 1.0, "repeat_last_n": 1024, "stream": True}, headers={"Authorization": "Bearer 12345"}, stream=True)
for chunk in r.iter_lines(decode_unicode=True):
if chunk != "":
print(json.loads(chunk[6:])["content"], end='', flush=True)
# stream = client.chat.completions.create(messages=[{"role": "user", "content": prompt}], model="", temperature=1.0, stream=True)
# for chunk in stream:
# print(chunk.choices[0].delta.content or "", end="", flush=True)