Skip to content

Pankaj7079/AgenticAI-Blog-Generator

Repository files navigation

AgenticAI Blog Generator

A powerful tool to generate high-quality blog posts on any topic, in any language, with the magic of AI.

About the Project

This project is a FastAPI-based application that leverages the power of LangGraph and Groq's large language models (LLMs) to automatically generate well-structured and informative blog posts. Whether you need content for your website, a starting point for your next article, or just want to explore the capabilities of AI-powered content creation, this tool is for you.

Features

  • Dynamic Blog Generation: Create blog posts on any topic you can imagine.
  • Multi-language Support: Generate blogs in the language of your choice.
  • Fast and Efficient: Utilizes the high-performance Groq LLM for speedy content creation.
  • Scalable Architecture: Built with FastAPI and LangGraph, ensuring a robust and scalable solution.
  • Easy to Use: A simple API endpoint makes it easy to integrate with your existing workflows.

Technologies Used

  • Python: The core programming language for the project.
  • FastAPI: A modern, fast (high-performance) web framework for building APIs with Python.
  • LangGraph: A library for building stateful, multi-actor applications with LLMs.
  • LangChain: A framework for developing applications powered by language models.
  • Groq LLM: A high-performance large language model for natural language processing tasks.
  • Uvicorn: A lightning-fast ASGI server for running FastAPI applications.
  • Postman: A popular tool for API testing and development.

Getting Started

To get a local copy up and running, follow these simple steps.

Prerequisites

  • Python 3.12 or higher
  • An API key from Groq

Installation

  1. Clone the repository:
    git clone https://github.com/your_username/agenticai-blog.git
    cd agenticai-blog
  2. Create a virtual environment:
    python -m venv .venv
    source .venv/bin/activate  # On Windows, use `.venv\Scripts\activate`
  3. Install the dependencies:
    pip install -r requirements.txt
  4. Create a .env file in the root directory and add your Groq API key:
    GROQ_API_KEY="your_groq_api_key"
    

Running the Application

To start the FastAPI server, run the following command:

uvicorn app:app --reload

The application will be available at http://127.0.0.1:8000.

Project Structure

.
├── app.py                # FastAPI application
├── main.py               # Main entry point
├── requirements.txt      # Project dependencies
├── src
│   ├── graphs
│   │   └── graph_builder.py  # LangGraph graph definition
│   ├── llms
│   │   └── groqllm.py        # Groq LLM integration
│   ├── nodes
│   │   └── blog_node.py      # Nodes for the LangGraph
│   └── states
│       └── blogstate.py      # State definition for the LangGraph
└── ...

Tools Used

Postman

Postman is an essential tool for testing the API endpoint. You can create a new request to http://127.0.0.1:8000/blogs, set the method to POST, and provide a JSON body with the topic and language to generate a blog post.

LangGraph

LangGraph is a key component of this project. It allows us to define the workflow for generating a blog post as a graph of interconnected nodes. This makes the logic more modular, maintainable, and easier to debug.

API Endpoint

POST /blogs

This endpoint generates a new blog post.

Request Body:

{
  "topic": "The future of AI",
  "language": "english"
}
  • topic (string, required): The topic of the blog post.
  • language (string, optional): The language of the blog post. If not provided, the default is English.

Success Response:

{
  "data": {
    "topic": "The future of AI",
    "current_language": "english",
    "blog_post": "...",
    "review": "...",
    "rewrite": "..."
  }
}

How to Use

  1. Start the application:
    uvicorn app:app --reload
  2. Open Postman or any other API client.
  3. Create a new POST request to http://127.0.0.1:8000/blogs.
  4. Set the Content-Type header to application/json.
  5. Add the request body with the desired topic and language.
  6. Send the request and get your AI-generated blog post in the response.

Contributing

Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

About

"AgenticAI Blog Generator is an AI-powered tool that creates structured, high-quality blog content using LLMs and LangGraph workflows."

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages