Skip to content

Commit

Permalink
Publishing new livelab - Deploy an ODA Chatbot powered by Generative …
Browse files Browse the repository at this point in the history
…AI Agents using 23ai Vector DB: WMS ID 11764, also made changes to WMS ID 11617 (#351)

* Added ATOM steps

* Update manifest.json

* Updated images

* update manifest.json

* Update manifest.json

* Added zip files

* Updated few links

* Update introduction.md

* Updated files

* Updated files

* updated intro

* Update provision.md

* Update introduction.md

* Updated files

* completed first draft of intro

* Updated files

* Updated files

* Updated files

* Updated files

* Update provision.md

* Updated need help links

* Update provision.md

* Update provision.md

* Deleted images from sample workshop

* Updated Provision.md

* Updated Provision.md

* Updated Provision.md and addded and image

* Update provision.md

* Update provision.md

* Update provision.md

* Updated files

* Added another lab

Added another lab

* Update provision.md

Updated few steps

* Updated names

* Updated

Updated

* Updated

* Updated files

* Updated file

Updated

* Updated instructions

Updated instructions

* Updated files

Updated files

* Updated files

Updated files

* Updated date

* Files removed

Files removed

* Updated model to command rplus

Updated model to command rplus

* Updated date

* Updated to chat rplus model

Updated to chat rplus model

* Updated files

Updated files

* Updated files

Updated files

* Updated files

Updated files

* Updated model instructions

* Update provision.md

* Updated provision.md

* Update provision.md

* Updated file

* Adding 23ai agent workshop

Adding 23ai agent workshop

* Updated files

* Updated files

* Updated files

* Update dbconn_create_conn.png

* Updated files

* Updated files

* Updated files

* Updated files

* Updated files

* Updated files

* Updated files

* Create oda_locate.png

* Updated images

* Updated Last Updated date

---------

Co-authored-by: JB Anderson <[email protected]>
  • Loading branch information
abhinavoracle and JBAnderson5 authored Oct 25, 2024
1 parent ca46045 commit 6255c09
Show file tree
Hide file tree
Showing 103 changed files with 1,488 additions and 7 deletions.
Binary file added atom/provision/images/component_attach.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 atom/provision/images/genai_rplus.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 atom/provision/images/invoke_llms.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 atom/provision/images/llm_ser.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 atom/provision/images/preview_atom.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 atom/provision/images/process_attach.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
54 changes: 47 additions & 7 deletions atom/provision/provision.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,30 +155,70 @@ This task involves creating REST service which will be used by ODA to connect to
![Click Components](images/components.png)
4. Click on Add Service and give this service a name of your choice. For example - RPlusService. And upload the following .tgz file under Component Service Package Creation Type section. Please make sure to change the CompartmentID and modelID located in Rtransformer.js file in components folder to your own CompartmentID and modelID. So in short, you have to unzip it, change those IDs and zip it again to tgz format. Click to download the file [R_Transformer.tgz](https://objectstorage.us-ashburn-1.oraclecloud.com/p/IZm77Vl42_dHGMca5-8XFpMm8rvAebL44L-7C_mXzVb7KfOrY1G_Uy7Ilqd6Vg9w/n/c4u02/b/hosted_workshops/o/R_Transformer.tgz)
4. Click on Add Service and give this service a name of your choice. For example - RPlusService. And upload the following .tgz file under Component Service Package Creation Type section. Please make sure to change the CompartmentID and modelID located in Rtransformer.js file in components folder to your own CompartmentID and modelID. So in short, you have to unzip it, change those IDs and zip it again (using bots-node-sdk by following the steps provided in the note section below) to tgz format. Click to download the file [R_Transformer.tgz](https://objectstorage.us-ashburn-1.oraclecloud.com/p/IZm77Vl42_dHGMca5-8XFpMm8rvAebL44L-7C_mXzVb7KfOrY1G_Uy7Ilqd6Vg9w/n/c4u02/b/hosted_workshops/o/R_Transformer.tgz)
![Service Package](images/service_package.png)
![Service Package](images/service_package.png)
5. Click on hamburger menu and locate & click **API Services** under Settings section. Click on LLM Services and Import the following LLM Service as shown in the image below. Please make sure to change the CompartmentID and modelID located in yaml file to your own CompartmentID and modelID. Click to download the file [LLMService-ChatRPlusLLM.yaml](https://objectstorage.us-ashburn-1.oraclecloud.com/p/L3-NZ_Z7sZheGNvgA6hprS4D_5LXTIBN4WKusdq3llb_QtAxvHZLSpBD4KH3HnBK/n/c4u02/b/hosted_workshops/o/LLMService-ChatRPlusLLM.yaml)
> **Note:**
> * You will need to use the bots node sdk to zip the folder. Run this command in your terminal to install -
```text
<copy>
npm install @oracle/bots-node-sdk
</copy>
```
> * Once installed - cd into the folder and run the below command to zip the folder.
```text
<copy>
npx @oracle/bots-node-sdk pack
</copy>
```
5. Click on Add Service again and give a name - ProcessAttachmentService. Upload the following .tgz file under Component Service Package Creation Type section. Click to download the file [Process.tgz](https://objectstorage.us-ashburn-1.oraclecloud.com/p/O9BuH61wORNYq5E13l9b7GKbMnCXaBRNd2SiUtW0v1dTjCXYGcHkCTlbEM7ZOeDk/n/c4u02/b/hosted_workshops/o/process-attachment-component-1.tgz)
6. Click on hamburger menu and locate & click **API Services** under Settings section. Click on LLM Services and Import the following LLM Service as shown in the image below. Please make sure to change the CompartmentID and modelID located in yaml file to your own CompartmentID and modelID. Click to download the file [LLMService-ChatRPlusLLM.yaml](https://objectstorage.us-ashburn-1.oraclecloud.com/p/L3-NZ_Z7sZheGNvgA6hprS4D_5LXTIBN4WKusdq3llb_QtAxvHZLSpBD4KH3HnBK/n/c4u02/b/hosted_workshops/o/LLMService-ChatRPlusLLM.yaml)
![Import LLM](images/import_llm.png)
6. Go to Skills -> Settings -> Configuration -> Large Language Model Services. Click on New LLM Service.
7. Go to Skills -> Settings -> Configuration -> Large Language Model Services. Click on New LLM Service.
![API Services](images/oci_rest_service_4.png)
7. Provide a name of your choice for this Service. Give LLM Provider value as the one you imported in Step 5. Give Transformation Handler value as the one you imported in Step 4. Click on Check mark under Action to save it as shown in the image below.
8. Provide a name of your choice for this Service. Give LLM Provider value as the one you imported in Step 6. Give Transformation Handler value as the one you imported in Step 4. Click on Check mark under Action to save it as shown in the image below.
![LLM Service](images/llm_service.png)
8. Go to Skills -> Flows. Click on Chat.
9. Go to Skills -> Flows. Click on Attachment.
![Chat Services](images/chat.png)
10. Click on Process attachment. In the pop up box under Custom Component section choose the one under ProcessAttachmentService.
![Process Attach](images/process_attach.png)
11. Next, under Component tab fill in the following values as shown in the screenshot.
![Component Attach](images/component_attach.png)
12. Click on invokeLLM in the Attachment flow as shown.
![Invoke LLMS](images/invoke_llms.png)
13. Under Component change the LLM Service to the one in Step 8.
![LLM Ser](images/llm_ser.png)
14. Go to Skills -> Flows. Click on Chat.
![Chat Services](images/chat.png)
9. Click on invokeLLM and then click on Component. Select the same LLM Service which was created in Step 7.
15. Click on invokeLLM and then click on Component. Select the same LLM Service which was created in Step 8.
![Invoke LLM](images/invoke_llm.png)
16. Click on Preview in the top right corner and start chatting with ATOM Chatbot.
![Preview ATOM](images/preview_atom.png)
## Task 5: Create Channel to embed ODA in Visual Builder Application (provided) or in any custom Web App
1. Click on hamburger menu and select Development > Channels
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 atom/understandingDocument/images/llm_ser.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
152 changes: 152 additions & 0 deletions generative-ai-agent-23ai/adb/adb.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
# Create ADB and DB Tools Connection

## Introduction

This lab will take you through the steps needed to provision Oracle Autonomous Database 23ai and Database Tools Connection. Keep in mind this is an optional lab if you already have a 23ai db provisioned and an existing DB tools connection. You can directly move to lab 3 if you also have a table and vector search function ready.

Estimated Time: 30 minutes

### About Oracle ADB 23ai

Oracle Database 23ai is the next long-term support release of Oracle Database. It includes over 300 new features with a focus on artificial intelligence (AI) and developer productivity. Oracle AI Vector Search is designed for Artificial Intelligence (AI) workloads and allows you to query data based on semantics, rather than keywords.
This feature provides a built-in VECTOR data type that enables vector similarity searches within the database.
With a built-in VECTOR data type, you can run run AI-powered vector similarity searches within the database instead of having to move business data to a separate vector database.

### Objectives

In this lab, you will:

* Provision an Oracle ADB 23ai
* Create DB Tools Connection

### Prerequisites

This lab assumes you have:

* All previous labs successfully completed
* Must have an Administrator Account or Permissions to manage several OCI Services: Oracle Databases, Networking, Policies.

## Task 1: Dynamic Group and Policy Definition

This task will help you ensure that the Dynamic Group and Policy are correctly defined.

1. Locate Domains under Identity & Security

![Domain Navigation](images/locate_domain.png)

2. Click on your current domain name

![Click Domain](images/click_domain.png)

3. Click on Dynamic Groups, and then your Dynamic Group name

![Click DG](images/click_dg.png)

**Note** The name of your dynamic group can be different.

4. Ensure that your Dynamic Group is properly defined - as follows. Then click on Identity

![DG Details](images/dg_details.png)

5. Click on Policies, ensure that you are in your "root" compartment, then click on your Policy name

![Click Policy](images/click_policy.png)

**Note** The name of your policy can be different.

6. Ensure that your Policy is properly defined - as follows.

![Policy Details](images/policy_details.png)

**Note** If you are using a non-default identity domain - then instead of of just supplying the dynamic group name, you need to provide domain-name/group-name in the policy statements.

## Task 2: Create VCN and private subnet

This task will help you to create a VCN and private subnet in your compartment.

1. Go to Networking -> Virtual cloud networks and Create VCN. Provide IPv4 CIDR Blocks as 10.0.0.0/16

2. Go to the newly created VCN and click on Create Subnet. Provide IPv4 CIDR Block as 10.0.1.0/24 and click on Private Subnet. You can leave rest as default. Click on Create Subnet.

3. Click on newly created subnet and go to the Security List. Add following ingress rules in the security list. Make sure to have the ingress rule to access database port 1521-1522

![Ingress Rules](images/ingress_rules.png)

## Task 3: Create Vault to store database secrets

This task will help you to create vault which would be used to save secrets for the database

1. Locate Vault under Key Management & Secret Management. Provide Name and click on Create Vault.

![Vault](images/create_vault.png)

2. Go to the newly created Vault. Click on Create Key.

3. Provide Name and leave rest as default. Choose Protection Mode as HSM and click on Create Key.

![Create Key](images/create_key.png)

## Task 4: Create Autonomous Database

This task involves creating Autonomous Database 23ai.

1. Locate Autonomous Databases under Oracle Databases. Click on Create Autonomous Database.

![Create ADB](images/create_adb.png)

2. Provide information for Compartment, Display name, Database name. Choose workload type as Data Warehouse. Choose deployment type as Serverless. Choose database version as 23ai and give it a password of your preference.

3. Make sure to select the Network Access: Private Endpoint access only, and select the VCN and subnet mentioned in above section. Also, do not check Require mutual TLS (mTLS) authentication.

![ADB creation](images/adb.png)

4. Finally provide a valid email ID and click on Create Autonomous Database.

## Task 5: Create Database Tools Connection

This task involves creating a Database Tools Connection which will be used to query the database using SQL Worksheet.

1. Locate Database Tools Connections under Developer Services. Click on Create connection.

![Create conn](images/dbconn.png)

2. Provide Name and Compartment information. Choose Oracle Autonomous Database as Database cloud service. Provide Username as admin.

3. Click on Create password secret. Provide Name, Vault and Key createdin Task 3. Provide same password used at the time of ADB creation in previous task.

![Create Password](images/dbconn_pass.png)

4. Use the newly created password secret as User password secret.

5. Copy the connection string from your autonomous database. Go to ADB and click on database connection and copy any of the low, medium or high connection strings as shown below,

![Create Conn String](images/conn_string.png)

6. Modify the connection string with the following: Reduce retry_count form 20 to 3; Replace host with private ip address. You can get Private IP address from the autonomous database as shown below.

![Private IP](images/pvt_ip.png)

7. Click on Create private endpoint. Provide Name and private subnet created in Task 1.

![Private Endpoint](images/dbconn_pvt_endp.png)

8. Choose newly created private endpoint as Private Endpoint.

9. Choose Wallet format as None in SSO details.

10. Click on Create to create a database tools connection.

![Create DBTools](images/dbconn_create_conn.png)

11. Go to newly create Database Tools connection. Click on Validate.

![Validate DBTools](images/dbconn_validate.png)

## Acknowledgements

* **Author**
* **Abhinav Jain**, Senior Cloud Engineer, NACIE
* **Contributors**
* **Kaushik Kundu**, Master Principal Cloud Architect, NACIE
* **Last Updated By/Date**
* **Abhinav Jain**, Senior Cloud Engineer, NACIE, October 2024
Binary file added generative-ai-agent-23ai/adb/images/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 generative-ai-agent-23ai/adb/images/click_dg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 generative-ai-agent-23ai/adb/images/dbconn.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 generative-ai-agent-23ai/adb/images/pvt_ip.png
64 changes: 64 additions & 0 deletions generative-ai-agent-23ai/introduction/introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Introduction

## About this Workshop

This workshop will help to configure Generative AI powered chatbot (ATOM) on your own OCI tenancy.
This workshop enables developers to perform GenAI RAG on documents stored in 23ai database using the OCI Generative AI Agent Service.
The users can then

- Connect to OCI Generative AI Agent Service from OCI Digital Assistant Chatbot (hosted in OCI Visual Builder ATOM Application)
- Get responses of their question (in natural language) from those custom documents.
By following the workshop users can install this ATOM application in their own tenancy

![User View](images/image_intro.png)

Estimated Workshop Time: 3 hours

### Objectives

Objective of this workshop is to set-up the required OCI services to create a full Generative AI Agent solution with RAG capabilities:

![Architecture Diagram](images/architecture_23ai.png)

* OCI Generative AI Agent Service – Users can configure OCI Generative AI Agent Service (create and configure Knowledge Bases and Agents).
Users can then ingest and perform RAG on the user’s documents in 23ai database, using OCI Generative AI Agent Service.
* OCI Digital Assistant (ODA) – Users can create ODA instance and import the provided ODA Skill.
Users can then connect from ODA chatbot to OCI Generative AI Agent Service.
* OCI Visual Builder (VB) ATOM Application – User can create OCI Visual Builder (VB) instance and import ATOM VB web application.
Users can then embed the ODA chatbot in ATOM application. Then the users can get responses from their PDF manuals / documents, using the ATOM application.

In this workshop, you will learn how to:

* Create autonomous database and upload documents in the database.
* Setup & configure Generative AI Agent Service (Knowledge Bases and Agents)
* Setup & configure ODA as an LLM powered chatbot
* Setup & configure Visual Builder as a frontend channel for ODA
* Test out the features and capabilities of this ATOM application

### Prerequisites

This lab assumes you have:

* An Oracle Cloud Account
* Access to OCI Generative AI Agents
* Access to a Region where the Agent service is available: Chicago, Frankfurt
* Must have an Administrator Account or Permissions to manage several OCI Services: Generative AI Agents, Digital Assistant, Visual Builder, 23ai database, OCIR, Network, Dynamic Groups, Policies, IDCS/Identity Domain Confidential Applications, Resource Manager
* Familiarity with Oracle Cloud Infrastructure (OCI) is helpful

## Learn More

* [What Is Generative AI? How Does It Work?](https://www.oracle.com/artificial-intelligence/generative-ai/what-is-generative-ai/)
* [What Is Retrieval-Augmented Generation (RAG)?](https://www.oracle.com/artificial-intelligence/generative-ai/retrieval-augmented-generation-rag/)
* [Overview of Generative AI Service](https://docs.oracle.com/en-us/iaas/Content/generative-ai/overview.htm)
* [Overview of Digital Assistants and Skills](https://docs.oracle.com/en-us/iaas/digital-assistant/doc/overview-digital-assistants-and-skills.html)
* [Overview of Visual Builder](https://docs.oracle.com/en-us/iaas/visual-builder/doc/oracle-visual-builder.html)
* [Oracle Digital Assistant's large language model integration](https://docs.oracle.com/en/cloud/paas/digital-assistant/use-chatbot/llm-blocks-skills.html)

## Acknowledgements

* **Author**
* **Abhinav Jain**, Senior Cloud Engineer, NACIE
* **Contributors**
* **Kaushik Kundu**, Master Principal Cloud Architect, NACIE
* **Last Updated By/Date**
* **Abhinav Jain**, Senior Cloud Engineer, NACIE, October 2024
Binary file added generative-ai-agent-23ai/kb/images/create_kb.png
Binary file added generative-ai-agent-23ai/kb/images/locate_kb.png
76 changes: 76 additions & 0 deletions generative-ai-agent-23ai/kb/kb.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Create Knowledge base and chat with agent

## Introduction

This lab walks you through the steps to setup an OCI Generative AI Agent including ingesting a knowledge base from 23ai adb.

Estimated Time: 30 minutes

### About Generative AI Agents

OCI Generative AI Agents is a fully managed service that combines the power of large language models (LLMs) with an intelligent retrieval system to create contextually relevant answers by searching your knowledge base, making your AI applications smart and efficient.

OCI Generative AI Agents supports several ways to onboard your data and then allows you and your customers to interact with your data using a chat interface or API.

### Objectives

In this lab, you will:

* Create Knowledge base
* Create Agent
* Chat with agent

### Prerequisites

This lab assumes you have:

* All previous labs successfully completed
* Permissions to manage OCI Services: Generative AI Agents
* Access to a Region where the Agent service is available: Chicago, Frankfurt

## Task 1: Create Knowledge Base

This task will help you create a knowledge base using 23ai database as source.

1. Locate Knowledge Bases under Analytics & AI -> Generative AI Agents.

![KB Navigation](images/locate_kb.png)

2. Click on your Create knowledge base. Provide Name, Data store type as Oracle AI Vector Search, Provide Database tool connection and click on Test connection. Once successful provide the vector search function created in the optional lab or your own vector search function. Lastly, click on create to create the Knowledge base.

![KB creation](images/create_kb.png)

## Task 2: Create Agent

1. Locate Agents under Analytics & AI -> Generative AI Agents.

![Agent Navigation](images/locate_agent.png)

2. Click on Create Agent. Provide Name, an optional welcome message - Hi I'm 23ai Vector DB RAG Agent. How can I help you? Select the Knowledge base created in previous task. Click on Create.

![Create Agent](images/create_agent.png)

3. In few minutes the status of recently created Agent will change from Creating to Active. Click on "Endpoints" menu item in the left panel and then the Endpoint link in the right panel.

![Endpoint Agent](images/agent_active_endpoint.png)

4. It’ll open up the Endpoint Screen. Copy and keep the OCID of the Endpoint. It’ll be used later. Click on "Launch chat" button

![Agent Endpoint](images/agent_endpoint.png)

## Task 3: Chat with Agent

1. Locate Chat under Analytics & AI -> Generative AI Agents.

![Chat Navigation](images/locate_chat.png)

2. Select agent created in the previous task from the dropdown. Also, select the endpoint associated with that agent. Ask a relevant question depending on information stored in DB and start chatting with the agent.

## Acknowledgements

* **Author**
* **Abhinav Jain**, Senior Cloud Engineer, NACIE
* **Contributors**
* **Kaushik Kundu**, Master Principal Cloud Architect, NACIE
* **Last Updated By/Date**
* **Abhinav Jain**, Senior Cloud Engineer, NACIE, October 2024
Binary file added generative-ai-agent-23ai/oda/images/click_dg.png
Binary file added generative-ai-agent-23ai/oda/images/oda_nav.png
Loading

0 comments on commit 6255c09

Please sign in to comment.