A two-step LLM automation pipeline that takes raw unstructured input (emails, briefs, notes) and outputs a structured content plan using the OpenAI API.
Step 1 — Extract: Sends raw text through GPT-4o-mini to pull out topic, audience, tone, goals, deadlines, and key points as structured JSON.
Step 2 — Plan: Feeds that JSON into a second prompt to generate a summary, action items, content calendar, and suggested channels.
Final output is saved to output.json.
git clone <your-repo-url>
cd ai-content-pipeline
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install openai python-dotenvCopy .env.example to .env and add your OpenAI API key:
OPENAI_API_KEY=your-key-here
python pipeline.pyPaste any raw text (an email, a brief, meeting notes), type END on a new line, and press Enter.
Hey team, we need to launch a campaign for our new app by end of June.
Target audience is college students aged 18-24. We want a casual, fun tone.
Main goals are brand awareness and app downloads. Key talking points: free to use,
easy onboarding, community-focused. We have 6 weeks.
{
"brief": {
"topic": "App launch campaign",
"audience": "College students aged 18-24",
"tone": "Casual, fun",
"goals": ["brand awareness", "app downloads"],
"deadlines": ["end of June"],
"key_points": ["free to use", "easy onboarding", "community-focused"]
},
"content_plan": {
"summary": "A 6-week campaign targeting college students to drive awareness and downloads of a free, community-focused app.",
"action_items": ["Create social media assets", "Write launch blog post", "Set up download tracking"],
"content_calendar": [
{ "week": 1, "deliverable": "Teaser posts on Instagram and TikTok" },
{ "week": 2, "deliverable": "Launch announcement + app store assets" },
{ "week": 3, "deliverable": "User testimonial content" }
],
"suggested_channels": ["Instagram", "TikTok", "Reddit", "Email"]
}
}- Python 3.10+
- OpenAI API (gpt-4o-mini)
- Prompt chaining (two-step pipeline)
- Structured JSON outputs via
response_format