Introduction
This repository demonstrates the implementation of Retrieval Augmented Generation (RAG) using LangChain, WatsonX, and PostgreSQL in Openshift. RAG is a versatile pattern that enables factual recall of information, such as querying a knowledge base in natural language.
Components
- Openshift: Cluster Enviroment
- LangChain: A Python library for building and integrating AI models
- WatsonX: A cloud-based AI platform for building and deploying AI models
- PostgreSQL: A relational database management system with vector database capabilities using PgVector
Demo Overview
This demo showcases the following components:
- Document loading and data preparation using LangChain
- Building a knowledge using LangChain and WatsonX
- Creating a vector store using PostgreSQL and PgVector
- Implementing RAG using LangChain and WatsonX
- Querying the knowledge using natural language
Setup
To run this demo, you'll need to:
- Create a Openshift instance with Elyra
- Create a server Postgre here
- Create a Watson Machine Learning (WML) Service instance
- Install the required dependencies, including LangChain, WatsonX, and PgVector
- Set up a PostgreSQL database with PgVector enabled
- Load the demo data into the database
Running the Demo
To run the demo, simply execute the provided Python script. The script will guide you through the RAG process, from document loading to querying the knowledge base.
If you are interested to ran locally this application you can use the following insructions here
Note
This demo is for educational purposes only and is not intended for production use. Please ensure you have the necessary permissions and licenses to use the required components.
License
This repository is licensed under the Apache 2.0 License. See the LICENSE file for details.