This project is an interactive web application built with Chainlit that helps users create professional, tailored cover letters. Users can upload their CV/resume, provide a job description, and receive a customized cover letter with the option to request revisions.
- Smart Document Processing: Supports both PDF and Word (.docx) file uploads for CV/resume
- AI-Powered Generation: Creates personalized cover letters powered by OpenAI.
- Interactive Revision System: Users can request up to 5 revisions with specific feedback (integrated feedback loop)
- Multiple Output Formats: Provides both readable text output. Word document output to be added.
- User-Friendly Interface: Step-by-step guidance through the cover letter creation process
- Python 3.8+
- OpenAI API key
-
Clone the repository:
git clone https://github.com/yourusername/cover-letter-generator.git cd cover-letter-generator -
Create a virtual environment (recommended):
python -m venv venv # On Windows: venv\Scripts\activate # On Mac: source venv/bin/activate
-
Install required packages:
pip install -r requirements.txt
-
Create a
.envfile in the project root and add your OpenAI API key:OPENAI_API_KEY=your_api_key_here
-
Start the application:
# On Windows: py main.py # On Mac: python3 main.py
-
Open your browser and navigate to the displayed URL (typically
http://localhost:8000) - System may open the browser on its own. -
Follow the application workflow:
- Paste the job description
- Upload your CV/resume (PDF or Word format)
- Review the generated cover letter
- Request revisions if needed (up to 5)
- Job Description Processing: The application validates the job description for minimum length requirements
- CV/Resume Extraction: Extracts text from uploaded PDF or Word documents
- AI Generation: Uses a carefully crafted prompt template to generate a professional cover letter that:
- Matches job requirements
- Highlights relevant skills and achievements
- Maintains professional tone
- Fits on one page
- Includes strong opening and closing paragraphs
- Revision System: Allows targeted revisions based on user feedback while preserving the original structure
- chainlit: Web interface framework
- langchain & langchain_openai: OpenAI integration and prompt management
- pdfplumber: PDF text extraction
- docx2txt: Word document text extraction
- python-docx: Word document creation
- python-dotenv: Environment variable management
The application uses a temperature of 0.6 for balanced creativity. These settings can be adjusted in the code:
llm = ChatOpenAI(
model_name="gpt-3.5-turbo",
temperature=0.6,
openai_api_key=openai_api_key
)- Maximum 5 revisions per cover letter session
- Supports only PDF and Word (.docx) formats for CV/resume
- Job description must be at least 20 words
- CV/resume must be at least 50 words
- Built with Chainlit
- Powered by OpenAI's GPT-3.5
- Uses LangChain for LLM orchestration