Skip to content

As part of the Neuroclima project, an intelligent chatbot is developed to access climate change policy data and provide responses to policy-related queries in EU countries.

Notifications You must be signed in to change notification settings

sonaliprasadika/neuroclima-AI-chatbot

Repository files navigation

AI-Powered Chatbot for Climate Change Policy Data Using RAG and LangChain

An intelligent chatbot is designed to retrieve data and provide customized responses to user inquiries. It is a valuable tool for decision-makers, especially those operating within specific domains, offering timely and relevant information to support their decision-making processes.

Functionalities

  • Backend to integrate with the AI component of the chatbot and the UI using Python Flask.
  • Basic UI using HTML, CSS, and JavaScript.
  • RAG evaluation.
  • NLP model evaluation.
  • Chatbot conversation evaluation.
  • Fine-tune the summarization model.

🔗 Dependencies and Setup

The following tools and libraries are required for setting up the project.

Install Python version 3.x

  • Install latest python version from here. 3.10.12 is recommended
  • Install pip from here. 24.3.1 is recommended. Note: pip will be available as a part of your python installation. you can check the pip version for verifying.
pip --version

Install the follwoing libs to run Machine Learning Model

  • ☑️ torch==2.5.1+cu118
  • ☑️ transformers==4.36.0
  • ☑️ numpy==1.26.4
  • ☑️ flask==3.1.0
  • ☑️ elasticsearch==8.17.0
  • ☑️ faiss-cpu==1.9.0.post1
  • ☑️ spacy==3.8.3
  • ☑️ gensim==4.3.3
  • ☑️ wikipedia-api==0.7.1
  • ☑️ sentencepiece==0.2.0
  • ☑️ en-core-web-sm==3.8.0
pip install -r requirements.txt

🔗 Run the Chatbot Application and Evaluation

Run the application inside the intelligent_bot directory.

cd intelligent_bot
python3 app.py 

Run Jupyter Notebook files in each evaluation directory to see the evaluation results.

🔗 Host the Server in CSC

  • Create an instance in the CSC server
  • Deploy the server using Gunicorn
pip install gunicorn
nohup gunicorn -w 4 -b 0.0.0.0:5000 app:app > app.log 2>&1 &
  • Ensure Gunicorn is running
ps aux | grep gunicorn

Open http://128.214.253.165:5000/ in browser to load the Chatbot

🔗 Microservice Architecture

The Microservice Architecture is used to ensure that the RAG, LangChain, and core framework (backend and UI) of the application are implemented as separate, independent services, adding modularity and scalability to the application.

Checkout to the branch "adding_microservice"

git checkout adding_microservice

Run the app.py file in each directory (rag_retrieval_service, langchain_generator_service, core_framework)

python3 app.py 
  • rag_retrieval_service - PORT:5002
  • langchain_generator_service - PORT:5003
  • core_framework - PORT:5000

In here, the core framework calls the langchain_generator_service, which in turn calls the rag_retrieval_service.

About

As part of the Neuroclima project, an intelligent chatbot is developed to access climate change policy data and provide responses to policy-related queries in EU countries.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published