Skip to content

Instantly share code, notes, and snippets.

@Benhawkins18
Created January 8, 2025 16:15
Show Gist options
  • Select an option

  • Save Benhawkins18/da35dea92263e1f6ab64d8859d8cffcb to your computer and use it in GitHub Desktop.

Select an option

Save Benhawkins18/da35dea92263e1f6ab64d8859d8cffcb to your computer and use it in GitHub Desktop.
Pump My Bags
import openai
# Set up OpenAI API key
openai.api_key = "your-openai-api-key"
def generate_variations(prompt, num_variations=5):
"""
Generates variations of a given prompt using GPT-4.
"""
variations = []
for _ in range(num_variations):
response = openai.ChatCompletion.create(
model="gpt-4",
messages=[
{"role": "system", "content": "You are a creative assistant."},
{"role": "user", "content": f"Generate a variation of: {prompt}"}
],
temperature=0.9,
max_tokens=50
)
variations.append(response['choices'][0]['message']['content'].strip())
return variations
# Example usage
prompt = "Pump my bags"
variations = generate_variations(prompt, num_variations=10)
# Print the generated variations
for i, variation in enumerate(variations, 1):
print(f"{i}. {variation}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment