Workflow 2: Content Generation
This workflow generates content using AI models based on input data and templates.
Overview
The Content Generation workflow creates high-quality content using AI models. It supports various content types including articles, summaries, and marketing copy.
Workflow Steps
Step 1: Content Planning
Purpose: Analyzes requirements and creates content plan
Configuration:
{
"stepId": "content_planning",
"name": "Content Planning",
"type": "ai-process",
"config": {
"model": "gpt-4",
"prompt": "Create a content plan for:",
"outputFormat": "structured"
}
}
Step 2: Content Generation
Purpose: Generates content based on plan
Configuration:
{
"stepId": "content_generation",
"name": "Content Generation",
"type": "ai-process",
"config": {
"model": "gpt-4",
"temperature": 0.8,
"maxTokens": 2000
}
}
Step 3: Content Review
Purpose: Reviews and validates generated content
Configuration:
{
"stepId": "content_review",
"name": "Content Review",
"type": "validation",
"config": {
"qualityThreshold": 0.8,
"checkGrammar": true,
"checkTone": true
}
}
Step 4: Content Publishing
Purpose: Publishes content to target platforms
Configuration:
{
"stepId": "content_publishing",
"name": "Content Publishing",
"type": "output",
"config": {
"platforms": ["cms", "blog", "social"],
"format": "markdown"
}
}
Configuration
Basic Configuration
{
"name": "Content Generation Workflow",
"description": "Generates content using AI",
"timeout": 120000,
"retries": 2
}
Usage Examples
Generate Article
import { AIWorkflow } from 'ai-workflow';
const workflow = new AIWorkflow({
apiKey: process.env.AI_WORKFLOW_API_KEY
});
const result = await workflow.execute('content-generation-workflow', {
input: {
topic: "AI in Healthcare",
type: "article",
length: "long",
tone: "professional"
}
});
console.log('Generated content:', result.content);
Generate Multiple Variations
const variations = await Promise.all([
workflow.execute('content-generation-workflow', {
input: { topic: "AI", tone: "professional" }
}),
workflow.execute('content-generation-workflow', {
input: { topic: "AI", tone: "casual" }
}),
workflow.execute('content-generation-workflow', {
input: { topic: "AI", tone: "technical" }
})
]);
Input/Output
Input Schema
{
"topic": "string",
"type": "string (article|summary|copy)",
"length": "string (short|medium|long)",
"tone": "string (professional|casual|technical)",
"targetAudience": "string",
"keywords": "array"
}
Output Schema
{
"content": "string",
"metadata": {
"wordCount": "number",
"readabilityScore": "number",
"generatedAt": "timestamp"
},
"variations": "array"
}
Error Handling
Common Errors
| Error Code | Description | Solution |
|---|---|---|
INVALID_TOPIC | Topic is too vague or invalid | Provide more specific topic |
CONTENT_QUALITY_LOW | Generated content doesn't meet quality threshold | Adjust quality settings |
MODEL_OVERLOAD | AI model is overloaded | Retry with backoff |
Best Practices
- Provide clear and specific topics
- Use appropriate tone for target audience
- Review generated content before publishing
- Test with different variations
- Monitor content quality metrics
Related Workflows
- Workflow 1: Data Processing - Processes data for content generation
- Workflow 3: Report Generation - Generates reports from content
Next Steps
- Workflows Overview - Return to workflows overview
- API Reference - Explore the API