Skip to content

Commit 2911da4

Browse files
Merge branch 'main' into dependabot/pip/cloud-infrastructure/compute-including-hpc/ai-infra-gpu/ai-infrastructure/rag-langchain-vllm-mistral/files/torch-2.8.0
2 parents a36647a + f413a51 commit 2911da4

File tree

246 files changed

+9119
-155
lines changed

Some content is hidden

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

246 files changed

+9119
-155
lines changed

ai/gen-ai-agents/assistant-secretary-agent/files/local_requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ langchain==0.3.14
3636
langchain-community==0.3.14
3737
langchain-core==0.3.29
3838
langchain-experimental==0.3.4
39-
langchain-text-splitters==0.3.5
39+
langchain-text-splitters==0.3.9
4040
langgraph==0.2.62
4141
langgraph-checkpoint==2.0.8
4242
langgraph-sdk==0.1.51

ai/gen-ai-agents/mcp-oci-integration/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ annotated-types==0.7.0
66
anyio==4.10.0
77
astroid==3.3.11
88
attrs==25.3.0
9-
Authlib==1.6.3
9+
Authlib==1.6.5
1010
black==25.1.0
1111
blinker==1.9.0
1212
cachetools==6.2.0

cloud-infrastructure/virtualization-solutions/oracle-cloud-vmware-solution/disaster-recovery-to-ocvs-solution-definition/VMware-Live-Site-Recovery-9.x-Configuration-Deployment-Guide/LICENSE renamed to ai/gen-ai-agents/sql-graph-generator-dashboard/LICENSE.txt

