Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WMS 11825 - first version #367

Merged
merged 67 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
a4ddaf8
ocw feedback
MarcGueury Oct 16, 2023
f750650
genai1
MarcGueury Nov 16, 2023
801f89e
Update manifest.json
MarcGueury Nov 16, 2023
7452acd
Merge branch 'oracle-livelabs:main' into main
MarcGueury Mar 18, 2024
f9a19c9
GenAI + Opensearch 2.11
MarcGueury Mar 18, 2024
9d812b5
Merge branch 'main' of github.com:MarcGueury/analytics-ai
MarcGueury Mar 18, 2024
2b9c875
GENAI
MarcGueury Mar 18, 2024
61d1280
Merge branch 'oracle-livelabs:main' into main
MarcGueury Mar 24, 2024
1176142
Known issues
MarcGueury Mar 24, 2024
63b4d83
Merge branch 'main' of github.com:MarcGueury/analytics-ai
MarcGueury Mar 24, 2024
7a0c077
Update integration.md
MarcGueury Mar 25, 2024
a6d6b7c
Several fixes mostly for multi region.
MarcGueury Apr 4, 2024
15d0b6d
a
MarcGueury Apr 12, 2024
71681bd
Merge branch 'main' into main
MarcGueury Apr 12, 2024
ee6fee8
Create genai_agent.md
mkratky May 30, 2024
aa03230
Create images folder
mkratky May 30, 2024
58e291e
Add files via upload
mkratky May 30, 2024
e6e1594
Update genai_agent.md
mkratky May 30, 2024
6528a52
added Lab 4 (Optional): GenAI Agent
mkratky May 30, 2024
48f3f11
Update genai_agent.md
mkratky May 30, 2024
74f0c7e
Add files via upload
mkratky May 30, 2024
f50f285
Delete a.txt
mkratky May 30, 2024
d4c224a
completed genai_agent.md
mkratky May 31, 2024
9fb6317
added genai agent screenshots
mkratky May 31, 2024
a1be3e1
formating changes genai_agent.md
mkratky May 31, 2024
e0c6773
postgres v1
MarcGueury Jun 13, 2024
89dfd08
Merge branch 'oracle-livelabs:main' into main
MarcGueury Jun 14, 2024
b7e8614
v2
MarcGueury Jun 14, 2024
2d36abd
Merge branch 'main' of github.com:MarcGueury/analytics-ai
MarcGueury Jun 14, 2024
236e1ec
Merge branch 'MarcGueury:main' into main
mkratky Jun 20, 2024
ac766b7
initial discover.md
mkratky Jun 20, 2024
995e48f
Delete oci-postgresql-genai-lab/3-discover/images directory
mkratky Jun 24, 2024
6aa9b42
Create images folder
mkratky Jun 24, 2024
bcdca64
added screenshots for lab3
mkratky Jun 24, 2024
1d695f4
Update discover.md
mkratky Jun 24, 2024
91ced50
PostgresLab
MarcGueury Jun 25, 2024
77dfa76
Merge branch 'main' into main
MarcGueury Jun 25, 2024
9b3cd56
Merge pull request #1 from mkratky/main
MarcGueury Jun 25, 2024
f9394f5
Update test.md
MarcGueury Jun 25, 2024
bf4df77
Merge branch 'main' of github.com:MarcGueury/analytics-ai
MarcGueury Jun 25, 2024
96d1086
-
MarcGueury Jun 25, 2024
e4436c6
Hybrid
MarcGueury Aug 16, 2024
4725e06
qa
MarcGueury Aug 16, 2024
269af55
Create .gitignore
MarcGueury Aug 16, 2024
bcdfd73
remove genai agent
MarcGueury Aug 16, 2024
8d6abab
hybrid
MarcGueury Aug 16, 2024
6682c62
screenshot
MarcGueury Aug 16, 2024
1b32ed0
Merge branch 'main' into main
hope-fisher Aug 16, 2024
39f0d01
pgvector
MarcGueury Aug 20, 2024
c7cdf92
Merge branch 'main' of github.com:MarcGueury/analytics-ai
MarcGueury Aug 20, 2024
f4a77cd
Merge branch 'main' of github.com:MarcGueury/analytics-ai
MarcGueury Aug 20, 2024
3c4d103
-
MarcGueury Aug 20, 2024
578e2f4
Merge branch 'oracle-livelabs:main' into main
MarcGueury Nov 18, 2024
3e553f0
Merge branch 'oracle-livelabs:main' into main
MarcGueury Jan 2, 2025
1ee1bb8
Update integration.md
MarcGueury Jan 2, 2025
b2a09ff
Missing grants
MarcGueury Jan 8, 2025
7ef2466
Update connect-apex-with-agents.md
MarcGueury Jan 8, 2025
3fba9fe
Fixes
MarcGueury Jan 13, 2025
e7806c2
not used
MarcGueury Jan 13, 2025
423903a
Merge branch 'oracle-livelabs:main' into main
MarcGueury Jan 13, 2025
813cb3b
date
MarcGueury Jan 13, 2025
bb2433b
OCI Agent Lab V1
MarcGueury Jan 30, 2025
eb54ef6
Merge branch 'oracle-livelabs:main' into main
MarcGueury Jan 30, 2025
fb54ebf
Image OCID
MarcGueury Jan 30, 2025
7b585df
Merge branch 'main' of github.com:MarcGueury/analytics-ai
MarcGueury Jan 30, 2025
8de1a07
images lowercase
MarcGueury Feb 3, 2025
2338d4f
Merge branch 'oracle-livelabs:main' into main
MarcGueury Feb 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
74 changes: 74 additions & 0 deletions oci-genai-agent-ext-lab/0-intro/intro.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@

