Skip to content

Commit 534fc0c

Browse files
authored
Merge branch 'main' into fetch-metadata-from-id-2
2 parents 5c510fe + 854c8d1 commit 534fc0c

File tree

93 files changed

+1790
-645
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+1790
-645
lines changed

ai/gen-ai-agents/mcp-oci-integration/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ This repository contains code and examples to help in the following tasks:
66
* **Integrate** MCP servers with other **OCI resources** (ADB, Select AI, ...)
77
* **Integrate** MCP Servers running on OCI with AI Assistants like **ChatGPT**, Claude.ai, MS Copilot
88
* **Integrate** MCP Servers with OCI **APM** for **Observability**
9+
* **how-to** create a **docker** image for your MCP server
910

1011
![MCP console](./images/mcp_cli.png)
1112

@@ -64,7 +65,7 @@ Using **OCI services** there are several things you can do to get the right leve
6465
* You can use **OCI IAM** to generate **JWT** tokens
6566
* You can use OCI network security
6667

67-
More details in a dedicate page.
68+
More details in a dedicated page.
6869

6970
## Integrate MCP Semantic Search with ChatGPT
7071
If you deploy the [MCP Semantic Search](./mcp_semantic_search_with_iam.py) server you can test the integration with **ChatGPT** in **Developer Mode**. It provides a **search** tool, compliant with **OpenAI** specs.
@@ -81,4 +82,6 @@ In this way you have an option to do full **Text2SQL** search, over your databas
8182

8283
An example is [here](./mcp_selectai.py)
8384

85+
For **Select AI** configuration, see [here](./configure_select_ai.md)
86+
8487

ai/gen-ai-agents/mcp-oci-integration/config.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
AUTH = "API_KEY"
3131

3232
# embeddings
33-
# added this to distinguish between Cohere end REST NVIDIA models
33+
# added this to distinguish between Cohere and REST NVIDIA models
3434
# can be OCI or NVIDIA
3535
EMBED_MODEL_TYPE = "OCI"
3636
# EMBED_MODEL_TYPE = "NVIDIA"
@@ -95,7 +95,7 @@
9595
PORT = 9000
9696

9797
# with this we can toggle JWT token auth
98-
ENABLE_JWT_TOKEN = False
98+
ENABLE_JWT_TOKEN = True
9999
# for JWT token with OCI
100100
# put your domain URL here
101101
IAM_BASE_URL = "https://idcs-930d7b2ea2cb46049963ecba3049f509.identity.oraclecloud.com"
@@ -104,4 +104,9 @@
104104
AUDIENCE = ["urn:opc:lbaas:logicalguid=idcs-930d7b2ea2cb46049963ecba3049f509"]
105105

106106
# for Select AI
107+
# SELECT_AI_PROFILE = "OCI_GENERATIVE_AI_PROFILE_F1"
108+
# this one with SH schema
107109
SELECT_AI_PROFILE = "OCI_GENERATIVE_AI_PROFILE"
110+
111+
# UI
112+
UI_TITLE = "🛠️ AI Assistant powered by MCP"
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Select AI Configuration
2+
3+
## Introduction
4+
**Select AI** is a functionality provided by **Oracle Autonomous Database (ADB)**.
5+
6+
It enables to do easily **Text2SQL**, in other words to translate a request for data, expressed in Natural Language (NL),
7+
in a SQL statement working in your Database.
8+
9+
Example:
10+
11+
* (NL): List the names of all F1 drivers.
12+
* (SQL): SELECT DRIVER_NAME from F1USER.F1_DRIVERS
13+
14+
## Configuration
15+
To use **Select AI** you need an ADB, with the schema where you want to run your SQL statements, and a Large Language Model (LLM).
16+
You can use a model provided by **OCI Generative AI** service, or a model from another supported provider (see Oracle docs for the list).
17+
18+
In this short note, we will provide information to configure Select AI using OCI Generative AI.
19+
20+
### Store credentials and create a Select AI **Profile**
21+
Create in your OCI account (enabled to use Generative AI) an API key. Save the keys.
22+
23+
Create and store a **credential**, with a name, inside your DB schema (the schema you're using to execute Select AI, not the data schema).
24+
25+
Execute the following procedure, with your data
26+
27+
```
28+
BEGIN
29+
DBMS_CLOUD.create_credential(
30+
credential_name => 'MY_CREDENTIAL_NAME',
31+
user_ocid => 'ocid1.user.oc1..my_user_oci',
32+
tenancy_ocid => 'ocid1.tenancy.oc1..my_tenancy_ocid',
33+
fingerprint => 'fingerprint of my key',
34+
private_key => 'cut&paste your private key here'
35+
);
36+
END;
37+
/
38+
```
39+
40+
Create a **Select AI profile**. Execute the following procedure, again with your data.
41+
(put the list of the object in the schema you need to make visible to Select AI)
42+
43+
```
44+
BEGIN
45+
DBMS_CLOUD_AI.CREATE_PROFILE(
46+
profile_name => 'OCI_GENERATIVE_AI_PROFILE' ,
47+
attributes =>
48+
'{
49+
"provider": "oci",
50+
"region": "us-chicago-1",
51+
"oci_compartment_id": "ocid1.compartment.oc1..my compartment ocid",
52+
"credential_name": "MY_CREDENTIAL_NAME",
53+
"object_list": [
54+
{"owner": "SH", "name": "CHANNELS"},
55+
{"owner": "SH", "name": "COSTS"},
56+
{"owner": "SH", "name": "COUNTRIES"},
57+
{"owner": "SH", "name": "CUSTOMERS"},
58+
{"owner": "SH", "name": "PRODUCTS"},
59+
{"owner": "SH", "name": "PROMOTIONS"},
60+
{"owner": "SH", "name": "SALES"},
61+
{"owner": "SH", "name": "SUPPLEMENTARY_DEMOGRAPHICS"},
62+
{"owner": "SH", "name": "TIMES"}
63+
],
64+
"model": "xai.grok-4"
65+
}');
66+
67+
END;
68+
```
69+
70+
## Test Select AI
71+
You can test that the configuration is correctly working using code like the one in [test select AI](./test_selectai01.py)
72+
73+
The code is using the new library from Oracle: **select-ai**
74+
To use it, you need also to have installed in your Python environment the library: **oracledb**
75+
76+
```
77+
pip install select_ai
78+
pip install oracledb
79+
```
80+
81+
## References
82+
For more information, see
83+
* [Getting Started with Select AI](https://docs.oracle.com/en-us/iaas/autonomous-database-serverless/doc/select-ai-get-started.html)
84+
* [How to use Select AI: A step-by-step guide](https://blogs.oracle.com/datawarehousing/post/how-to-use-oracle-select-ai-a-stepbystep-guide-generative-ai)

0 commit comments

Comments
 (0)