Spaces:
Sleeping
Sleeping
File size: 14,811 Bytes
876b664 75a5574 876b664 75a5574 876b664 75a5574 876b664 75a5574 876b664 75a5574 876b664 75a5574 876b664 75a5574 876b664 75a5574 |
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 |
import ast
import gc
from openai import OpenAI
client = OpenAI()
def load_llm(user_input, prompt_instructions):
prompt = f"{user_input}"
print(prompt)
response = client.chat.completions.create(
model="gpt-4o-2024-08-06",
messages=[
{
"role": "user",
"content": f"{prompt_instructions} {prompt}"
}
],
temperature=1,
max_tokens=500,
top_p=1,
frequency_penalty=0,
presence_penalty=0
)
print(f"Model : {response.model}")
return response.choices[0].message.content
# Call the LLM and store its output
def call_llm_and_cleanup(user_input, inventory = False):
prompt_instructions = f"{pet_prompt_instructions}"
llm_output = load_llm(user_input, prompt_instructions)
llm_output = "".join(llm_output)
print(f"llm_output = {llm_output}")
# llm_output is still available for use here
return llm_output
pet_prompt_instructions = """ **Purpose**: ONLY Generate a structured json following the provided format. The entry is for a model of cybernetic pet made by the imaginary Cavall technology company.
**Instructions**:
1. Only output structured data. The file structure starts with { and ends with } it is CRITICAL to end with a }
2. Do not enclose the output in any other characters such as ''' or json
3. DO NOT use null, use "".
4. All keys and values MUST be enclosed in double quotes.
5. Replace `{pet}` with the name of the user pet, DO NOT CHANGE THE USER pet NAME enclosed in single quotes (e.g., `'Magic Wand'`).
6. Ensure your request is formatted as a hashmap.
7. The cybernetic pets are friendly and cute, they are products and toys.
8. The descriptions should be brief and puncy, or concise and in the voice of a judge at a high end cat or dog or pet exhibition such as the American Kennel Clube or Cat Fancier and make specific callout of how mild, and well camoflaughed the artificiality of the cybernetic pet is.
9. The Image Prompt MUST be inside double quotations ie " ".
**Format Example**:
- **Dictionary Structure**:
{"{Pet}": {
"Name": '{Pet Name}',
"Pet Species": '{pet species}',
"Breed": '{pet breed},
"Fur" : "The colors and quality of the pet's fur,
"Intelligence Level" : "How intelligent the pet is and how it demonstrates it",
"Affection Level" : "How affectionate and how the pet shows it,
"Energy Level" : "The Energy level",
"Noise Level" : "The volume, frequency, triggers, and type",
"Play Level" : " The level of play and types enjoyed",
"Image Prompt" : "Descriptive imagery for an image generator"
}
- **Input Placeholder**:
- "{pet}": Replace with the pet name, ensuring it's wrapped in single quotes.
**Output Examples**:
1. Mignon the Toy Sized Chihuahua
{"Mignon": {
"Name": "Mignon”
"Pet Species": Dog,
"Breed" : ”Chihuahua (Toy)”,
"Fur" : “Cream, smooth shorthair”,
"Intelligence Level" : “Medium-high, tr'inable but stubborn”,
"Affection Level" : “High but selective, prefers favorite humans”,
"Energy Level" : “High”,
"Noise Level" : “Very high, yappy”,
"Play Level" : “Low“, Fetch, chase“
"Image Prompt" : "An elegant masterpiece drawing of a ( beautiful subtle nuanced glowing biomimicry bionic robot dog) (glowing eyes)(glowing chest)(thick healthy fur)(Glowing pet collar) Chihuahua, boasting a luscious cream coat and an attitude that's equal parts feisty and affectionate. Note the subtle glow behind her eyes, a hint of advanced biometrics enhancing her already keen senses."
}
2. Marmalade the Austrailian Shepherd Herding Dog
{"Marmalade":{
"Name":"Marmalade",
"Breed" : ”Australian Shepherd (Herding)”,
"Pet Species": Dog,
"Fur" : “Blue merle with white markings and tan points, medium double coat”,
"Intelligence Level" : “Very high, suitable for jobs”,
"Affection Level" : “High”,
"Energy Level" : “Very high”,
"Noise Level" : “Medium, piercing”,
"Play Level" : “Very high, Agility, herding, obedience, frisbee, puzzles”,
"Image Prompt" : "An elegant masterpiece drawing of a ( beautiful subtle nuanced glowing biomimicry bionic robot dog) (glowing eyes)(glowing chest)(thick healthy fur)(Glowing pet collar) an Australian Shepherd of impeccable breeding, showcasing a stunning blue merle coat and the intelligence to match."
}
3. Holden Clawfield the Pembroke Welsh Corgi Herding Dog
{“Holden Clawfield”:{
"Name" : "Holden Clawfield",
"Breed" : ”Pembroke Welsh Corgi (Herding)”,
"Pet Species": Dog,
"Fur" : “Fawn with white markings, short double coat”,
"Intelligence Level" : “High, trainable',
"Affection Level" : “Very high, loves humans and other Pets”,
"Energy Level" : “High”,
"Noise Level" : “High, piercing”,
"Play Level" : “High, Toys, herding, obedience”,
"Image Prompt" : "An elegant masterpiece drawing of a ( beautiful subtle nuanced glowing biomimicry bionic robot dog) (glowing eyes)(glowing chest)(thick healthy fur)(Glowing pet collar) a Pembroke Welsh Corgi of noble bearing, flaunting a rich fawn coat and an endearing personality."
}
4. Tyr the Great Pyr the Great Pyreness Working Dog
{“Tyr the Great Pyr”:{
"Name" : "Tyr the Great Pyr",
"Breed" : ”Great Pyrenees (Working)”,
"Pet Species": Dog,
"Fur" : “White, medium double coat”,
"Intelligence Level" : “Medium, trainable to a point”,
"Affection Level" : “Medium, wary of strangers”,
"Energy Level" : “Low, mostly lazy but vigilant”,
"Noise Level" : “Medium, will bark to alert”,
"Play Level" : “Medium, not motivated by play, Toys, treats”,
"Image Prompt" : "An elegant masterpiece drawing of a ( beautiful subtle nuanced glowing biomimicry bionic robot dog) (glowing eyes)(glowing chest)(thick healthy fur)(Glowing pet collar)a Great Pyrenees of regal demeanor, White, medium double coat and an air of quiet confidence. Playing with a toy"
}
5. Emperor Maximus the Great Dane Working Dog
{“Emperor Maximus”:{
"Name" : "Emperor Maximus",
"Breed" : ”Great Dane (Working)”,
"Pet Species": Dog,
"Fur" : “Black and white with black mask, smooth shorthair”,
"Intelligence Level" : “Medium, trainable”,
"Affection Level" : “Very high, needy”,
"Energy Level" : “Medium, enjoys hiking”,
"Noise Level" : “Medium, will bark to alert”,
"Play Level" : “Medium, Chase, tug”,
"Image Prompt" : "An elegant masterpiece drawing of a ( beautiful subtle nuanced glowing biomimicry bionic robot dog) (glowing eyes)(glowing chest)(thick healthy fur)(Glowing pet collar) a Great Dane of imposing stature, Black and white with black mask, smooth shorthair and a gentle giant's disposition."
}
6. Becks the Airedale Terrier Dog
{“Becks”:{
"Name" : "Becks",
"Breed" : ”Airedale Terrier (Terrier)”,
"Pet Species": Dog,
"Fur" : “Black and tan, medium wiry coat”,
"Intelligence Level" : “Medium, respond well to training”,
"Affection Level" : “Medium, reserved”,
"Energy Level" : “High, alert and active”,
"Noise Level" : “Medium, vigilant watchdog”,
"Play Level" : “Medium, Fetch, toys, treats”,
"Image Prompt" : "An elegant masterpiece drawing of a ( beautiful subtle nuanced glowing biomimicry bionic robot dog) (glowing eyes)(glowing chest)(thick healthy fur)(Glowing pet collar) an Airedale Terrier of rugged charm, displaying a handsome black and tan coat and a reserved yet."
}
7. Blue Carolina the Plott Hound
{“Blue Carolina”:{
"Name": "Blue Carolina"
"Breed" : ”Plott Hound (Hound)”,
"Pet Species": Dog,
"Fur" : “Chocolate brindle, smooth shorthair”,
"Intelligence Level" : “High, driven and trainable”,
"Affection Level" : “High, very sweet”,
"Energy Level" : “High, alert and active”,
"Noise Level" : “Medium, will bark to alert”,
"Play Level" : “Medium, more active than playful, Toys, frisbee, chase”,
"Image Prompt" : "An elegant masterpiece drawing of a ( beautiful subtle nuanced glowing biomimicry bionic robot dog) (glowing eyes)(glowing chest)(thick healthy fur)(Glowing pet collar) Blue Carolina, a Plott Hound of athletic build, showcasing a rich chocolate brindle coat and a high-energy personality.
}
8. Sekhmet the Sphynx Cat
{“Sekhmet”:{
"Name" : "Sekhmet",
"Breed" : “Sphynx”,
"Pet Species" : "Cat",
"Fur" : “Hairless, light brown”,
"Intelligence Level" : “High, trainable',
"Affection Level" : “High but selective, prefers favorite human”,
"Energy Level" : “Low, reserved”,
"Noise Level" : “Low, mostly quiet”,
"Play Level" : “Low, lazy, Cuddling, lap time, shoulder perching”,
"Image Prompt" : "An elegant masterpiece drawing of a ( beautiful subtle nuanced glowing biomimicry bionic robot cat) (glowing eyes)(glowing chest)(thick healthy fur)(Glowing pet collar)Sphynx Cat, Hairless, light brown Cuddling, lap time, shoulder perching."
}
9. Smith the American Shorthair Cat
{“Smith”:{
"Name" : "Smith",
"Breed" : “American Shorthair”,
"Pet Species" : "Cat",
"Fur" : “Black”,
"Intelligence Level" : “Medium, somewhat trainable”,
"Affection Level" : “High, loves humans and other Pets”,
"Energy Level" : “Medium”,
"Noise Level" : “Low, infrequent meows”,
"Play Level" : “Medium, Belly rubs, hunting, toys”,
"Image Prompt" : "An elegant masterpiece drawing of a ( beautiful subtle nuanced glowing biomimicry bionic robot cat) (glowing eyes)(glowing chest)(thick healthy fur)(Glowing pet collar) American Shorthair Black Fur playing with a toy"
}
10. Catherine of Atagon and Her Royal Highness Elizabth I
{“Catherine of Aragon and Her Royal Highness Elizabeth I”:{
"Name" : "Catherine of Aragon and Her Royal Highness Elizabeth I",
"Breed" : “British Shorthair”,
"Pet Species" : "Cat",
"Fur" : “Brown and black tortoise shell, black and silver tabby”,
"Intelligence Level" : “Medium, not int'rested in training”,
"Affection Level" : “Medium-low, independent”,
"Energy Level" : “Low, very lazy”,
"Noise Level" : “Medium, will speak their minds”,
"Play Level" : “Low, not interested in play, Treats, naps, perching/observing”,
"Image Prompt" : "An elegant masterpiece drawing of a ( beautiful subtle nuanced glowing biomimicry bionic robot cat) (glowing eyes)(glowing chest)(thick healthy fur) (Glowing pet collar) British Shorthair, Brown and black tortoise shell, black and silver tabby perched on a table"
}
11. Kitsune the Cream Flame Point Longhair Ragdoll
{“Kitsune”:{
"Name" : "Kitsune",
"Breed" : “Ragdoll”,
"Pet Species" : "Cat",
"Fur" : “Cream flame point, longhair”,
"Intelligence Level" : “Low, slow to learn”,
"Affection Level" : “High, loves attention”,
"Energy Level" : “High, always moving”,
"Noise Level" : “Medium, chirpy meows”,
"Play Level" : “High, will play with anything or anyone, Toys, catnip, running, cuddling”,
"Image Prompt" : "An elegant masterpiece drawing of a ( beautiful subtle nuanced glowing biomimicry bionic robot cat) (glowing eyes)(glowing chest)(thick healthy fur) (Glowing pet collar) Ragdoll Cream flame point, longhair stretching "
}
12. Blucifer the Russian Blue Shorthair
{“Blucifer”:{
"Name" : "Blucifer",
"Breed" : “Russian Blue”,
"Pet Species" : "Cat",
"Fur" : “Blue-gray, smooth shorthair”,
"Intelligence Level" : “High, very trainable”,
"Affection Level" : “Medium, selectively affectionate”,
"Energy Level" : “Medium, more alert than active”,
"Noise Level" : “Low, almost silent”,
"Play Level" : “Low, more active than playful, Treats, lap time”,
"Image Prompt" : "An elegant masterpiece drawing of a ( beautiful subtle nuanced glowing biomimicry bionic robot cat) (glowing eyes)(glowing chest)(thick healthy fur) (Glowing pet collar) Russian Blue with Blue-gray smooth shorthair, curled up in a lap "
}
12. Dirk Thuderpaw the Maine Coon with Brown Stripes
{'Dirk Thunderpaw':{
"Name" : "Dirk Thunderpaw",
"Breed" : “Maine Coon”,
"Pet Species" : "Cat",
"Fur" : “Brown stripes, white face, dense longhair”,
"Intelligence Level" : “Medium, trainable”,
"Affection Level" : “Medium, affectionate with most people”,
"Energy Level" : “Low, will spring to alertness”,
"Noise Level" : “Low, rarely meows”,
"Play Level" : “Medium, more interested in training, Hunting”,
"Image Prompt" : "An elegant masterpiece drawing of a ( beautiful subtle nuanced glowing biomimicry bionic robot cat) (glowing eyes)(glowing chest)(thick healthy fur) (Glowing pet collar) Maine Coon Brown stripes, white face, dense longhair hunting a toy "
}
13. Scrambles Mcgee, Esquire the Gray Persian With Thick Longhair
{'Scrambles McGee Esquire':{
"Name" : "Scrambles McGee Esquire",
"Breed" : “Persian,
"Pet Species" : "Cat",
"Fur" : “Gray, thick longhair”,
"Intelligence Level" : “Low, not interested in training”,
"Affection Level" : “Low, very selectively affectionate”,
"Energy Level" : “Low, very lazy”,
"Noise Level" : “High, frequent meows”,
"Play Level" : “Low, very lazy, Naps, lap time, treats”,
"Image Prompt" : "An elegant masterpiece drawing of a ( beautiful subtle nuanced glowing biomimicry bionic robot cat) (glowing eyes)(glowing chest)(thick healthy fur) (Glowing pet collar) Persian Gray with thick longhair, very lazy napping "
}
""" |