# Introduction

## About This Workshop
We will extend the features of Oracle Generative AI Agent RAG. The sample will allow to:
- Search documents like Word/Excel, Images, Video, Audio or Websites (using sitemaps)
- Build a custom User Interface (UI) with:
- Oracle Digital Assistant
- APEX
- A python library Streamlit
- Run ingestion automatically

We’ll be able to search documents like:
- Video and Audio files using OCI Speech
- Images using OCI Vision
- TIF files (FAX) using OCI Document Understanding
- Word, Excel, Powerpoint, ... using OCI Functions
- Websites using Sitemap

The installation uses Terraform.

![Screenshot](images/when-was-jazz-created.png)

From the lab 2/3/4, we will create 3 user interfaces for the above using the following tools:
- APEX
- A Python library Streamlit
- Oracle Digital Assistant

Estimated Workshop Time: 90 minutes

### Logical Architecture

This picture shows the processing flow.

![Architecture](images/logical-architecture.png)

It works like this:
1. A document is uploaded to Object Storage by the user
1. An event is raised and queued. The event is processed by a Python program running on a VM. Based on the file type, it will send the file to one or more AI services to enrich them and provide searchable text
1. The searchable text is the result is uploaded to Object Storage "AGENT"
1. The Generative AI AGENT ingests the new files
1. The user query the Generative AI Agent

Here's how various file types are processed.

- If the file has the extension **.pdf**, **.txt**, **.csv**, **.md**, the file is copied to the AGENT Object Storage.
- If the file has the extension **.png**, **.jpg**, **.jpeg**, or **.gif**, it is processed by OCI Vision. The output is stored in the AGENT Object storage
- If the file has the extension **.mp4**, **.avi**, **.mp3**, **.wav**, or **.m4a**, it is processed by OCI Speech.
- If the file has the extension **.tif**, it is processed by OCI Document Understanding.
- If the file has the extension **.json**, this is an output of the asynchronous AI services such as OCI Speech or OCI Document Understanding.
- All other file types like **.doc**, **.docx**, **,xlsx**, **.pptx** are sent to OCI Function with a document parser.

### Physical Architecture

We will install the following architecture using Terraform.

![Integration](images/physical-architecture.png)

### Objectives

- Provision the services needed for the system
- Compartment, Object Storage Bucket, Stream, Event, GenAI Agent, AI services and a Virtual Machine
- Create an OCI Function to convert binary documents (like Word/Excel)
- Integrate the components into a working system
- Search for files through several types of user interfaces

