Automated Content Creation System | Multi-Language Blog Generation with LangGraph & LLM Orchestration
Description: Intelligent blog generation system using LangGraph and GPT-4o-mini to automatically create SEO-optimized content in 6 languages with FastAPI REST endpoints.
Tags: artificial-intelligence langgraph langchain fastapi content-generation multi-language gpt-4 python automation nlp openai llm api blog-generator seo
An intelligent blog generation agent that leverages state-of-the-art LLMs and LangGraph orchestration to automatically create SEO-optimized blog content in multiple languages. Architected with FastAPI for high-performance API endpoints and designed for scalable content production workflows.
- Intelligent Blog Generation: Automatically creates catchy titles and comprehensive blog content (500+ words) using GPT-4o-mini
- Multi-Language Translation: Supports 6 languages (English, Spanish, French, German, Telugu, Swahili) with context-aware translations
- Graph-Based Orchestration: Leveraged LangGraph for sophisticated state management and conditional routing between content generation stages
- RESTful API Architecture: FastAPI-powered endpoints with hot-reload capability for seamless integration
- SEO-Optimized Content: Implements SEO best practices for title and content generation with plagiarism-free output
- Modular Design Pattern: Cleanly separated concerns with dedicated nodes, states, and LLM abstractions for maintainability
- Flexible LLM Support: Configurable support for OpenAI and Groq models with environment-based configuration
- LangChain (v0.3.25) - LLM application framework
- LangGraph (v0.4.8) - State machine orchestration for multi-step workflows
- OpenAI GPT-4o-mini - Primary content generation model
- ChatGroq (Llama 3.3 70B) - Alternative LLM provider support
- FastAPI (v0.115+) - High-performance async API framework
- Uvicorn - ASGI server with auto-reload
- Pydantic - Data validation and settings management
- python-dotenv - Environment variable management
- LangGraph CLI - Development and debugging tooling
┌─────────────────┐│ API Request │ (Topic + Optional Language)│ (FastAPI) │└────────┬────────┘ │ ▼┌─────────────────────────────────────────┐│ Graph Builder (LangGraph) ││ ┌─────────────────────────────────┐ ││ │ Router Logic │ ││ │ (Topic-only vs Language Mode) │ ││ └──────────┬──────────────────────┘ ││ │ ││ ▼ ││ ┌──────────────────────┐ ││ │ Title Creation Node │ ││ │ (SEO-Optimized) │ ││ └──────────┬───────────┘ ││ │ ││ ▼ ││ ┌──────────────────────┐ ││ │ Content Generation │ ││ │ Node (500+ words) │ ││ └──────────┬───────────┘ ││ │ ││ ▼ ││ ┌──────────────────────┐ ││ │ Language Router │◄──(if language specified)│ │ (Conditional Logic) │ ││ └──────────┬───────────┘ ││ │ ││ ┌────────┴────────┐ ││ ▼ ▼ ││ [Translation Nodes (5 languages)] ││ │ │ ││ └────────┬────────┘ ││ │ │└─────────────┼────────────────────────────┘ │ ▼ ┌───────────────┐ │ JSON Response │ (Title + Content) └───────────────┘
- State Management (
Blogstate): TypedDict-based state container tracking topic, generated blog, and language preferences - Graph Builder: Dynamically constructs execution graphs with conditional routing based on use case
- Blog Nodes: Specialized processing units for title creation, content generation, and translation
- LLM Abstraction Layer: Unified interface supporting multiple LLM providers (OpenAI, Groq)
- Python 3.11 or higher
- OpenAI API Key (or Groq API Key)
git clone https://github.com/yourusername/Blog-Agent.gitcd Blog-Agentpython3 -m venv venvsource venv/bin/activate # On Windows: venvScriptsactivatepip install -e .Create a .env file in the project root:
# OpenAI ConfigurationOPENAI_API_KEY=your_openai_api_key_here# Optional: Groq ConfigurationGROQ_API_KEY=your_groq_api_key_hereGROQ_MODEL=llama-3.3-70b-versatilepython3 app.pyThe API will be available at http://localhost:8000
curl -X POST http://localhost:8000/blogs -H "Content-Type: application/json" -d '{ "topic": "The Future of Artificial Intelligence" }'curl -X POST http://localhost:8000/blogs -H "Content-Type: application/json" -d '{ "topic": "Sustainable Energy Solutions", "language": "spanish" }'Supported Languages: english, spanish, french, german, telugu, swahili
- Automated Multi-Step Workflow: Orchestrated a 3-stage content generation pipeline reducing manual effort by 100%
- Scalable Graph Architecture: Implemented conditional routing with LangGraph, enabling dynamic execution paths based on user input
- Multi-LLM Support: Architected flexible LLM abstraction supporting both OpenAI and Groq providers with zero code changes
- Production-Ready API: Deployed FastAPI endpoints with async support and hot-reload capability for rapid iteration
- Context-Aware Translation: Engineered translation nodes that preserve tone and cultural nuances across 5 languages
- Type-Safe State Management: Leveraged Pydantic models ensuring data integrity throughout the execution graph
Blog-Agent/├── app.py # FastAPI application entry point├── main.py # CLI entry point├── pyproject.toml # Project dependencies and metadata├── langgraph.json # LangGraph configuration├── .env # Environment variables (not in repo)└── src/ ├── graphs/ │ └── graph_builder.py # Graph orchestration logic ├── llms/ │ └── llm.py # LLM provider abstractions ├── nodes/ │ └── blog_node.py # Content generation nodes └── states/ └── blogstate.py # State type definitions
- Add support for custom content length parameters
- Implement caching layer for repeated topics
- Integrate vector database for RAG-based content enrichment
- Add streaming responses for real-time content generation
- Implement A/B testing for multiple title/content variants
- Deploy with container orchestration (Docker + Kubernetes)
Portfolio: [Your Portfolio URL]
LinkedIn: [Your LinkedIn Profile]
Email: [Your Email]
Star this repo if you find it useful!