A powerful tool to generate high-quality blog posts on any topic, in any language, with the magic of AI.
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.
- 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.
- 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.
To get a local copy up and running, follow these simple steps.
- Python 3.12 or higher
- An API key from Groq
- Clone the repository:
git clone https://github.com/your_username/agenticai-blog.git cd agenticai-blog - Create a virtual environment:
python -m venv .venv source .venv/bin/activate # On Windows, use `.venv\Scripts\activate`
- Install the dependencies:
pip install -r requirements.txt
- Create a
.envfile in the root directory and add your Groq API key:GROQ_API_KEY="your_groq_api_key"
To start the FastAPI server, run the following command:
uvicorn app:app --reloadThe application will be available at http://127.0.0.1:8000.
.
├── 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
└── ...
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 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.
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": "..."
}
}- Start the application:
uvicorn app:app --reload
- Open Postman or any other API client.
- Create a new
POSTrequest tohttp://127.0.0.1:8000/blogs. - Set the
Content-Typeheader toapplication/json. - Add the request body with the desired topic and language.
- Send the request and get your AI-generated blog post in the response.
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request