**Please proceed to the [next lab.](#next)**

## Acknowledgements

- **Author**
- Marc Gueury, Generative AI Specialist
- Anshuman Panda, Generative AI Specialist
- Maurits Dijkens, Generative AI Specialist
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.
273 changes: 273 additions & 0 deletions oci-genai-agent-ext-lab/1-install/install.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,273 @@
# Install the Components

## Introduction
In this lab, you will install all the components needed for this workshop. Oracle Digital Assistant will be provisioned manually. The rest will be provisioned automatically using a provided Terraform script.

Estimated time: 40 min

### Objectives

- Provision all the cloud components

### Prerequisites

- An OCI Account with sufficient credits where you will perform the lab. (Some of the services used in this lab are not part of the *Always Free* program.)
- Check that your tenancy has access to the **Frankfurt or London or Chicago Region**
- For Paid Tenancy
- Click on region on top of the screen
- Check that the Frankfurt or London or Chicago Region is there
- If not, Click on Manage Regions to add it to your regions list. You need Tenancy Admin right for this.
- For ex, click on the US MidWest (Chicago)
- Click Subscribe

![Chicago Region](images/chicago-region.png)

- For Free Trial, the HOME region should be Frankfurt or London or Chicago.
- The lab is using Cloud Shell with Public Network.

The lab assume that you have access to **OCI Cloud Shell with Public Network access**.
To check if you have it, start Cloud Shell and you should see **Network: Public** on the top. If not, try to change to **Public Network**. If it works, there is nothing to do.
![Cloud Shell Public Network](images/cloud-shell-public-network.png)

OCI Administrator have that right automatically. Or your administrator has maybe already added the required policy.
- **Solution:**

If not, please ask your Administrator to follow this document:

https://docs.oracle.com/en-us/iaas/Content/API/Concepts/cloudshellintro_topic-Cloud_Shell_Networking.htm#cloudshellintro_topic-Cloud_Shell_Public_Network

He/She just need to add a Policy to your tenancy :

```
<copy>
allow group <GROUP-NAME> to use cloud-shell-public-network in tenancy
</copy>
```

## Task 1: Prepare to save configuration settings

1. Open a text editor and copy & paste this text into a text file on your local computer. These will be the variables that will be used during the lab.

```
<copy>
List of ##VARIABLES##
=====================
COMPARTMENT_OCID=(SAMPLE) ocid1.compartment.oc1.amaaaaaaaa
TF_VAR_auth_token=(SAMPLE) ABCDEF&é!12345
TF_VAR_db_password=(SAMPLE) YOUR_PASSWORD
ODA_OCID= (SAMPLE) ocid1.odainstance.oc1.amaaaaaaaa


Terraform Output
================

AGENT_ENDPOINT_OCID=$AGENT_ENDPOINT_OCID

-----------------------------------------------------------------------
Streamlit:
http://12.45.67.89:8080/

-----------------------------------------------------------------------
APEX login:

APEX Workspace
https://abcdefghijklmnop.apigateway.eu-frankfurt-1.oci.customer-oci.com/ords/_/landing
Workspace: APEX_APP
User: APEX_APP
Password: YOUR_PASSWORD

APEX APP
https://abcdefghijklmnop.apigateway.eu-frankfurt-1.oci.customer-oci.com/ords/r/apex_app/apex_app/
User: APEX_APP / YOUR_PASSWORD
-----------------------------------------------------------------------
Oracle Digital Assistant (Web Channel)
http://12.45.67.89/
</copy>
```

## Task 2: Create a Compartment

The compartment will be used to contain all the components of the lab.

You can
- Use an existing compartment to run the lab
- Or create a new one (recommended)

1. Login to your OCI account/tenancy
2. Go the 3-bar/hamburger menu of the console and select
1. Identity & Security
1. Compartments
![Menu Compartment](images/compartment1.png =40%x*)
2. Click ***Create Compartment***
- Give a name: ex: ***genai-agent***
- Then again: ***Create Compartment***
![Create Compartment](images/compartment2.png)
4. When the compartment is created copy the compartment ocid ##COMPARTMENT_OCID## and put it in your notes


## Task 3: Run a Terraform script to create the other components.

1. Go to the OCI console homepage
2. Click the *Developer Tools* icon in the upper right of the page and select *Code Editor*. Wait for it to load.
3. Check that the Network used is Public. (see requirements)
4. Check that the Code Editor Architecture is well X86_64.
- Go to Actions / Architecture
- Check that the current Architecture is well X86_64.
- If not change it to X86_64 and confirm. It will restart.

![OIC Domain](images/cloud-shell-architecture.png)

5. In the code editor menu, click *Terminal* then *New Terminal*
6. Run the command below in the terminal
![Menu Compute](images/terraform1.png =50%x*)
````
<copy>
git clone https://github.com/mgueury/oci-genai-agent-ext.git
</copy>
````
7. Check if you have an Authorisation Token (associated with your profile).

For more info, see here: https://docs.oracle.com/en-us/iaas/Content/Registry/Tasks/registrygettingauthtoken.htm

If yes, note it in your notepad. If not, the script below will create it.

7. Run each of the three commands below in the Terminal, one at a time. It will run Terraform to create the rest of the components.
```
<copy>
cd oci-genai-agent-ext/starter/
</copy>
```

````
<copy>
./starter.sh build
</copy>
````

Answer the question about Authorization Token and Compartment OCID.

8. **Please proceed to the [next lab](#next) while Terraform is running.**
Do not wait for the Terraform script to finish because it takes about 15 minutes and you can complete some steps in the next lab while it's running. However, you will need to come back to this lab when it is done and complete the next step.
9. When Terraform will finished, you will see settings that you need in the next lab. Save these to your text file. It will look something like:

```
<copy>
-----------------------------------------------------------------------
AGENT_ENDPOINT_OCID=$AGENT_ENDPOINT_OCID

-----------------------------------------------------------------------
Streamlit:
http://12.45.67.89:8080/

-----------------------------------------------------------------------
APEX login:

APEX Workspace
https://abcdefghijklmnop.apigateway.eu-frankfurt-1.oci.customer-oci.com/ords/_/landing
Workspace: APEX_APP
User: APEX_APP
Password: YOUR_PASSWORD

APEX APP
https://abcdefghijklmnop.apigateway.eu-frankfurt-1.oci.customer-oci.com/ords/r/apex_app/apex_app/
User: APEX_APP / YOUR_PASSWORD

-----------------------------------------------------------------------
Oracle Digital Assistant (Web Channel)
http://12.45.67.89/
</copy>
```
**You may now proceed to the [next lab](#next)**

## Known issues

1. During the terraform run, there might be an error resulting from the compute shapes supported by your tenancy:

```
<copy>
oci_core_instance.starter_instance: Creating..
- Error: 500-InternalError, Out of host capacity.
Suggestion: The service for this resource encountered an error. Please contact support for help with service: Core Instance
</copy>
```

Solution: edit the file *starter/src/terraform/variable.tf* and replace the *availability domain* to one where there are still capacity
```
<copy>
OLD: variable availability_domain_number { default = 1 }
NEW: variable availability_domain_number { default = 2 }
</copy>
```

Then rerun the following command in the code editor

```
<copy>
./starter.sh build
</copy>
```

If it still does not work, to find an availability domain or shape where there are still capacity, try to create a compute manually with the OCI console.

2. During the terraform run, there might be an error resulting from the compute shapes supported by your tenancy:

```
<copy>
- Error: 404-NotAuthorizedOrNotFound, shape VM.Standard.x86.Generic not found
</copy>
```

Solution: edit the file *starter/src/terraform/variable.tf* and replace the *instance_shape* to one where there are still capacity in your tenancy/region
```
<copy>
OLD: variable instance_shape { default = "VM.Standard.x86.Generic" }
NEW: variable instance_shape { default = "VM.Standard.E4.Flex" }
</copy>
```

Then rerun the following command in the code editor

```
<copy>
./starter.sh build
</copy>
```

If it still does not work, to find an availability domain or shape where there are still capacity, try to create a compute manually with the OCI console.

3. It happened on new tenancy that the terraform script failed with this error:

```
<copy>
Error: 403-Forbidden, Permission denied: Cluster creation failed. Ensure required policies are created for your tenancy. If the error persists, contact support.
Suggestion: Please retry or contact support for help with service: xxxx
</copy>
```

In such case, just rerunning ./starter.sh build fixed the issue.

4. During terraform:
```
<copy>
Error: 409-PolicyAlreadyExists, Policy 'agent-fn-policy' already exists
</copy>
```

Several persons are probably trying to install this tutorial on the same tenancy.

Solution: edit the file *env.sh* and use a unique *TF\_VAR\_prefix*
```
<copy>
OLD: export TF_VAR_prefix="agent"
NEW: export TF_VAR_prefix="agent2"
</copy>
```


## Acknowledgements

- **Author**
- Marc Gueury, Generative AI Specialist
- Anshuman Panda, Generative AI Specialist
- Maurits Dijkens, Generative AI Specialist

Loading