oracle-ai-developer-hub

πŸ›οΈ Semantic Product Search and Visual Discovery with Oracle AI Database (Vector Search)

A multimodal product search demo app that shows how to build semantic search and image-based similarity search on top of Oracle AI Database (Vector Search).

This project demonstrates an end-to-end vector search pipeline using CLIP embeddings, Oracle AI Database for similarity search, a FastAPI backend, and a web UI for text and image queries:

Built as developer enablement content and a demo for Oracle AI Database Vector Search, with support for both cloud and local development environments.


✨ What you can do with this app


🧠 High-Level Architecture

High-Level Architecture Flow (end-to-end): 1) The user submits a text query or image in the UI.
2) The backend generates a CLIP embedding (512-dim) for the query.
3) Oracle AI Database runs a Top-K vector similarity search (optionally combined with category/price filters).
4) The backend returns ranked products (title, image, price, category) to the UI. β€”

🧠 How Oracle Vector Search powers this app (end-to-end flow)

Oracle Vector Search flow (hand-drawn)

What happens under the hood: 1) The backend generates CLIP embeddings (512-dim) for both product data (ingestion) and user queries (runtime).
2) At query time, Oracle runs a Top-K similarity search (optionally combined with category/price filters) and returns ranked results. 3) Product vectors are stored in an Oracle VecDB table (default: PRODUCT_TEXT_VECTORS) together with product metadata used by the application. 4) The backend returns UI-ready product objects (title, image URL, price, category) to the frontend.

Result: β€œfind products like this” works for both semantic text and visual similarity, not just keyword matching.


πŸ–ΌοΈ UI Demo (Screenshots)

Text semantic search
Text search UI
Image similarity search
Image search UI
Category & price filters
Filters UI
Product details
Product details UI

πŸš€ Quickstart (Oracle AI Database)

1️⃣ Backend

cd backend
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

cp .env.example .env
# update VECDB_REST_URL and either VECDB_USERNAME/VECDB_PASSWORD or VECDB_ACCESS_TOKEN
# set VECDB_SELF_SIGNED_SSL=true only for a trusted self-signed development endpoint

python load_dataset.py
uvicorn main:app --host 0.0.0.0 --port 8000

2️⃣ Frontend

cd frontend
npm install
VITE_BACKEND_URL=http://<your_vm_ip_addrs>:8000 npm run dev -- --host 0.0.0.0 --port 5176

☁️ Cloud-first Deployment

This sample is designed to work well with Oracle AI Database environments and can be adapted for common deployment patterns such as:

You can deploy:

This enables:


πŸ“‚ Project Structure

product_recommendation/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ .env.example
β”‚   β”œβ”€β”€ config.py
β”‚   β”œβ”€β”€ load_dataset.py
β”‚   β”œβ”€β”€ main.py
β”‚   └── requirements.txt
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ package.json
β”‚   └── vite.config.ts
β”œβ”€β”€ images/
β”‚   β”œβ”€β”€ architecture-high-level.png
β”‚   β”œβ”€β”€ architecture-handdrawn.png
β”‚   β”œβ”€β”€ ui-text-search.png
β”‚   β”œβ”€β”€ ui-image-search.png
β”‚   β”œβ”€β”€ ui-filters.png
β”‚   └── ui-product-details.png
└── README.md

βš™οΈ Configuration

Backend configuration is loaded from environment variables.

  1. Copy backend/.env.example to backend/.env
  2. Set:
    • VECDB_REST_URL
    • VECDB_USERNAME
    • VECDB_PASSWORD
    • optionally, VECDB_ACCESS_TOKEN (takes precedence over username/password)

Optional overrides include:


πŸ€– Embedding Model

πŸ” Example Usage:

from sentence_transformers import SentenceTransformer

model = SentenceTransformer("clip-ViT-B-32")

Used for text and image embeddings.


πŸ” Indexing Pipeline

πŸ“š Dataset

πŸ› οΈ Workflow

  1. Load dataset
  2. Generate embeddings from title/description/image
  3. Store in Oracle VecDB with metadata

πŸ§ͺ Search Modes Supported


πŸ“‚ Upload Your Own Dataset (Optional)

If you want to use your own data:

βœ… Supported Fields

πŸ“₯ Steps:

  1. Save your dataset as .csv or .json
  2. Update load_dataset.py to read your file
  3. Modify embedding logic as needed
  4. Run load_dataset.py to index into Oracle VecDB

πŸ““ Demo Notebook (Oracle AI Developer GitHub / Colab)

Related notebooks are available under notebooks/vecdb/ for end-to-end Oracle VecDB workflows.


🧩 Technologies Used

This sample is intended as developer enablement content for Oracle AI Database Vector Search use cases and multimodal search demos.


πŸ“„ API Details

Main backend endpoints include: