-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSELECTAIRAG_LAB.html
More file actions
392 lines (353 loc) · 12.1 KB
/
SELECTAIRAG_LAB.html
File metadata and controls
392 lines (353 loc) · 12.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Select AI RAG Workshop</title>
<style>
:root {
--bg: #0b1020;
--panel: #121a33;
--panel-2: #0f1730;
--text: #e8ecf8;
--muted: #a9b4d0;
--accent: #7aa2ff;
--accent-2: #5eead4;
--border: rgba(255,255,255,0.10);
--code: #08111f;
--success: #8ef0b5;
--warn: #ffd37a;
}
* { box-sizing: border-box; }
body {
margin: 0;
font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
background: radial-gradient(circle at top, #172247 0%, var(--bg) 55%);
color: var(--text);
line-height: 1.6;
}
.wrap {
max-width: 1100px;
margin: 0 auto;
padding: 32px 20px 64px;
}
header {
background: linear-gradient(135deg, rgba(122,162,255,0.18), rgba(94,234,212,0.10));
border: 1px solid var(--border);
border-radius: 24px;
padding: 28px;
box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
.eyebrow {
display: inline-block;
font-size: 12px;
letter-spacing: 0.16em;
text-transform: uppercase;
color: var(--accent-2);
font-weight: 700;
margin-bottom: 10px;
}
h1 {
margin: 0 0 10px;
font-size: clamp(30px, 4vw, 48px);
line-height: 1.1;
}
.subtitle {
color: var(--muted);
max-width: 900px;
margin: 0;
font-size: 16px;
}
.grid {
display: grid;
grid-template-columns: 1.2fr 0.8fr;
gap: 18px;
margin-top: 20px;
}
.card {
background: rgba(18, 26, 51, 0.86);
backdrop-filter: blur(10px);
border: 1px solid var(--border);
border-radius: 20px;
padding: 20px;
}
h2, h3 {
margin-top: 0;
line-height: 1.2;
}
h2 { font-size: 26px; margin-bottom: 12px; }
h3 { font-size: 20px; margin-bottom: 10px; }
.steps {
display: grid;
gap: 16px;
margin-top: 20px;
}
.step {
background: rgba(15, 23, 48, 0.95);
border: 1px solid var(--border);
border-radius: 18px;
padding: 18px;
}
.stephead {
display: flex;
align-items: center;
gap: 12px;
margin-bottom: 12px;
}
.badge {
flex: 0 0 auto;
width: 40px;
height: 40px;
border-radius: 12px;
display: grid;
place-items: center;
background: rgba(122, 162, 255, 0.15);
color: var(--accent);
font-weight: 800;
}
.stephead h3 {
margin: 0;
font-size: 18px;
}
.note {
color: var(--muted);
margin: 8px 0 0;
}
.callout {
border-left: 4px solid var(--accent-2);
background: rgba(94, 234, 212, 0.08);
padding: 12px 14px;
border-radius: 12px;
color: var(--text);
margin: 12px 0 0;
}
pre {
background: var(--code);
border: 1px solid rgba(255,255,255,0.08);
border-radius: 16px;
padding: 16px;
overflow-x: auto;
margin: 14px 0 0;
white-space: pre;
}
code {
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
font-size: 13px;
color: #d5e2ff;
}
.kicker {
display: inline-block;
margin-bottom: 8px;
color: var(--warn);
font-weight: 700;
font-size: 13px;
text-transform: uppercase;
letter-spacing: 0.12em;
}
ul {
margin: 10px 0 0 20px;
color: var(--muted);
}
.two-col {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 16px;
}
.mini {
font-size: 14px;
color: var(--muted);
}
footer {
margin-top: 18px;
color: var(--muted);
font-size: 13px;
text-align: center;
}
@media (max-width: 900px) {
.grid, .two-col { grid-template-columns: 1fr; }
}
</style>
</head>
<body>
<div class="wrap">
<header>
<div class="eyebrow">Oracle Select AI</div>
<h1>RAG Workshop</h1>
<p class="subtitle">
A practical workshop flow for standing up a Select AI Retrieval-Augmented Generation (RAG) setup:
create credentials, connect object storage, create a profile, build a vector index, check pipeline status,
and test with <code>DBMS_CLOUD_AI.GENERATE</code>.
</p>
</header>
<div class="grid">
<section class="card">
<h2>Workshop flow</h2>
<p class="mini">
Replace schema names, bucket names, file names, and credential names with values from your environment.
The SQL below is written as a workshop template.
</p>
<div class="steps">
<article class="step">
<div class="stephead">
<div class="badge">1</div>
<h3>Create credential</h3>
</div>
<p class="note">Create a cloud credential that Select AI can use to reach your external resources.</p>
<pre><code>BEGIN
DBMS_CLOUD.create_credential(
credential_name => 'OCI_GENERATIVE_AI_CRED',
user_ocid => '<UserOCID>',
tenancy_ocid => '<TenancyOCID>',
fingerprint => '<Fingerprint>',
private_key => '<Private Key>'
);
END;
/</code></pre>
<div class="callout">Create API key in your profile and use those credentials here.</div>
</article>
<article class="step">
<div class="stephead">
<div class="badge">1b</div>
<h3>Create object storage credential</h3>
</div>
<p class="note">If your data is in Oracle Object Storage, create a credential for that access as well.</p>
<pre><code>BEGIN
DBMS_CLOUD.CREATE_CREDENTIAL(
credential_name => 'OBJSTORE_CRED',
username => '<OCI_USER_NAME>',
password => '<AUTH_TOKEN>'
);
END;
/</code></pre>
<p class="note" Auth token is available under profile -- tokens and keys ></p>
<p>In some environments you may reuse the same credential; in others it is cleaner to separate AI and storage access.</p>
</article>
<article class="step">
<div class="stephead">
<div class="badge">1c</div>
<h3>CHeck if your files in Object storage are accessible</h3>
</div>
<p class="note">location uri is object storage base url /n/namespace/b/bucket_name/o/object_name </p>
<pre><code>BSELECT object_name
FROM dbms_cloud.list_objects(
credential_name => 'OBJ_CRED',
location_uri => 'https://objectstorage.us-ashburn-1.oraclecloud.com/n/sehubjapaciaas/b/ADB_BUCKET/o/OIC/'
);
);
END;
/</code></pre>
<p class="note" Auth token is available under profile -- tokens and keys ></p>
<p>In some environments you may reuse the same credential; in others it is cleaner to separate AI and storage access.</p>
</article>
<article class="step">
<div class="stephead">
<div class="badge">2</div>
<h3>Create profile</h3>
</div>
<p class="note">Define the Select AI profile that points your model and RAG configuration.</p>
<pre><code>BEGIN
dbms_cloud_ai.create_profile (
profile_name => 'OIC_CONTRACT',
description => 'contains contract document for Agentic AI Invoice Demo',
attributes =>
'{
"provider": "oci",
"oci_compartment_id": "ocid1.compartment.oc1..aaaaaaaaizypavjespsgxdjq5xjg3bzfrbvrkalqbi662epovyclypz6pvjq",
"credential_name": "OCI_GENERATIVE_AI_CRED",
"region": "us-chicago-1",
"vector_index_name": "OIC_CONTRACT_INDEX"
}'
);
END;</code></pre>
<p class="note">Adjust the JSON attributes to match the Select AI version and your environment.</p>
</article>
<article class="step">
<div class="stephead">
<div class="badge">3</div>
<h3>Create vector index</h3>
</div>
<p class="note">Create the vector index over the table or document chunks you want the RAG pipeline to search.</p>
<pre><code>BEGIN
dbms_cloud_ai.create_vector_index(
index_name => 'OIC_CONTRACT_INDEX',
attributes => '{"vector_db_provider": "oracle",
"object_storage_credential_name":"OBJ_CRED",
"location": "https://objectstorage.us-ashburn-1.oraclecloud.com/n/sehubjapaciaas/b/ADB_BUCKET/o/OIC/",
"profile_name": "OIC_CONTRACT",
"vector_table_name":"OIC_CONTRACT_VECTOR",
"vector_distance_metric": "cosine"
}'
);
END;
/
</code></pre>
<p class="note">If your setup uses embeddings generated from documents in Object Storage, make sure the source table has the chunk text and any metadata columns you need.</p>
</article>
<article class="step">
<div class="stephead">
<div class="badge">4</div>
<h3>Check pipeline status</h3>
</div>
<p class="note">Query the pipeline view to verify indexing and ingestion status before testing prompts.</p>
<pre><code>SELECT pipeline_id, pipeline_name, status, last_execution, status_table
FROM user_cloud_pipelines;</code></pre>
<div class="callout"> do "SELECT * from pipeline$status" and look for rows that show the pipeline is complete or ready before moving to the test query.</div>
</article>
<article class="step">
<div class="stephead">
<div class="badge">5</div>
<h3>Test query with DBMS_CLOUD_AI.GENERATE</h3>
</div>
<p class="note">Run a natural-language question and verify the model can retrieve the contract terms from your RAG setup.</p>
<pre><code>SELECT DBMS_CLOUD_AI.GENERATE(
prompt => 'What are the terms for the contract?',
profile_name => 'OIC_CONTRACT',
action => 'narrate'
)
FROM dual;</code></pre>
<p class="note">If the output is weak, check your profile, vector index, and pipeline status first.</p>
</article>
</div>
</section>
<section class="card" style="margin-top:18px;">
<h2>Reference Links</h2>
<ul>
<li><a href="https://docs.oracle.com/en-us/iaas/autonomous-database-serverless/doc/select-ai.html" target="_blank">Oracle Select AI Documentation</a></li>
<li><a href="https://docs.oracle.com/en-us/iaas/autonomous-database-serverless/doc/dbms-cloud-ai-package.html" target="_blank">DBMS_CLOUD_AI Package Reference</a></li>
<li><a href="https://docs.oracle.com/en/cloud/paas/autonomous-database/serverless/adbsb/dbms-cloud-ai-package.html" target="_blank">CLOUD AI package</a></li>
<li><a href="https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/DBMS_CLOUD.html" target="_blank">DBMS_CLOUD Package</a></li>
<li><a href="https://blogs.oracle.com/autonomous-ai-database/how-to-use-oracle-select-ai-a-stepbystep-guide-generative-ai" target="_blank">NL2SQL tutorial</a></li>
</ul>
</section>
<aside class="card">
<h2>Suggested workshop notes</h2>
<div class="two-col">
<div>
<h3>Before you begin</h3>
<ul>
<li>Confirm database version and Select AI support.</li>
<li>Confirm your Object Storage bucket and file paths.</li>
<li>Confirm the schema that owns the chunk table.</li>
</ul>
</div>
<div>
<h3>Common checks</h3>
<ul>
<li>Credential names match exactly.</li>
<li>Profile points to the right model.</li>
<li>Vector index was built on the correct text column.</li>
</ul>
</div>
</div>
<h3 style="margin-top:18px;">Troubleshooting</h3>
<ul>
<li><strong>ORA-00936</strong>: often means a syntax issue like a trailing comma.</li>
<li><strong>No results</strong>: confirm the pipeline has completed ingestion.</li>
<li><strong>Poor answers</strong>: improve chunking, metadata, or the index source.</li>
</ul>
</div>
</aside>
</div>
</div>
</body>
</html>