Skip to content

Commit b35a3ae

Browse files
authored
Added LiveLabs version of the workshop for #11661 (#557)
* Submited : Create a Large Language Model (LLM) chatbot using Oracle Database 23ai and Generative AI Service. * Name adjustements * Folder rename * Deleted old folder * Fixed some bugs * Added the Livelabs version of the workshop
1 parent b2929dc commit b35a3ae

File tree

8 files changed

+299
-2
lines changed

8 files changed

+299
-2
lines changed

ai-chatbot-engine/setup-23ai/setup-23ai.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Estimated Time: 15 minutes
2222

2323
> Note: If you don't know how to create a virtual machine and connect to it via SSH, please [see this lab first](https://livelabs.oracle.com/pls/apex/r/dbpm/livelabs/view-workshop?wid=648&clear=RR,180&session=108750023091545). The following section will only give you a brief overview.
2424
25-
Open your Oracle Cloud Infrastructure Cloud Console and make sure you are in the "US Midwest (Chicago)" region, which is necessary to access the OCI Generative AI services endpoint.
25+
Open your Oracle Cloud Infrastructure Cloud Console and make sure you are in the "US Midwest (Chicago)" or "Frankfurt" region, which is necessary to access the OCI Generative AI services endpoint.
2626

2727
![console](images/image1.png)
2828

