Skip to content

Chandrak1907/Oracle23aiRAG

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Generative AI has big impact on how enterprises conduct business. Oracle offers multiple products to build a Gen AI application such as retrieval augmented generation (RAG). Here is the sample notebook on langchain and a blog that explains how RAG solution can be implemented using Oracle's new database offering Oracle23ai to store embedding vectors.

If you are new to Oracle23ai, there are chances that you might encounter issues connecting to database using python. This documentation provides step-by-step procedure to implement the RAG solution using python3.9 to extract & store the contents of a webpage and create embeddings to store in oracle23ai.

  1. Login to Oracle cloud using the credentials provided by the adminstrator

  2. Provision an Click on menu on top left - Oracle Database - and select "Oracle Base Database"

    2.1 In 'DB System Information' page, you'll be asked select shape, storage, to add/generate/paste SSH Keys and create/select VCN

    2.2 In 'Database information' page, Click 'Database image' and select version '23ai'

    2.3 Once Database is provisioned, click on the Database provisioned in 'Databases' secton (Overview Oracle Base Database -> DB Systems -> DB System Details)

    2.4 Click on Pluggable Databases. Read more about difference between Container Database (CDB) and Pluggable Database here

    2.5 Select 'DB Connection'

    2.6 Copy the 'Connection String' from 'Easy Connect' Format to a notepad or text editor and keep it handy. Screenshot is here

    2.7 Navigate to Oracle Base Database -> DB Systems -> DB System Details -> Nodes, copy the 'Public IP address' to a notepad or text editor and keep it handy. Screenshot is here

  3. If you're using a mac, there are limitations to connect to Oracle23ai database. So, recommend you to provision a Linux compute instance

  4. Install miniconda in this compute instance

  5. Create a python environment for python version 3.9 or later. Below command will create a python environment named py39 using the environment.yml file located here

    conda env create -f environment.yml

  6. Download Oracle InstantClient Basic for Linux x86-64 from https://download.oracle.com/otn_software/linux/instantclient/2340000/instantclient-basic-linux.x64-23.4.0.24.05.zip

    curl https://download.oracle.com/otn_software/linux/instantclient/2340000/instantclient-basic-linux.x64-23.4.0.24.05.zip --output instantclient.zip

  7. Unzip it in an opt directory using sudo

    sudo mkdir -p /opt/oracle  
    cd /opt/oracle  
    sudo unzip /opt/oracle/instantclient-basic-linux.x64-23.4.0.24.05.zip
    
  8. Install a linux package libaio1

    sudo apt-get install libaio1

  9. Add the path the external variable LD_LIBRARY_PATH by adding below line to .bashrc file

    export LD_LIBRARY_PATH=/opt/oracle/instantclient_23_4:$LD_LIBRARY_PATH

  10. After saving the .bashrc file, source it: source ~/.bashrc

  11. Follow steps in this link and install python-cli

  12. Create a config file using oci setup config

  13. Update VCN to allow traffic through ports 1521 and 9200. This is required to connect to 23ai Database.

  14. Update 'constants.py' file in 'code' folder with all required information

  15. Run 'python code/create_user.py' to create non-admin user in the database

  16. Run 'python code/create_embeddings.py' to create embeddings of the webpage that you want to index

  17. Run 'python code/generate_answers.py' to generate answers to your question

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages