This project is designed to demonstrate the use of Retrieval-Augmented Generation (RAG) and LangChain technology to build a context-aware newspaper article generator. The tool retrieves relevant information from Wikipedia based on a user query, generates a brief article in three paragraphs, and creates a catchy headline for the article.
- Retrieval-Augmented Generation (RAG): Retrieves contextually relevant information from Wikipedia to enhance the quality and relevance of generated articles.
- LangChain Integration: Utilizes LangChain's Runnable components to create a modular and composable sequence of operations for article generation.
- Text Generation and Summarization: Employs GPT-2 for text generation and a summarization model for headline creation.
- Clone the Repository
git clone https://github.com/greshmashaji/genai-article-generator.git
cd genai-article-generator
- Create a Virtual Environment
python3 -m venv venv
source venv/bin/activate # On Windows, use `venv\Scripts\activate`
- Install Dependencies
pip install -r requirements.txt
Run the Script:
python originalArticle.py
Fetches a summary from Wikipedia based on the provided query.
Generates an article using GPT-2 and ensures it is split into three paragraphs.
Generates a catchy headline using a summarization model.
Retrieves information from Wikipedia and adds it to the inputs.
Generates an article using the retrieved information and ensures it is three paragraphs.
Generates a headline for the article using the summarization model.
Combines the custom steps using LangChain's RunnableSequence to create the final article and headline.