Loading
Loading
Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
# Setup the Python Environment
2+
3+
## Introduction
4+
5+
This lab guide will walk you through setting up Python and Jupyter Lab, which is the development environment we will use to write our RAG chatbot.
6+
7+
Estimated Time: 15 minutes
8+
9+
### Objectives
10+
11+
* Start the Jupyter Lab server and open the development environment.
12+
13+
### Prerequisites
14+
15+
* Access to the NoVNC image specific to this lab
16+
* Basic Linux knowledge
17+
18+
## Task 1: Setup the 23ai database
19+
> Note: Before we do anything, it would be better to open this lab in a Chrome window on the remote noVNC machine. Copying and pasting is way easier to perform this way.
20+
21+
1. The latest Oracle Database 23ai is already installed in the Lab image, but we need to do a few things first.
22+
23+
```bash
24+
<copy>sqlplus sys/freepdb1 as sysdba</copy>
25+
```
26+
27+
2. Paste the following command inside the SQL*Plus session.
28+
29+
```sql
30+
<copy>startup</copy>
31+
```
32+
```sql
33+
<copy>alter session set container = freepdb1;</copy>
34+
```
35+
```sql
36+
<copy>
37+
Create bigfile tablespace tbs2
38+
Datafile 'bigtbs_f2.dbf'
39+
SIZE 1G AUTOEXTEND ON
40+
next 32m maxsize unlimited
41+
extent management local segment space management auto;
42+
</copy>
43+
```
44+
```sql
45+
<copy>
46+
CREATE UNDO TABLESPACE undots2 DATAFILE 'undotbs_2a.dbf' SIZE 1G AUTOEXTEND ON RETENTION GUARANTEE;
47+
</copy>
48+
```
49+
```sql
50+
<copy>
51+
CREATE TEMPORARY TABLESPACE temp_demo
52+
TEMPFILE 'temp02.dbf' SIZE 1G reuse AUTOEXTEND ON
53+
next 32m maxsize unlimited extent management local uniform size 1m;
54+
</copy>
55+
```
56+
57+
We create now a new user for our vector operations:
58+
```sql
59+
<copy>
60+
create user vector identified by vector default tablespace tbs2
61+
quota unlimited on tbs2;
62+
</copy>
63+
```
64+
```sql
65+
<copy>
66+
grant DB_DEVELOPER_ROLE to vector;
67+
</copy>
68+
```
69+
70+
3. Exiting the sqlplus session:
71+
```sql
72+
<copy>
73+
exit
74+
</copy>
75+
```
76+
77+
4. We have now to allocate memory for the in-memory vector index.
78+
```bash
79+
<copy>
80+
sqlplus / as sysdba
81+
</copy>
82+
```
83+
```sql
84+
<copy>
85+
create pfile from spfile;
86+
</copy>
87+
```
88+
```sql
89+
<copy>
90+
ALTER SYSTEM SET vector_memory_size = 512M SCOPE=SPFILE;
91+
</copy>
92+
```
93+
```sql
94+
<copy>
95+
shutdown
96+
</copy>
97+
```
98+
```sql
99+
<copy>
100+
startup
101+
</copy>
102+
```
103+
104+
Check if the vector memory size parameter is there after the restart.
105+
```sql
106+
<copy>
107+
show parameter vector_memory_size;
108+
</copy>
109+
```
110+
It should show `512M`.
111+
112+
113+
5. We now exit the sqlplus session:
114+
```
115+
<copy>
116+
exit
117+
</copy>
118+
```
119+
6. We need a listener to connect to our database from Python.
120+
121+
```bash
122+
<copy>nano $ORACLE_HOME/network/admin/tnsnames.ora</copy>
123+
```
124+
125+
Now copy the existing entry that already exists in there and looks similar to:
126+
127+
```sql
128+
FREE =
129+
(DESCRIPTION =
130+
(ADDRESS = (PROTOCOL = TCP)(HOST = holserv1.livelabs.oraclevcn.com)(PORT = 1521))
131+
(CONNECT_DATA =
132+
(SERVER = DEDICATED)
133+
(SERVICE_NAME = FREE)
134+
)
135+
)
136+
```
137+
138+
And paste it just below, while renaming `FREE` to `FREEPDB1` to look like:
139+
```sql
140+
FREEPDB1 =
141+
(DESCRIPTION =
142+
(ADDRESS = (PROTOCOL = TCP)(HOST = holserv1.livelabs.oraclevcn.com)(PORT = 1521))
143+
(CONNECT_DATA =
144+
(SERVER = DEDICATED)
145+
(SERVICE_NAME = FREEPDB1)
146+
)
147+
)
148+
```
149+
The final step is to re-start the listener:
150+
```bash
151+
<copy>lsnrctl start</copy>
152+
```
153+
154+
## Task 2: Prepare your Python environment
155+
We need to ensure that we are using the desired Python version. Python 3.12 is preinstalled in our lab image, but we need to set up a bit to make sure Jupyter is using it. To do that, we will create a virtual environment named `vectorsenv`.
156+
157+
In the terminal window already open on your NoVNC window in the browser, type:
158+
159+
```bash
160+
<copy>python3.12 -m venv vectorsenv</copy>
161+
```
162+
```bash
163+
<copy>source vectorsenv/bin/activate</copy>
164+
```
165+
166+
## Task 2: Start Jupyter Lab
167+
Now, type:
168+
169+
```bash
170+
jupyter-lab
171+
```
172+
173+
A Chrome window will open, showing our jupyter launcher.
174+
175+
![jupyter lab](images/image7.png)
176+
177+
178+
179+
You may now **proceed to the next lab**
180+
181+
## Learn More
182+
* [Oracle Generative AI Service](https://www.oracle.com/artificial-intelligence/generative-ai/generative-ai-service/)
183+
* [Oracle Database Free](https://www.oracle.com/database/free/)
184+
* [Get Started with Oracle Database 23ai](https://www.oracle.com/ro/database/free/get-started/)
185+
186+
## Acknowledgements
187+
* **Author** - Bogdan Farca, Customer Strategy Programs Leader, Digital Customer Experience (DCX), EMEA
188+
* **Contributors**
189+
- Liana Lixandru, Senior Digital Adoption Manager, Digital Customer Experience (DCX), EMEA
190+
- Kevin Lazarz, Senior Manager, Product Management, Database
191+
* **Last Updated By/Date** - Bogdan Farca, May 2024

ai-chatbot-engine/vectorization/vectorization.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ To provide free Oracle Cloud accounts to our valued customers, we need to ensure
6161

6262
So, we have the question, an empty line, the answer, and then a separator denoted by `=====`. For this simple example, we load the whole thing into memory. For a small FAQ file, there is no need for a proper vector database; however, if your knowledge base grows, you will want one.
6363

64-
### Step 1: Uploading the sample FAQ file to the remote instance.
64+
### Step 1: Dowload the sample FAQ file
6565

6666
Download the sample file from [this link](files/faq.txt?download=1).
6767

ai-chatbot-engine/workshops/freetier/manifest.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
{
2626
"title": "Lab 3: Generate vector embeddings",
2727
"description": "Vectorize a text FAQ file",
28+
"type": "freetier",
2829
"filename": "../../vectorization/vectorization.md"
2930
},
3031
{
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="utf-8">
6+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
7+
<meta name="viewport" content="width=device-width, initial-scale=1">
8+
<meta name="description" content="Oracle LiveLabs gives you access to Oracle's products to run a wide variety of labs and workshops; allowing you to experience our best technology, live!">
9+
<title>Oracle LiveLabs</title>
10+
11+
<script src="https://oracle-livelabs.github.io/common/redwood-hol/js/jquery-1.11.0.min.js"></script>
12+
<script src="https://oracle-livelabs.github.io/common/redwood-hol/js/jquery-ui-1.10.4.custom.js"></script>
13+
<script src="https://oracle-livelabs.github.io/common/redwood-hol/js/main.min.js"></script>
14+
15+
<link rel="stylesheet" href="https://oracle-livelabs.github.io/common/redwood-hol/css/style.min.css" />
16+
<link rel="shortcut icon" href="https://oracle-livelabs.github.io/common/redwood-hol/img/favicon.ico" />
17+
</head>
18+
19+
<body>
20+
<header class="hol-Header" role="banner">
21+
<div class="hol-Header-wrap">
22+
<div class="hol-Header-logo"><span>Oracle LiveLabs</span></div>
23+
<a href="https://developer.oracle.com/livelabs" target="_blank" id="livelabs" title="Oracle LiveLabs"></a>
24+
<div class="hol-Header-actions">
25+
<button id="openNav" class="hol-Header-button hol-Header-button--menu rightNav" aria-label="Open Menu"
26+
title="Open Menu">
27+
<span class="hol-Header-toggleIcon"></span>
28+
</button>
29+
</div>
30+
</div>
31+
</header>
32+
33+
<div id="container">
34+
<div id="leftNav">
35+
<div id="toc"></div>
36+
</div>
37+
<div id="contentBox">
38+
<main class="hol-Content" id="module-content"></main>
39+
</div>
40+
</div>
41+
42+
<footer class="hol-Footer">
43+
<a class="hol-Footer-topLink" href="#top">Return to Top</a>
44+
<div id="footer-banner"><div class="footer-row">
45+
<div class="footer-content"><ul class="footer-links">
46+
<li><a href="https://docs.oracle.com/pls/topic/lookup?ctx=en/legal&id=cpyr" target="_blank" aria-label="Open a new window to Oracle legal notices" data-lbl="copyright">© Oracle</a></li>
47+
<li><a href="https://www.oracle.com/corporate/index.html" target="_blank" aria-label="Open a new window to learn more about oracle" data-lbl="about-oracle">About Oracle</a></li>
48+
<li><a href="https://www.oracle.com/corporate/contact/" target="_blank" aria-label="Open a new window to contact oracle" data-lbl="contact-us">Contact Us</a></li>
49+
<li class="footer-links-break"></li>
50+
<li><a href="https://docs.oracle.com/en/browseall.html" target="_blank" aria-label="Open a new window to products a-z" data-lbl="products-a-z">Products A-Z</a></li>
51+
<li><a href="https://www.oracle.com/legal/privacy/" target="_blank" aria-label="Open a new window to read more about Oracle terms of use and privacy" data-lbl="terms-of-use-and-privacy">Terms of Use & Privacy</a></li>
52+
<li><a href="https://www.oracle.com/legal/privacy/privacy-policy.html#11" target="_blank" aria-label="Open a new window to read more about managing Oracle cookie preferences" data-lbl="cookie-preferences">Cookie Preferences</a></li>
53+
<li><a href="https://www.oracle.com/legal/privacy/marketing-cloud-data-cloud-privacy-policy.html#adchoices" target="_blank" aria-label="Open a new window to ad choices" data-lbl="ad-choices">Ad Choices</a></li>
54+
<li class="footer-links-break"></li><li class="last"><a href="https://docs.oracle.com/pls/topic/lookup?ctx=en/legal&id=cpyr" target="_blank" aria-label="Open a new window to Oracle legal notices" data-lbl="copyright">© Oracle</a></li>
55+
</ul>
56+
</div>
57+
</div>
58+
</div>
59+
</footer>
60+
</body>
61+
62+
</html>
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"workshoptitle": "AI Chatbot engine with Oracle Database 23ai and OCI Generative AI Services",
3+
"help": "livelabs-help-db_us@oracle.com",
4+
"tutorials": [
5+
{
6+
"title": "Introduction",
7+
"description": "Introduction to the workshop and the labs that follow",
8+
"filename": "../../introduction/introduction.md"
9+
},
10+
{
11+
"title": "Get Started with NoVNC",
12+
"description": "Verify Setup of compute instance",
13+
"filename": "https://oracle-livelabs.github.io/common/labs/verify-compute/verify-compute-ssh-and-novnc.md"
14+
},
15+
{
16+
"title": "Lab 1: Setup the development environment",
17+
"description": "Setup the dev environment",
18+
"type": "livelabs",
19+
"filename": "../../setup-livelabs/setup-livelabs.md"
20+
},
21+
{
22+
"title": "Lab 1: Generate vector embeddings",
23+
"description": "Vectorize a text FAQ file",
24+
"type": "livelabs",
25+
"filename": "../../vectorization/vectorization.md"
26+
},
27+
{
28+
"title": "Lab 2: Vector retrieval and Large Language Model generation",
29+
"description": "Vector rerieval and LLM generation",
30+
"filename": "../../search+llm/search+llm.md"
31+
},
32+
{
33+
"title": "Lab 3: Next steps",
34+
"description": "Next steps",
35+
"filename": "../../next-steps/next-steps.md"
36+
},
37+
{
38+
"title": "Need Help?",
39+
"description": "Solutions to Common Problems and Directions for Receiving Live Help",
40+
"filename": "https://oracle-livelabs.github.io/common/labs/need-help/need-help-freetier.md"
41+
}
42+
]
43+
}

0 commit comments

Comments
 (0)