File renamed without changes.
Lines changed: 231 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,231 @@
1+
# SQL Graph Generator Dashboard
2+
3+
SQL Graph Generator Dashboard is an AI-powered assistant that enables natural language database queries and intelligent chart generation.
4+
It extracts data from your database using conversational queries, automatically generates appropriate visualizations, and provides multi-turn conversational context for data exploration.
5+
It runs as an interactive Next.js web app backed by a FastAPI server, LangChain orchestration, and Oracle Cloud Infrastructure GenAI models.
6+
7+
Reviewed: October 13, 2025
8+
9+
# When to use this asset?
10+
11+
Use this asset when you want to:
12+
13+
- Query databases using natural language instead of SQL
14+
- Automatically generate charts and visualizations from query results
15+
- Build conversational data exploration interfaces
16+
- Integrate OCI GenAI models with database operations
17+
- Demonstrate intelligent routing between data queries, visualizations, and insights
18+
19+
Ideal for:
20+
21+
- AI engineers building conversational data analytics tools
22+
- Data teams needing natural language database interfaces
23+
- OCI customers integrating GenAI into business intelligence workflows
24+
- Anyone showcasing LangChain + OCI GenAI + dynamic visualization generation
25+
26+
# How to use this asset?
27+
28+
This assistant can be launched via:
29+
30+
- Next.js Web UI
31+
32+
It supports:
33+
34+
- Natural language to SQL conversion
35+
- Automatic chart generation from query results
36+
- Multi-turn conversations with context preservation
37+
- Multiple chart types: bar, line, pie, scatter, heatmap
38+
- Real-time data visualization using matplotlib/seaborn
39+
- Intelligent routing between data queries, visualizations, and insights
40+
41+
## Setup Instructions
42+
43+
### OCI Generative AI Model Configuration
44+
45+
1. Go to: OCI Console → Generative AI
46+
2. Select your model (this demo uses OpenAI GPT OSS 120B):
47+
`ocid1.generativeaimodel.oc1.eu-frankfurt-1.amaaaaaask7dceyav...`
48+
3. Set up an OCI Agent Runtime endpoint for SQL queries
49+
4. Copy the following values:
50+
- MODEL_ID
51+
- AGENT_ENDPOINT_ID
52+
- COMPARTMENT_ID
53+
- SERVICE_ENDPOINT (e.g., `https://inference.generativeai.eu-frankfurt-1.oci.oraclecloud.com`)
54+
5. Configure them in `backend/utils/config.py`
55+
56+
Documentation:
57+
[OCI Generative AI Documentation](https://docs.oracle.com/en-us/iaas/Content/generative-ai/home.htm)
58+
59+
No API key is required — authentication is handled via OCI identity.
60+
61+
Ensure your OCI CLI credentials are configured.
62+
Edit or create the following config file at `~/.oci/config`:
63+
64+
```
65+
[DEFAULT]
66+
user=ocid1.user.oc1..exampleuniqueID
67+
fingerprint=c6:4f:66:e7:xx:xx:xx:xx
68+
tenancy=ocid1.tenancy.oc1..exampleuniqueID
69+
region=eu-frankfurt-1
70+
key_file=~/.oci/oci_api_key.pem
71+
```
72+
73+
### Install Dependencies
74+
75+
Backend:
76+
77+
```bash
78+
cd backend
79+
pip install -r requirements.txt
80+
```
81+
82+
Frontend:
83+
84+
```bash
85+
cd ..
86+
npm install
87+
```
88+
89+
### Configure Database
90+
91+
1. Set up your database connection in OCI Agent Runtime
92+
2. The demo uses a sample e-commerce database with tables:
93+
- orders
94+
- customers
95+
- products
96+
- order_items
97+
98+
### Start the Application
99+
100+
Backend (FastAPI):
101+
102+
```bash
103+
cd backend
104+
python -m uvicorn api.main:app --reload --host 0.0.0.0 --port 8000
105+
```
106+
107+
Frontend (Next.js):
108+
109+
```bash
110+
npm run dev
111+
```
112+
113+
Access the application at: http://localhost:3000
114+
115+
## Key Features
116+
117+
| Feature | Description |
118+
| ------------------------ | ---------------------------------------------------------------- |
119+
| Natural Language Queries | Ask questions like "show me the top 5 orders" |
120+
| Intelligent Routing | GenAI-powered routing between data queries, charts, and insights |
121+
| Auto Chart Generation | Automatically creates appropriate visualizations from data |
122+
| Multi-Turn Conversations | Maintains context across multiple queries |
123+
| Real-Time Visualization | Generates matplotlib/seaborn charts as base64 images |
124+
| Multiple Chart Types | Supports bar, line, pie, scatter, and heatmap charts |
125+
| OCI GenAI Integration | Uses OCI Agent Runtime and Chat API |
126+
| LangChain Runnables | Clean integration pattern wrapping OCI SDK calls |
127+
| Conversation Management | Tracks query history and data state |
128+
| Error Handling | Clear error messages and fallback behavior |
129+
130+
## Architecture
131+
132+
### Backend Components
133+
134+
1. **Router Agent** (OCI Chat API)
135+
136+
- Intelligent query routing using GenAI
137+
- Routes: DATA_QUERY, CHART_EDIT, INSIGHT_QA
138+
- Returns structured JSON decisions
139+
140+
2. **SQL Agent** (OCI Agent Runtime)
141+
142+
- Natural language to SQL conversion
143+
- Database query execution
144+
- Structured data extraction
145+
146+
3. **Chart Generator** (OCI Chat API + Python Execution)
147+
148+
- GenAI generates matplotlib/seaborn code
149+
- Safe code execution in sandboxed environment
150+
- Returns base64-encoded chart images
151+
152+
4. **Orchestrator**
153+
- Coordinates agents based on routing decisions
154+
- Manages conversation state
155+
- Handles multi-turn context
156+
157+
### Frontend Components
158+
159+
1. **Chat Interface**
160+
161+
- Real-time message display
162+
- Support for text, tables, and images
163+
- Speech recognition integration
164+
165+
2. **Service Layer**
166+
167+
- API communication with backend
168+
- Response transformation
169+
- Error handling
170+
171+
3. **Context Management**
172+
- User session handling
173+
- Message history
174+
- State management
175+
176+
## Example Queries
177+
178+
```
179+
"Show me the top 5 orders"
180+
→ Returns table with order data
181+
182+
"Make a bar chart of those orders by total amount"
183+
→ Generates bar chart visualization
184+
185+
"Show me orders grouped by region"
186+
→ Returns data aggregated by region
187+
188+
"Create a pie chart of the order distribution"
189+
→ Generates pie chart from current data
190+
191+
"What insights can you provide about these sales?"
192+
→ Provides AI-generated analysis
193+
```
194+
195+
## Configuration Files
196+
197+
Key configuration in `backend/utils/config.py`:
198+
199+
- MODEL_ID: Your OCI GenAI model OCID
200+
- AGENT_ENDPOINT_ID: Your OCI Agent Runtime endpoint
201+
- COMPARTMENT_ID: Your OCI compartment
202+
- SERVICE_ENDPOINT: GenAI service endpoint URL
203+
- DATABASE_SCHEMA: Database table definitions
204+
205+
## Notes
206+
207+
- Prompts can be customized in `backend/orchestration/oci_direct_runnables.py`
208+
- Chart generation code is dynamically created by GenAI
209+
- Designed specifically for Oracle Cloud Infrastructure + Generative AI
210+
- Sample database schema included for e-commerce use case
211+
- Frontend uses Material-UI for consistent design
212+
213+
# Useful Links
214+
215+
- [OCI Generative AI](https://docs.oracle.com/en-us/iaas/Content/generative-ai/home.htm)
216+
Official documentation for Oracle Generative AI
217+
218+
- [OCI Agent Runtime](https://docs.oracle.com/en-us/iaas/Content/generative-ai/agent-runtime.htm)
219+
Documentation for OCI Agent Runtime
220+
221+
- [LangChain Documentation](https://python.langchain.com/docs/get_started/introduction)
222+
LangChain framework documentation
223+
224+
- [Next.js Documentation](https://nextjs.org/docs)
225+
Next.js framework documentation
226+
227+
# License
228+
229+
Copyright (c) 2025 Oracle and/or its affiliates.
230+
231+
Licensed under the Universal Permissive License (UPL), Version 1.0.
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
# Database Setup
2+
3+
## Overview
4+
5+
This application uses OCI Agent Runtime to query your database. The sample schema is for an e-commerce database.
6+
7+
## Database Schema
8+
9+
### CUSTOMERS Table
10+
```sql
11+
CREATE TABLE CUSTOMERS (
12+
CUSTOMER_ID NUMBER PRIMARY KEY,
13+
CUSTOMER_NAME VARCHAR2(100),
14+
EMAIL VARCHAR2(100),
15+
SIGNUP_DATE DATE,
16+
SEGMENT VARCHAR2(50),
17+
COUNTRY VARCHAR2(50),
18+
LIFETIME_VALUE NUMBER(10,2),
19+
CREATION_DATE DATE,
20+
CREATED_BY VARCHAR2(50),
21+
LAST_UPDATED_DATE DATE,
22+
LAST_UPDATED_BY VARCHAR2(50)
23+
);
24+
```
25+
26+
### PRODUCTS Table
27+
```sql
28+
CREATE TABLE PRODUCTS (
29+
PRODUCT_ID NUMBER PRIMARY KEY,
30+
PRODUCT_NAME VARCHAR2(200),
31+
CATEGORY VARCHAR2(100),
32+
PRICE NUMBER(10,2),
33+
COST NUMBER(10,2),
34+
STOCK_QUANTITY NUMBER,
35+
LAUNCH_DATE DATE,
36+
CREATION_DATE DATE,
37+
CREATED_BY VARCHAR2(50),
38+
LAST_UPDATED_DATE DATE,
39+
LAST_UPDATED_BY VARCHAR2(50)
40+
);
41+
```
42+
43+
### ORDERS Table
44+
```sql
45+
CREATE TABLE ORDERS (
46+
ORDER_ID NUMBER PRIMARY KEY,
47+
CUSTOMER_ID NUMBER,
48+
ORDER_DATE DATE,
49+
TOTAL_AMOUNT NUMBER(10,2),
50+
STATUS VARCHAR2(50),
51+
REGION VARCHAR2(100),
52+
SALES_REP VARCHAR2(100),
53+
CREATION_DATE DATE,
54+
CREATED_BY VARCHAR2(50),
55+
LAST_UPDATED_DATE DATE,
56+
LAST_UPDATED_BY VARCHAR2(50),
57+
FOREIGN KEY (CUSTOMER_ID) REFERENCES CUSTOMERS(CUSTOMER_ID)
58+
);
59+
```
60+
61+
### ORDER_ITEMS Table
62+
```sql
63+
CREATE TABLE ORDER_ITEMS (
64+
ORDER_ITEM_ID NUMBER PRIMARY KEY,
65+
ORDER_ID NUMBER,
66+
PRODUCT_ID NUMBER,
67+
QUANTITY NUMBER,
68+
UNIT_PRICE NUMBER(10,2),
69+
DISCOUNT_PERCENT NUMBER(5,2),
70+
CREATION_DATE DATE,
71+
CREATED_BY VARCHAR2(50),
72+
LAST_UPDATED_DATE DATE,
73+
LAST_UPDATED_BY VARCHAR2(50),
74+
FOREIGN KEY (ORDER_ID) REFERENCES ORDERS(ORDER_ID),
75+
FOREIGN KEY (PRODUCT_ID) REFERENCES PRODUCTS(PRODUCT_ID)
76+
);
77+
```
78+
79+
## Sample Data
80+
81+
### Sample Customers
82+
```sql
83+
INSERT INTO CUSTOMERS VALUES (1, 'Acme Corp', 'contact@acme.com', DATE '2023-01-15', 'Enterprise', 'USA', 150000, SYSDATE, 'SYSTEM', SYSDATE, 'SYSTEM');
84+
INSERT INTO CUSTOMERS VALUES (2, 'TechStart Inc', 'info@techstart.com', DATE '2023-03-20', 'SMB', 'UK', 45000, SYSDATE, 'SYSTEM', SYSDATE, 'SYSTEM');
85+
INSERT INTO CUSTOMERS VALUES (3, 'Global Solutions', 'sales@global.com', DATE '2023-02-10', 'Enterprise', 'Germany', 200000, SYSDATE, 'SYSTEM', SYSDATE, 'SYSTEM');
86+
```
87+
88+
### Sample Products
89+
```sql
90+
INSERT INTO PRODUCTS VALUES (1, 'Enterprise Security Suite', 'Software', 3499.99, 1200, 100, DATE '2023-01-01', SYSDATE, 'SYSTEM', SYSDATE, 'SYSTEM');
91+
INSERT INTO PRODUCTS VALUES (2, 'AI Analytics Platform', 'Software', 2999.99, 1000, 150, DATE '2023-02-01', SYSDATE, 'SYSTEM', SYSDATE, 'SYSTEM');
92+
INSERT INTO PRODUCTS VALUES (3, 'Cloud Storage Pro', 'Cloud', 999.99, 300, 500, DATE '2023-03-01', SYSDATE, 'SYSTEM', SYSDATE, 'SYSTEM');
93+
INSERT INTO PRODUCTS VALUES (4, 'Premium Consulting', 'Services', 5000, 2000, 50, DATE '2023-01-15', SYSDATE, 'SYSTEM', SYSDATE, 'SYSTEM');
94+
INSERT INTO PRODUCTS VALUES (5, 'Training Program', 'Services', 2500, 800, 100, DATE '2023-02-20', SYSDATE, 'SYSTEM', SYSDATE, 'SYSTEM');
95+
```
96+
97+
### Sample Orders
98+
```sql
99+
INSERT INTO ORDERS VALUES (1, 1, DATE '2024-01-15', 8999.98, 'Completed', 'North America', 'John Smith', SYSDATE, 'SYSTEM', SYSDATE, 'SYSTEM');
100+
INSERT INTO ORDERS VALUES (2, 2, DATE '2024-01-20', 2999.99, 'Completed', 'Europe', 'Sarah Johnson', SYSDATE, 'SYSTEM', SYSDATE, 'SYSTEM');
101+
INSERT INTO ORDERS VALUES (3, 3, DATE '2024-02-01', 12499.97, 'Completed', 'Europe', 'Mike Davis', SYSDATE, 'SYSTEM', SYSDATE, 'SYSTEM');
102+
INSERT INTO ORDERS VALUES (4, 1, DATE '2024-02-15', 7500, 'Processing', 'North America', 'John Smith', SYSDATE, 'SYSTEM', SYSDATE, 'SYSTEM');
103+
INSERT INTO ORDERS VALUES (5, 2, DATE '2024-03-01', 999.99, 'Completed', 'Europe', 'Sarah Johnson', SYSDATE, 'SYSTEM', SYSDATE, 'SYSTEM');
104+
```
105+
106+
### Sample Order Items
107+
```sql
108+
INSERT INTO ORDER_ITEMS VALUES (1, 1, 1, 2, 3499.99, 0, SYSDATE, 'SYSTEM', SYSDATE, 'SYSTEM');
109+
INSERT INTO ORDER_ITEMS VALUES (2, 1, 3, 2, 999.99, 10, SYSDATE, 'SYSTEM', SYSDATE, 'SYSTEM');
110+
INSERT INTO ORDER_ITEMS VALUES (3, 2, 2, 1, 2999.99, 0, SYSDATE, 'SYSTEM', SYSDATE, 'SYSTEM');
111+
INSERT INTO ORDER_ITEMS VALUES (4, 3, 1, 1, 3499.99, 0, SYSDATE, 'SYSTEM', SYSDATE, 'SYSTEM');
112+
INSERT INTO ORDER_ITEMS VALUES (5, 3, 2, 2, 2999.99, 10, SYSDATE, 'SYSTEM', SYSDATE, 'SYSTEM');
113+
INSERT INTO ORDER_ITEMS VALUES (6, 3, 5, 1, 2500, 0, SYSDATE, 'SYSTEM', SYSDATE, 'SYSTEM');
114+
INSERT INTO ORDER_ITEMS VALUES (7, 4, 4, 1, 5000, 0, SYSDATE, 'SYSTEM', SYSDATE, 'SYSTEM');
115+
INSERT INTO ORDER_ITEMS VALUES (8, 4, 5, 1, 2500, 0, SYSDATE, 'SYSTEM', SYSDATE, 'SYSTEM');
116+
INSERT INTO ORDER_ITEMS VALUES (9, 5, 3, 1, 999.99, 0, SYSDATE, 'SYSTEM', SYSDATE, 'SYSTEM');
117+
```
118+
119+
## OCI Agent Runtime Configuration
120+
121+
1. Create database connection in OCI Agent Runtime
122+
2. Configure database tool/function with:
123+
- Connection string
124+
- User credentials
125+
- Query permissions
126+
3. Test connection with simple query
127+
4. Update AGENT_ENDPOINT_ID in config.py
128+
129+
130+

0 commit comments

Comments
 (0)