-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME
More file actions
88 lines (63 loc) · 3.33 KB
/
Copy pathREADME
File metadata and controls
88 lines (63 loc) · 3.33 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
# 💡 AI-Powered Oracle 23ai Query Assistant (POC)
This project is a proof-of-concept (POC) system that allows users to ask natural language questions and receive answers powered by Oracle Autonomous Database (ADBS) using both SQL and vector search. It integrates a locally running LLM via Ollama and a backend FastAPI-based MCP server that handles execution logic and communication with the database.
The system uses a modular design, enabling intelligent routing of queries, SQL generation, and response interpretation — all handled locally.
---

## 🧱 System Components
### 👤 User
- Inputs natural language questions.
- Receives final human-readable answers.
### 🧠 LLM on Ollama (LLaMA 3.2)
- Interprets user queries and generates appropriate SQL (traditional or semantic).
- Also interprets SQL responses if needed for better human readability.
- Runs locally via [Ollama](https://ollama.com).
### 🤖 SQL Assistant
- Central orchestrator of the entire workflow.
- Routes queries to the LLM, forwards generated SQL to the MCP server, and interprets final results.
- Also performs intermediate logic for formatting or refining output before presenting to the user.
### 🌐 MCP Server (FastAPI)
- Receives SQL statements from the SQL Assistant.
- Executes SQL on Oracle ADBS and returns results.
- Acts as the executor, not the decision-maker.
### 🗄️ Oracle Autonomous Database (ADBS)
- Hosts structured and unstructured data.
- Performs both standard SQL and vector-based semantic queries.
- Embedding generation and storage is handled natively using Oracle's `ALL_MINILM_L12_V2` model.
---
## 🔁 Data Flow Overview
1. **User submits a natural language query** to the SQL Assistant.
2. **SQL Assistant forwards the query** to the local LLM on Ollama.
3. **LLM generates a SQL query** (traditional or vector-based).
4. **SQL Assistant sends the SQL** to the MCP server for execution.
5. **MCP server executes the SQL** on Oracle ADBS and retrieves results.
6. **Results are returned to the SQL Assistant** by the MCP server.
7. **SQL Assistant may optionally send results to LLM** for interpretation.
8. **LLM interprets and explains results** (optional).
9. **Final human-readable output is shown to the user**.
This flow ensures both local processing and flexibility in adapting queries intelligently.
---
## 🔧 Technologies Used
- **Oracle Autonomous Database (23ai)**
- **Oracle Vector Search**
- **LLaMA 3.2 (via Ollama)**
- **FastAPI (MCP Server)**
- **Python + oracledb driver**
---
## 🚀 Highlights
- 🧠 Fully local LLM with intelligent SQL generation.
- 🗃 No external vector DB needed — all vector embedding and querying is native to Oracle ADBS.
- ⚡ Smart switching between structured SQL and semantic vector search.
- 🧩 Modular architecture for easy expansion (e.g., adding UI, confidence scoring, etc.).
- 🔄 Optional interpretation of SQL results via LLM for more natural answers.
---
## 📌 Status
✅ Embeddings inserted
✅ Local LLM integrated via Ollama
✅ MCP server connected to Oracle ADBS
✅ Semantic and SQL querying tested
✅ Diagram-based architecture established
### 🧪 Next Steps
- UI development for better usability.
- Add confidence scoring and query classification.
- Explore multi-modal inputs (e.g., PDFs, images).
- Implement user feedback loop for query refinement.