104 A tiny test call (one meme description)
test_desc <- “A data scientist staring at a laptop with 99% confidence, while a tiny graph shows reality.” test_messages <- list( list(role = “system”, content = “You are a witty, data-science-literate meme caption generator.”), list(role = “user”, content = paste(“Provide a short, humorous meme caption for the following description (<= 20 words):”, test_desc)) )
test_res <- call_openai_chat(test_messages, model = “gpt-3.5-turbo”, temperature = 0.7, max_tokens = 60) test_caption <- extract_caption(test_res) test_caption
- Data frame scaffold (meme bank) Create a dataframe with meme_id, format, and description (as above). Then prepare two prompt designs per meme (A and B) to compare prompt engineering effects.
Code: meme_bank <- tibble( meme_id = 1:6, format = c(“Distracted Boyfriend”,“Drake Hotline Bling”,“Two Buttons”,“Change My Mind”,“Is This a Pigeon?”,“Mocking SpongeBob”), description = c( “A data science project that starts with a shiny new model while neglecting the existing baseline.”, “Two API calls: one with a vague prompt vs one with a well-engineered prompt.”, “Prompt choice: quick and dirty vs carefully engineered and tested.”, “Why you should test prompts with a small, controlled experiment before scaling.”, “Is this a data cleaning step or a feature engineering step?”, “When you forget to handle rate limits and your calls crash.” ) )