diff --git a/ai-vectors/rag-langchain/README.md b/ai-vectors/rag-langchain/README.md index 92b471c..d356355 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. ## 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** @@ -209,27 +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 \ No newline at end of file +Now, open the notebook ['rag-basic.ipynb'](rag-basic.ipynb) and run it. \ No newline at end of file