From a0351f0b8c8caded5fd1aca3b950fa41f7ff4955 Mon Sep 17 00:00:00 2001 From: Shaikh Quader Date: Sun, 16 Mar 2025 05:51:02 +1100 Subject: [PATCH 1/3] Update README.md --- ai-vectors/rag-langchain/README.md | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/ai-vectors/rag-langchain/README.md b/ai-vectors/rag-langchain/README.md index 92b471c..36d7b82 100644 --- a/ai-vectors/rag-langchain/README.md +++ b/ai-vectors/rag-langchain/README.md @@ -1,8 +1,8 @@ -# Implementing Retrieval-Augmented Generation with IBM Db2 and LangChain on RHEL 9.4 +# Implementing Retrieval-Augmented Generation with IBM Db2, watsonx.ai, LangChain ## Introduction -This README presents step-by-step instructions for implementing a Retrieval-Augmented Generation (RAG) use case using IBM Db2 and LangChain on Red Hat Enterprise Linux (RHEL) 9.4. In a recent Early Access Program (EAP), Db2 introduced a native vector data type and vector similarity search functionality. Leveraging these capabilities, I have implemented a complete RAG pipeline with LangChain and Python in a Jupyter Notebook. Customers with access to this EAP build can try out these features in a non-production setup. +This README presents step-by-step instructions for implementing a Retrieval-Augmented Generation (RAG) use case using IBM Db2, watsonx.ai, and LangChain. The complete is available in the [`rag-basic.ipynb`](rag-basic.ipynb) notebook in the same folder, In March 2025 Early Access Program (EAP) build , Db2 introduced a native vector data type and vector similarity search functionality. Leveraging these capabilities, I have implemented a complete RAG pipeline with LangChain and Python in a Jupyter Notebook. Customers with access to [this](http://ibm.biz/db2_early_access_program) EAP build can try out these features in a non-production setup. In this notebook, ## Understanding Retrieval-Augmented Generation @@ -61,9 +61,8 @@ These enhancements allow Db2 to efficiently store and process high-dimensional d ## Implementing the RAG Pipeline -### 1. Setting Up the Environment on RHEL 9.4 - -To begin, ensure that your system is running RHEL 9.4 and has Python 3.12 installed. Starting from RHEL 9.4, Python 3.12 is available in the default package manager. +### 1. Setting Up the Python Environment +I created this tutorial on RHEL 9.4 using Python 3.12. Below are the steps I followed to set up the Python environment on RHEL 9.4. **Installing Python 3.12** @@ -217,7 +216,6 @@ To utilize these variables in your Python code, ensure you have the `python-dote pip install python-dotenv ``` - Then, in your Python script or notebook, load the variables as follows: ```python @@ -232,4 +230,4 @@ db2_database = os.getenv('DATABASE') db2_hostname = os.getenv('HOSTNAME') db2_port = os.getenv('PORT') db2_protocol = os.getenv('PROTOCOL') -db2_uid \ No newline at end of file +db2_uid From 8e296c811118a8b5af83b9db9a2dce1b74da5123 Mon Sep 17 00:00:00 2001 From: shaikhq Date: Sat, 15 Mar 2025 13:03:58 -0700 Subject: [PATCH 2/3] updated readme Signed-off-by: shaikhq --- ai-vectors/rag-langchain/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ai-vectors/rag-langchain/README.md b/ai-vectors/rag-langchain/README.md index 36d7b82..3c15026 100644 --- a/ai-vectors/rag-langchain/README.md +++ b/ai-vectors/rag-langchain/README.md @@ -2,7 +2,7 @@ ## Introduction -This README presents step-by-step instructions for implementing a Retrieval-Augmented Generation (RAG) use case using IBM Db2, watsonx.ai, and LangChain. The complete is available in the [`rag-basic.ipynb`](rag-basic.ipynb) notebook in the same folder, In March 2025 Early Access Program (EAP) build , Db2 introduced a native vector data type and vector similarity search functionality. Leveraging these capabilities, I have implemented a complete RAG pipeline with LangChain and Python in a Jupyter Notebook. Customers with access to [this](http://ibm.biz/db2_early_access_program) EAP build can try out these features in a non-production setup. In this notebook, +This README presents step-by-step instructions for implementing a Retrieval-Augmented Generation (RAG) use case using IBM Db2, watsonx.ai, and LangChain. The complete is available in the [`rag-basic.ipynb`](rag-basic.ipynb) notebook in the same folder, In March 2025 Early Access Program (EAP) build , Db2 introduced a native vector data type and vector similarity search functionality. Leveraging these capabilities, I have implemented a complete RAG pipeline with LangChain and Python in a Jupyter Notebook. Customers with access to [this](http://ibm.biz/db2_early_access_program) EAP build can try out these features in a non-production setup. ## Understanding Retrieval-Augmented Generation From ad5f3e350c7a196513a99e9ea57c6df383e7816b Mon Sep 17 00:00:00 2001 From: shaikhq Date: Sat, 15 Mar 2025 13:10:15 -0700 Subject: [PATCH 3/3] Updated readme Signed-off-by: shaikhq --- ai-vectors/rag-langchain/README.md | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/ai-vectors/rag-langchain/README.md b/ai-vectors/rag-langchain/README.md index 3c15026..d356355 100644 --- a/ai-vectors/rag-langchain/README.md +++ b/ai-vectors/rag-langchain/README.md @@ -208,26 +208,4 @@ PWD=your_db2_password - `UID`: Username for Db2 authentication. - `PWD`: Password for the Db2 user. -**Loading Variables in Python:** - -To utilize these variables in your Python code, ensure you have the `python-dotenv` library installed: - -```bash -pip install python-dotenv -``` - -Then, in your Python script or notebook, load the variables as follows: - -```python -import os -from dotenv import load_dotenv - -load_dotenv() - -watsonx_project = os.getenv('WATSONX_PROJECT') -watsonx_apikey = os.getenv('WATSONX_APIKEY') -db2_database = os.getenv('DATABASE') -db2_hostname = os.getenv('HOSTNAME') -db2_port = os.getenv('PORT') -db2_protocol = os.getenv('PROTOCOL') -db2_uid +Now, open the notebook ['rag-basic.ipynb'](rag-basic.ipynb) and run it. \ No newline at end of file