✨ Content Generator
Generate and transform content with AI. Product descriptions, blog posts, translations, summaries — all with simple function calls.
What Can You Generate?
Product Descriptions
Compelling copy that sells
Blog Posts
Articles and content
Social Media
Posts, captions, hashtags
Emails
Marketing & transactional
Translations
Any language pair
Summaries
Condense long content
Product Descriptions
Generate compelling product descriptions from basic details:
async function generateProductDescription(product) {
const prompt = `Write a compelling product description for:
Product: ${product.name}
Category: ${product.category}
Key Features: ${product.features.join(', ')}
Price: ${product.price}
Requirements:
- 2-3 short paragraphs
- Highlight benefits, not just features
- Include a call to action
- Tone: professional but friendly`;
return await GammalTech.ai.ask(prompt);
}
// Usage
const description = await generateProductDescription({
name: 'ProSound Wireless Earbuds',
category: 'Electronics',
features: ['40-hour battery', 'Active noise cancellation', 'IPX5 waterproof'],
price: '$79.99'
});
console.log(description);
Blog Post Generator
Generate structured blog posts with headings and sections:
async function generateBlogPost(topic, options = {}) {
const {
length = 'medium', // short, medium, long
tone = 'informative', // informative, casual, professional
audience = 'general' // general, technical, beginners
} = options;
const wordCount = { short: 300, medium: 600, long: 1000 }[length];
const prompt = `Write a blog post about: ${topic}
Requirements:
- Length: approximately ${wordCount} words
- Tone: ${tone}
- Target audience: ${audience}
- Include: engaging intro, 3-4 main sections with headings, conclusion
- Format: Use markdown headings (## for sections)
- Add a compelling title at the start`;
return await GammalTech.ai.ask(prompt, {
maxTokens: 1500
});
}
// Usage
const post = await generateBlogPost(
'Benefits of meditation for developers',
{ length: 'medium', tone: 'casual', audience: 'technical' }
);
Translation
Translate text between any languages:
async function translate(text, targetLang, options = {}) {
const { preserveFormatting = true, style = 'natural' } = options;
const prompt = `Translate the following to ${targetLang}.
${preserveFormatting ? 'Preserve all formatting, line breaks, and structure.' : ''}
Style: ${style} (natural/formal/casual)
Text to translate:
---
${text}
---
Translation:`;
return await GammalTech.ai.ask(prompt);
}
// Usage examples
const arabic = await translate(
'Welcome to our store!',
'Arabic'
);
// "مرحباً بكم في متجرنا!"
const french = await translate(
'Your order has been shipped.',
'French',
{ style: 'formal' }
);
// "Votre commande a été expédiée."
Summarization
Condense long content into key points:
async function summarize(text, options = {}) {
const {
format = 'paragraph', // paragraph, bullets, tldr
length = 'short' // short, medium, detailed
} = options;
const formatInstructions = {
paragraph: 'Write as a concise paragraph.',
bullets: 'Format as bullet points (5-7 key points).',
tldr: 'Write a single sentence TL;DR.'
};
const prompt = `Summarize the following text.
${formatInstructions[format]}
Length: ${length}
Text:
---
${text}
---
Summary:`;
return await GammalTech.ai.ask(prompt);
}
// Usage
const bullets = await summarize(longArticle, {
format: 'bullets',
length: 'short'
});
const tldr = await summarize(longArticle, {
format: 'tldr'
});
Social Media Posts
Generate platform-optimized social content:
async function generateSocialPost(content, platform) {
const platformRules = {
twitter: 'Max 280 characters. Punchy and engaging. Include 1-2 relevant hashtags.',
instagram: 'Longer caption OK. Story-telling style. Include 5-10 relevant hashtags at the end.',
linkedin: 'Professional tone. Can be longer. Use line breaks for readability. 3-5 hashtags.',
facebook: 'Conversational. Ask a question to encourage engagement. 1-2 hashtags optional.'
};
const prompt = `Create a ${platform} post about:
${content}
Rules: ${platformRules[platform]}
Post:`;
return await GammalTech.ai.ask(prompt);
}
// Generate for multiple platforms
async function generateAllPlatforms(content) {
const platforms = ['twitter', 'instagram', 'linkedin'];
const results = {};
for (const platform of platforms) {
results[platform] = await generateSocialPost(content, platform);
}
return results;
}
// Usage
const posts = await generateAllPlatforms(
'We just launched our new AI-powered photo editor!'
);
Tone Adjustment
Rewrite content in a different tone:
async function adjustTone(text, targetTone) {
const tones = {
formal: 'Professional, business-appropriate language',
casual: 'Friendly, conversational, relaxed',
enthusiastic: 'Excited, energetic, using exclamations',
empathetic: 'Understanding, supportive, caring',
persuasive: 'Convincing, compelling, action-oriented',
simple: 'Easy to understand, no jargon, clear'
};
const prompt = `Rewrite the following text in a ${targetTone} tone.
Tone description: ${tones[targetTone]}
Keep the same meaning but change the style.
Original:
${text}
Rewritten:`;
return await GammalTech.ai.ask(prompt);
}
// Usage
const formal = 'We need to fix this bug ASAP, it\'s breaking everything!';
const professional = await adjustTone(formal, 'formal');
// "We have identified a critical issue that requires immediate attention..."
Content Generator Class
Combine all generators into a reusable class:
class ContentGenerator {
async productDescription(product) {
return GammalTech.ai.ask(`Write a compelling product description:
Name: ${product.name}
Features: ${product.features?.join(', ') || 'N/A'}
Price: ${product.price || 'N/A'}
Requirements: 2-3 paragraphs, benefit-focused, include CTA`);
}
async blogPost(topic, length = 'medium') {
const words = { short: 300, medium: 600, long: 1000 }[length];
return GammalTech.ai.ask(`Write a ${words}-word blog post about: ${topic}
Include: title, intro, 3-4 sections with headings, conclusion`, { maxTokens: 1500 });
}
async translate(text, language) {
return GammalTech.ai.ask(`Translate to ${language}: ${text}`);
}
async summarize(text, format = 'bullets') {
return GammalTech.ai.ask(`Summarize as ${format}: ${text}`);
}
async socialPost(content, platform) {
return GammalTech.ai.ask(`Create a ${platform} post about: ${content}`);
}
async adjustTone(text, tone) {
return GammalTech.ai.ask(`Rewrite in ${tone} tone: ${text}`);
}
}
// Usage
const content = new ContentGenerator();
const desc = await content.productDescription({ name: 'Smart Watch', price: '$199' });
const arabic = await content.translate('Hello world', 'Arabic');
Best Practices
• Be specific in your prompts — include format, length, tone
• Provide context — who is the audience?
• Use examples when possible
• Set constraints — max words, required sections
• Always review AI output before publishing
• AI-generated content may need editing
• Verify facts and claims
• Don't use for legal, medical, or financial advice
• Disclose AI usage if required by platform policies
AI Prompt for Vibe Coding
Content GeneratorCopy this prompt to build custom generators: