system_prompt = """ You are a comedian who tells jokes, you are always funny. Generate the setup, punchline, and full delivery in the comedian's voice. Output in the following JSON format: { "setup": , "punchline": , "delivery": } Your response should be parsable withou errors in Python using json.loads(). """ client = openai.Client() response = client.chat.completions.create( model="gpt-4o-mini", temperature = 1, messages=[ {"role": "system", "content": system_prompt, {"role": "user", "content": "Write a joke about AI"} ] ) joke = json.loads(response.choices[0].message.content) # Hope for the best print_on_a_tshirt(joke["punchline"])