-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Publishing new LiveLab - Oracle AI Vector Search with OCI Generative …
…AI and Llama Index WMS ID: 11763 (#353) * added template for submission * Added images * Update create-vector-db.md * Update create-vector-db.md * Fixed images * Update create-vector-db.md * added more stuff * Add files via upload * Update create-compute-instance.md * Update create-compute-instance.md * Update create-compute-instance.md * Update create-compute-instance.md * Update create-compute-instance.md * Update create-compute-instance.md * Add files via upload * Update create-compute-instance.md * Update create-compute-instance.md * Update create-compute-instance.md * task 5 * task 5 * Update create-compute-instance.md * Update create-vector-db.md * Update create-compute-instance.md * Update create-compute-instance.md * Add files via upload * Update create-compute-instance.md * Update create-compute-instance.md * Update create-vector-db.md * Add files via upload * Update create-compute-instance.md * Update create-vector-db.md * Rename adb1.png to oci-main-menu.png * Rename adb2.png to oci-create-adb.png * Rename adb3.png to adb-create-form-name.png * Rename adb4.png to adb-create-form-version.png * Rename adb5.png to adb-create-form-passwd.png * Rename adb6.png to adb-lifecyle-tile-green.png * Rename adb7.png to adb-connection-button.png * Update create-compute-instance.md * Rename adb10.png to adb-actions-users.png * Rename adb11.png to adb-users-create-user.png * Rename adb12.png to adb-users-create-user-form.png * Rename adb13.png to adb-admin-signout.png * Rename adb14.png to adb-login-form.png * Rename adb15.png to adb-dev-sql.png * Rename adb17.png to adb-actions-sql.png * Rename adb16.png to adb-sql-worksheet.png * Rename adb-lifecyle-tile-green.png to adb-lifecycle-tile-green.png * Update create-vector-db.md * Delete generative-ai-rag-llama-index/1-create-vector-db/images/adb8.png * Delete generative-ai-rag-llama-index/1-create-vector-db/images/adb9.png * working on it * Create jekyll-gh-pages.yml * Delete .github/workflows directory * testing workflow * workshop added * finished step 4 * minor changes * lab3-fixed * Update create-compute-instance.md * Add files via upload * Add files via upload * Update create-compute-instance.md * Update create-compute-instance.md * Update create-compute-instance.md * fixed lab2 * lab2 issues * a * title * minor fix * Update create-compute-instance.md * Rename Clone-Repo.png to clone-repo.png * Rename Download-Private-Public-Key.png to download-private-public-key.png * Rename On-Creation-VM.png to on-creation-vm.png * Rename Open-Cloud-Shell.png to open-cloud-shell.png * Rename VCN-Port-Opening.png to vcn-port-opening.png * Update create-compute-instance.md * fix copy link * lab 2 fix * Add files via upload * Update create-compute-instance.md * Update create-vector-db.md * Add files via upload * Update create-compute-instance.md * LAB-4 * Update create-compute-instance.md * Update introduction.md * Update create-vector-db.md * Update create-compute-instance.md * Update build-rag-pipeline.md * Update setup-frontend.md * Update setup-frontend.md * changes to images * added git repo * added git repo to intro --------- Co-authored-by: Enis Aras <[email protected]> Co-authored-by: Travis Ledbetter <[email protected]> Co-authored-by: shayhameed01 <[email protected]>
- Loading branch information
1 parent
6255c09
commit 16beafc
Showing
51 changed files
with
483 additions
and
0 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
generative-ai-rag-llama-index/0-introduction/introduction.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Introduction | ||
|
||
## About This Workshop | ||
|
||
The main purpose of this workshop is to get started with using Oracle 23ai Vector Similarity Search, OCI Generative AI Service and Llama-Index for putting together a Retrieval Augmented Generation application that can be utilized with unstructured data. | ||
|
||
Estimated time: 120 minutes | ||
|
||
Objectives | ||
|
||
In this workshop, you will learn how to: | ||
|
||
* Provision Oracle 23ai Autonomous Database. | ||
* Configure access to Oracle Generative AI Service. | ||
* Use embedding and generation models | ||
* Build a RAG Pipeline | ||
* Host complete RAG application on OCI Compute | ||
|
||
Prerequisites: | ||
* Oracle Cloud account with access to the OCI Generative AI service | ||
* Enough privileges to use OCI | ||
* Basic knowledge of Python | ||
* Basic Linux knowledge | ||
|
||
Code used in this livelab can be found below: | ||
* [GitHub Repository](https://github.com/enisaras/Oracle-23ai-ADB-Vector-Search-Chatbot) | ||
|
||
## Learn More | ||
* [OCI Generative AI Service](https://www.oracle.com/artificial-intelligence/generative-ai/generative-ai-service/) | ||
* [Oracle AI Vector Search](https://www.oracle.com/database/ai-vector-search/) | ||
|
||
## Acknowledgements | ||
|
||
* Author - Enis Aras, Travis Ledbetter, Shay Hameed | ||
* Contributors - PS Pathak | ||
* Last Updated By/Date: Travis Ledbetter, October 2024 | ||
|
||
|
111 changes: 111 additions & 0 deletions
111
generative-ai-rag-llama-index/1-create-vector-db/create-vector-db.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
# Lab 1: Create and configure Autonomous Database | ||
|
||
## Introduction | ||
|
||
In this lab we will provision an Oracle Autonomous Database to use as the vector store for the following labs. We will be using the new vector data type in Oracle Database 23ai. | ||
|
||
Estimated Time: 20 mins | ||
|
||
### Prerequisites | ||
|
||
* An Oracle Cloud Infrastructure Account | ||
* Permissions to create an Autonomous Database | ||
|
||
## Task 1: Create the Autonomous Database | ||
|
||
1. Log in to your OCI console. | ||
|
||
2. Open the main "hamburger" menu in the top left corner of the Console. Select "Oracle Database" and then click "Autonomous Database." | ||
![Opening main OCI menu](images/oci-main-menu.png) | ||
|
||
3. Select the correct compartment from the "List Scope"→"Compartment" on the left side of the page, and then click the "Create Autonomous Database" button. | ||
![Selecting compartment on OCI console](images/oci-create-adb.png) | ||
|
||
4. Change the "Display name" and "Database name" to "LiveLabVS" and choose the "Transaction Processing" workload. Everything else can remain as the default. | ||
![Entering details to create database](images/adb-create-form-name.png) | ||
|
||
5. Make sure the database version is "23ai". Everything else can remain as the default. | ||
![Selecting database version 23ai](images/adb-create-form-version.png) | ||
|
||
6. Enter an administrator password. For this lab, we will use "**Livelabpassword1!**". | ||
![Entering database admin password](images/adb-create-form-passwd.png) | ||
|
||
7. Leave everything else as the default, and click the "Create Autonomous Database" button. | ||
|
||
8. Wait while the database is fully provisioned. Once the "ADW" icon turns from orange to green, and the word "AVAILABLE" appears under it, the database is ready. | ||
![Green "ADW" tile on OCI console](images/adb-lifecycle-tile-green.png) | ||
|
||
## Task 2: Download the Autonomous Database Wallet File | ||
|
||
1. Once the database is ready, click the "Database connection" button on the database details page. | ||
![Clicking "Database connection" button on OCI console](images/adb-connection-button.png) | ||
|
||
2. Leave "Wallet Type" as "Instance wallet" and click the "Download wallet" button. Enter a password for the wallet. For this lab, we will be using "**Livelabpassword1!**". Click the "Download" button. | ||
![ADB Wallet download interface](images/adb-wallet-download.png) | ||
![ADB Wallet password](images/adb-wallet-password.png) | ||
|
||
3. Close the database connection page | ||
|
||
## Task 3(Optional): Create an AIUSER Database Account | ||
|
||
1. From the database details page, click the "Database actions" dropdown button and select "Database Users". | ||
![ADB details page database actions button](images/adb-actions-users.png) | ||
|
||
2. Click the "Create User" button on the right side of the page. | ||
![ADB users page](images/adb-users-create-user.png) | ||
|
||
3. Enter the following details for the user: | ||
a. Username: **AIUSER** | ||
b. Quota on tablespace DATA: **UNLIMITED** | ||
c. Password: **Livelabpassword1!** | ||
Enable the slider for "Web Access" | ||
![Form for creating ADB user](images/adb-users-create-user-form.png) | ||
|
||
4. Click the "ADMIN" profile button in the top right of the page, and select "Sign Out". | ||
![Selecting person silhouette, then sign out](images/adb-admin-signout.png) | ||
|
||
5. Enter the credentials for the user account you just created. In this lab we use the following: | ||
a. Username: **AIUSER** | ||
b. Password: **Livelabpassword1!** | ||
![ADB login screen](images/adb-login-form.png) | ||
|
||
6. Select the "Development" tab and select "SQL" from the list. Click the "Open" button. | ||
![ADB console](images/adb-dev-sql.png) | ||
|
||
## Task 4: Create Database Tables For Vector Store | ||
**If you did Task 3, skip to number 2 below:** | ||
1. From the database details page, click the "Database actions" dropdown button and select "SQL". | ||
![Selecting ADB database actions button, then SQL](images/adb-actions-sql.png) | ||
|
||
2. Copy and paste the SQL code from the create_tables.sql file into the SQL worksheet and click the "Run Script" button (or press F5). | ||
![ADB SQL worksheet](images/adb-sql-worksheet.png) | ||
|
||
|
||
|
||
```sql | ||
<copy> | ||
create table BOOKS | ||
("ID" NUMBER NOT NULL, | ||
"NAME" VARCHAR2(100) NOT NULL, | ||
PRIMARY KEY ("ID") | ||
); | ||
|
||
create table CHUNKS | ||
("ID" VARCHAR2(64) NOT NULL, | ||
"CHUNK" CLOB, | ||
"VEC" VECTOR(1024, FLOAT64), | ||
"PAGE_NUM" VARCHAR2(10), | ||
"BOOK_ID" NUMBER, | ||
PRIMARY KEY ("ID"), | ||
CONSTRAINT fk_book | ||
FOREIGN KEY (BOOK_ID) | ||
REFERENCES BOOKS (ID) | ||
); | ||
</copy> | ||
``` | ||
|
||
## **Acknowledgements** | ||
|
||
* **Authors** - Travis Ledbetter | ||
* **Last Updated By/Date** - Travis Ledbetter, October 2024 | ||
|
Binary file added
BIN
+53.6 KB
generative-ai-rag-llama-index/1-create-vector-db/images/adb-actions-sql.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+54.9 KB
generative-ai-rag-llama-index/1-create-vector-db/images/adb-actions-users.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+18.9 KB
generative-ai-rag-llama-index/1-create-vector-db/images/adb-admin-signout.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+97 KB
generative-ai-rag-llama-index/1-create-vector-db/images/adb-connection-button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+65.1 KB
generative-ai-rag-llama-index/1-create-vector-db/images/adb-create-form-name.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+14.3 KB
generative-ai-rag-llama-index/1-create-vector-db/images/adb-create-form-passwd.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+29.1 KB
...rative-ai-rag-llama-index/1-create-vector-db/images/adb-create-form-version.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+165 KB
generative-ai-rag-llama-index/1-create-vector-db/images/adb-dev-sql.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+24.2 KB
...ative-ai-rag-llama-index/1-create-vector-db/images/adb-lifecycle-tile-green.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+68.6 KB
generative-ai-rag-llama-index/1-create-vector-db/images/adb-login-form.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+69.7 KB
generative-ai-rag-llama-index/1-create-vector-db/images/adb-sql-worksheet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+42.2 KB
...ive-ai-rag-llama-index/1-create-vector-db/images/adb-users-create-user-form.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+168 KB
generative-ai-rag-llama-index/1-create-vector-db/images/adb-users-create-user.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+40 KB
generative-ai-rag-llama-index/1-create-vector-db/images/adb-wallet-download.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+30.2 KB
generative-ai-rag-llama-index/1-create-vector-db/images/adb-wallet-password.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+233 KB
generative-ai-rag-llama-index/1-create-vector-db/images/oci-create-adb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+42.4 KB
generative-ai-rag-llama-index/1-create-vector-db/images/oci-main-menu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
91 changes: 91 additions & 0 deletions
91
generative-ai-rag-llama-index/2-create-compute-instance/create-compute-instance.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
# Lab 2: Set up the Compute Instance and Connect to GitHub Code | ||
|
||
## Introduction | ||
This lab you will be creating a virtual machine that will install python 3.11, clone the GitHub Repo, and open necessary port. | ||
|
||
Estimated Time: 30 minutes | ||
|
||
### Prerequisites | ||
* Lab 1 of this Livelab completed. | ||
|
||
## Task 1: Set up OCI Compute Instance | ||
|
||
1. Open the main "hamburger" menu in the top left corner of the Console. Select "Compute" and then click "Instances." | ||
![Selecting Compute from Hamburger Menu](images/hamburger-menu-compute.png) | ||
2. Select the correct compartment from the "List Scope"→"Compartment" on the left side of the page, and then click the "Create Instance" button. | ||
![Clicking Create Compute Instance Button](images/create-instance.png) | ||
3. Select the correct compartment from the "List Scope"→"Compartment" on the left side of the page, and then click the "Create Instance" button. | ||
4. Fill in the following information: | ||
**Name:** LiveLab | ||
|
||
**Shape:** VM.Standard.A1.FLEX | ||
|
||
**Image:** Oracle Linux | ||
|
||
Click on **'Edit'** on Primary VNIC Information | ||
|
||
Click **'Create New Virtual Cloud Network'** | ||
|
||
5. Save private key for access. | ||
![Downloading the Private/Public Keys](images/download-private-public-key.png) | ||
|
||
6. Click **'Create'** | ||
|
||
![Creation Page of the VM](images/on-creation-vm.png) | ||
|
||
## Task 2: Install Python and Clone the Repo | ||
1. Launch Cloud Shell | ||
![Opening Cloud Shell](images/open-cloud-shell.png) | ||
2. Ssh into compute instance. | ||
```bash | ||
<copy> | ||
ssh i ~/[private-key] <username>@<public_ip_address> | ||
</copy> | ||
``` | ||
|
||
3. Install Python 3.11 on VM. | ||
|
||
```bash | ||
<copy> | ||
sudo yum update | ||
sudo yum upgrade | ||
sudo yum install python3.11-devel | ||
python3.11 --version | ||
</copy> | ||
``` | ||
|
||
4. Clone the [git repository](https://github.com/enisaras/Oracle-23ai-ADB-Vector-Search-Chatbot): | ||
```bash | ||
<copy> | ||
git clone https://github.com/enisaras/Oracle-23ai-ADB-Vector-Search-Chatbot.git | ||
</copy> | ||
``` | ||
![Clone Repo](images/clone-repo.png) | ||
|
||
5. Install requirements.txt: | ||
|
||
```bash | ||
<copy> | ||
cd Oracle-23ai-ADB-Vector-Search-Chatbot | ||
pip install -r requirement.txt | ||
</copy> | ||
``` | ||
|
||
## Task 3: Open Port on VCN | ||
|
||
1. On your network, open port 8501: | ||
Go your VCN | ||
Go to Default Security Lists | ||
Add ingress rules: | ||
CIDR: 0.0.0.0/0 | ||
IP protocol: TCP | ||
Destination Port Range: 8501 | ||
|
||
![Open Port 8501](images/vcn-port-opening.png) | ||
|
||
## **Acknowledgements** | ||
|
||
* **Authors** - Shay Hameed | ||
* **Last Updated By/Date** - Travis Ledbetter, October 2024 | ||
|
||
You may now **proceed to the next lab** |
Binary file added
BIN
+104 KB
generative-ai-rag-llama-index/2-create-compute-instance/images/clone-repo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+153 KB
generative-ai-rag-llama-index/2-create-compute-instance/images/clone-repo2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+142 KB
generative-ai-rag-llama-index/2-create-compute-instance/images/clone-repo3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+335 KB
generative-ai-rag-llama-index/2-create-compute-instance/images/create-instance.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+227 KB
...ag-llama-index/2-create-compute-instance/images/download-private-public-key.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+351 KB
...-ai-rag-llama-index/2-create-compute-instance/images/hamburger-menu-compute.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+251 KB
generative-ai-rag-llama-index/2-create-compute-instance/images/on-creation-vm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+595 KB
...rative-ai-rag-llama-index/2-create-compute-instance/images/open-cloud-shell.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+333 KB
...rative-ai-rag-llama-index/2-create-compute-instance/images/vcn-port-opening.png
Oops, something went wrong.
73 changes: 73 additions & 0 deletions
73
generative-ai-rag-llama-index/3-build-rag-pipeline/build-rag-pipeline.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# Lab 3: Build RAG Pipeline | ||
|
||
## Introduction | ||
Today, generative AI is one of the fastest growing fields in technology. Thanks to the advancement in research and industry, companies can now query their unstructured data intelligently using Vector AI Search and generate new content, analysis of events and much more using generative models. In this section we will define, explore and use OCI Embedding and Generative Chat models as well as build a modular RAG pipeline from user provided text data. This section is meant to be educational in nature. If you have experience with Generative AI, feel free to skip the steps marked optional. | ||
|
||
Estimated Time: 30 minutes | ||
|
||
### Prerequisites | ||
|
||
* A tenancy subscribed to the Chicago region. | ||
* Permissions to use OCI Generative AI service shared APIs. | ||
|
||
## Task 1 (Optional): OCI Generative AI Embedding Models: | ||
|
||
The first step to any machine learning task is data. For a very long time, companies all around the world have been querying their structured data stored in a database using SQL statements. For unstructured data, which is defined as any data that is not stored in a table with rows and columns, large blocks text, images, video and audio are all examples of unstructured data. With the help of embedding models this is not the case anymore. These AI models allow us to turn unstructured data into vectors that can be queried. | ||
|
||
Vectors are numerical representations of data that capture the semantic meaning of unstructured content. These vectors can then be used to perform tasks such as similarity search, clustering, and classification, allowing companies to query, analyze, and retrieve insights from their unstructured data efficiently. | ||
|
||
![Embedding Models](images/basic_transform.png) | ||
|
||
1. Click the **Navigation Menu** in the upper left, navigate to **Analytics & AI**, and select **Generative AI**. | ||
![Navigation to OCI Generative AI](images/navigation_menu_ai.png ) | ||
2. On the left navigation panel under **playground**, click **Embedding**. | ||
![Gen AI Playground](images/embedding_left_side.png) | ||
3. Use one of the example templates to embed text or bring in your own data. | ||
![Example data](images/embedding_example.png) | ||
4. Click run to visualize results. Pay special attention to how similar sentences are grouped together. | ||
![Visualize embeddings](images/embedding_graph.png) | ||
|
||
This concludes our section on embedding models. Embedding models are a crucial step in our RAG pipeline, enabling us to uncover similarities in text and perform other semantic applications. Next we will experiment with OCI Generative AI Chat models. | ||
|
||
## Task 2 (Optional): OCI Generative AI Chat Models | ||
|
||
To enable enterprises to take advantage of the ever growing Generative AI models Oracle has introduced a new cloud service called OCI Generative AI Chat models. These models can be utilized through the Generative AI shared API(focus of this section) or through the Dedicated AI Clusters for additional performance and dedicated hosting. Oracle is adding new models for new use cases all the time, meaning the model offerings may change. We will test out some of these models on the OCI Generative AI playground. | ||
|
||
1. Make sure you are in the **OCI Generative AI console**. | ||
2. On the left hand navigation panel, click **Chat**. | ||
![Navigate to Chat Models](images/Chat_left_side.png) | ||
3. Click on "View Model Details" to see models that are available to use, and choose a model. | ||
![Model Details](images/model_details.png) | ||
4. Test out models with the examples provided, or use your own queries. | ||
![Gen AI Playground](images/chat_example.png) | ||
|
||
## Task 3 (Optional): Overview of Retrieval Augmented Generation | ||
|
||
Everything that we have covered in the previous sections and labs have been building up to a RAG pipeline. We first created the 23ai Autonomous Vector Database, a compute instance for our front-end and went over Embedding and Chat models. In this task we will introduce you to retrieval augmented generation and talk about each component of the **RAG Pipeline**. | ||
|
||
RAG Pipeline Components: | ||
|
||
1. Data Ingestion | ||
* Collect and preprocess domain-specific data. | ||
* Generate embeddings using an embedding model. | ||
2. Vector Storage | ||
* Store embeddings in the Autonomous Vector Database. | ||
* Utilize the vector datatype for efficient storage and retrieval. | ||
3. Query Processing | ||
* User inputs a query. | ||
* Generate an embedding of the query. | ||
4. Similarity Search | ||
* Search the vector database using the query embedding. | ||
* Retrieve the most relevant documents or data points. | ||
5. Response Generation | ||
* Feed the retrieved information into a generative AI model. | ||
* Generate a context-aware and accurate response. | ||
|
||
Now that we have an understanding of our RAG components, we can go ahead and proceed to the final step, setting up our front end and finally experimenting with our RAG pipeline | ||
|
||
You may now **proceed to the next lab**. | ||
|
||
## **Acknowledgements** | ||
|
||
* **Authors** - Enis Aras | ||
* **Last Updated By/Date** - Travis Ledbetter, October 2024 |
Binary file added
BIN
+1.18 MB
generative-ai-rag-llama-index/3-build-rag-pipeline/images/Chat_left_side.png
Oops, something went wrong.
Binary file added
BIN
+8.32 KB
generative-ai-rag-llama-index/3-build-rag-pipeline/images/basic_transform.png
Oops, something went wrong.
Binary file added
BIN
+1.06 MB
generative-ai-rag-llama-index/3-build-rag-pipeline/images/chat_example.png
Oops, something went wrong.
Binary file added
BIN
+1.03 MB
generative-ai-rag-llama-index/3-build-rag-pipeline/images/embedding_example.png
Oops, something went wrong.
Binary file added
BIN
+895 KB
generative-ai-rag-llama-index/3-build-rag-pipeline/images/embedding_graph.png
Oops, something went wrong.
Binary file added
BIN
+1.19 MB
generative-ai-rag-llama-index/3-build-rag-pipeline/images/embedding_left_side.png
Oops, something went wrong.
Binary file added
BIN
+704 KB
generative-ai-rag-llama-index/3-build-rag-pipeline/images/model_details.png
Oops, something went wrong.
Binary file added
BIN
+623 KB
generative-ai-rag-llama-index/3-build-rag-pipeline/images/navigation_menu_ai.png
Oops, something went wrong.
Binary file added
BIN
+646 KB
...rative-ai-rag-llama-index/4-setup-gen-ai-frontend/images/RAG_text_generated.png
Oops, something went wrong.
Binary file added
BIN
+42.4 KB
...ative-ai-rag-llama-index/4-setup-gen-ai-frontend/images/adb_navigation_menu.png
Oops, something went wrong.
Binary file added
BIN
+211 KB
generative-ai-rag-llama-index/4-setup-gen-ai-frontend/images/browse_files.png
Oops, something went wrong.
Binary file added
BIN
+1.43 MB
...ative-ai-rag-llama-index/4-setup-gen-ai-frontend/images/database_connection.png
Oops, something went wrong.
Binary file added
BIN
+227 KB
generative-ai-rag-llama-index/4-setup-gen-ai-frontend/images/db_config.png
Oops, something went wrong.
Binary file added
BIN
+532 KB
generative-ai-rag-llama-index/4-setup-gen-ai-frontend/images/disable_rag.png
Oops, something went wrong.
Binary file added
BIN
+234 KB
...tive-ai-rag-llama-index/4-setup-gen-ai-frontend/images/frontend_splash_page.png
Oops, something went wrong.
Binary file added
BIN
+128 KB
generative-ai-rag-llama-index/4-setup-gen-ai-frontend/images/genai_config.png
Oops, something went wrong.
Binary file added
BIN
+106 KB
...tive-ai-rag-llama-index/4-setup-gen-ai-frontend/images/navigate-compartment.png
Oops, something went wrong.
Binary file added
BIN
+970 KB
generative-ai-rag-llama-index/4-setup-gen-ai-frontend/images/tns_names.png
Oops, something went wrong.
67 changes: 67 additions & 0 deletions
67
generative-ai-rag-llama-index/4-setup-gen-ai-frontend/setup-frontend.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# Lab 4: Set up and Experiment with Streamlit Frontend | ||
|
||
## Introduction | ||
|
||
The final lab will cover setting up our front end, which is built on the open source Python package **Streamlit**. To orchastrate our RAG pipeline(refer to detailed explanation in Lab 3 for detailed overview) we will use **Llama-Index** to setup our LLM Chain and experiment with hyperparameters. | ||
|
||
Estimated time: 30 Minutes | ||
|
||
### Prerequisites | ||
* Labs 1 and 2 of this Livelab completed. | ||
* An environment authenticated with OCI API Keys: [docs](https://docs.oracle.com/en-us/iaas/Content/API/Concepts/sdk_authentication_methods.htm) | ||
|
||
## Task 1: Update Config File(Database) | ||
|
||
Assuming that you have gone through all the previous steps, you should now have all the infrastructure you need to run our application. One final thing we need to do before running the app is collect the paramaters that we need to run it: | ||
|
||
1. Navigate to the **Autonomous Database** that we created on [Lab 1](../1-create-vector-db/create-vector-db.md). | ||
![ADB Navigation Menu](images/adb_navigation_menu.png) | ||
2. Once you are in Autonomous Database details page, click **Database Connections**. | ||
![Database Connections](images/database_connection.png) | ||
3. Scroll down to the bottom and copy one of the **service names**. | ||
![ODB Service Names](images/tns_names.png) | ||
4. Navigate to your favorite code editor in the remote compute instance and fill out the DB details. | ||
![Config File DB](images/db_config.png) | ||
|
||
## Task 2: Update Config File(OCI Generative AI) | ||
|
||
1. Click the hamburger menu, navigate to **Identity & Security** then **Compartments**. | ||
![Compartments](images/navigate-compartment.png) | ||
2. Choose the compartment where you provisioned your ADB, Copy OCID of the Compartment. | ||
3. Navigate back to config file and paste details in their respective fields. | ||
![GenAI Config](images/genai_config.png) | ||
|
||
## Task 3: (Optional) Obtain Cohere Reranker API Key | ||
|
||
Reranker is an optional step on our pipeline, but one that can improve relevancy of results by putting it through another layer of evaulation. OCI does not currently have a Reranker as a service, but for testing purposes Cohere offers a Reranker API that we can use. To obtain a Cohere API key, please navigate to [Cohere Website](https://cohere.com). | ||
|
||
## Task 4: Running RAG Front End | ||
|
||
1. Navigate to your terminal window and make sure you are connected to the compute instance previously created in [Lab 2](..2-create-compute-instance/create-compute-instance.md) | ||
2. Change directory into the code repository we have previously cloned in Lab 2. | ||
3. Create a new directory called **wallet** and unzip the previously downloaded zip file in this directory. | ||
4. Enter the following command to run the front end application. | ||
<copy> | ||
```streamlit run app.py``` | ||
</copy> | ||
If you run into any issues in this portion of the lab, you can check error messages and detailed logging on your terminal. | ||
|
||
## Task 5: Experimenting with RAG Frontend | ||
1. After completing the previous task, navigate to ```http://localhost:8501``` on your browser. | ||
![Streamlit Frontend](images/frontend_splash_page.png) | ||
2. Upload a file for processing. This may take some time depending on the size of your file. Supported file types are .txt, .pdf, .csv and .tsv. You can use the example file used in this lab [Oracle 23ai Vector Search User Guide](https://docs.oracle.com/en/database/oracle/oracle-database/23/vecse/oracle-ai-vector-search-users-guide.pdf). | ||
![Upload File](images/browse_files.png) | ||
3. Once the data is preprocessed and vector generation is finished, your RAG Agent is ready to chat with. Make your first query. | ||
![Chat with RAG Agent](images/RAG_text_generated.png) | ||
4. Evaluate results and pay attention to citations retrieved from document. These citations help us reference documents to ensure relevancy in results. | ||
5. Optionally, disable RAG to ask model questions without context provided. | ||
![Disable RAG](images/disable_rag.png) | ||
6. This RAG application allows for many customization options. Try adjusting the model, hyperparameters, minimum similarity score and more. To get more information on model hyperparameters visit [this](https://docs.oracle.com/en-us/iaas/Content/generative-ai/chat-models.htm#parameters-chat) link. | ||
|
||
You may now **proceed to the next lab**. | ||
|
||
## **Acknowledgements** | ||
|
||
* **Authors** - Enis Aras | ||
* **Code** - Enis Aras, PS Pathak, Travis Ledbetter | ||
* **Last Updated By/Date** - Travis Ledbetter, October 2024 |
Oops, something went wrong.