This project is a Flask-based web application that processes customer reviews, determines their sentiment, and generates appropriate responses using an AI model powered by LangChain and Groq's Llama3.
- Accepts customer reviews as input.
- Analyzes the sentiment of the review (positive, negative, or neutral).
- Generates an appropriate response based on sentiment.
- Uses LangChain's structured output capabilities.
- Implements a state graph with LangGraph for workflow automation.
- Flask web interface to submit reviews and display AI-generated responses.
- Python: Core programming language
- Flask: Web framework for handling requests and rendering templates
- LangChain: AI framework for LLM-based applications
- LangGraph: Workflow state management for AI processing
- Groq: Model provider for Llama3
- HTML: Frontend for displaying responses
Ensure you have Python installed (recommended version: 3.8+). Install required dependencies using:
pip install flask langchain-core langchain chat_models langgraph
Set up the Groq API key before running the application:
export GROQ_API_KEY='your_groq_api_key'
(Replace your_groq_api_key
with your actual API key.)
- Clone this repository:
git clone <repository_url>
cd <project_directory>
- Run the Flask application:
python app.py
- Open your browser and navigate to:
http://127.0.0.1:5000/
|-- app.py # Main Flask application and AI workflow
|-- templates/
|-- home.html # Review submission page
|-- response.html # Display AI-generated response
- User submits a review via the home page.
- Sentiment analysis determines if the review is positive, negative, or neutral.
- Response generation selects an appropriate AI response template.
- Response is displayed on the response page.
- Improve sentiment classification with fine-tuned models.
- Store reviews and responses in a database.
- Add a frontend using ReactJS for a better user experience.