Orthos is a semantic 3D product recommendation system that visualizes products in a three-dimensional space based on their semantic similarities. In the upgraded v2.0 architecture, the system uses OpenRouter for generating embeddings and Supabase (PostgreSQL) for persistent storage. Embeddings are converted to 3D coordinates for visualization using a dedicated embedding → 3D engine. Products with similar characteristics appear closer to each other in the 3D space, allowing users to intuitively explore related products.
- Add new products with name and description
- Automatically generate embeddings and 3D coordinates using OpenRouter
- Store product data and coordinates in Supabase (PostgreSQL)
- Interactive 3D visualization of products using Three.js
- 8-quadrant coordinate system for better spatial understanding
- Product selection and recommendation display
- Complete product listing for easy navigation
- Flask Server: RESTful API endpoints for product management and recommendations
- OpenRouter Integration: Generates embeddings from product descriptions via OpenRouter’s
/embeddingsendpoint - Supabase (Postgres): Database for storing product information, embeddings, coordinates, and logs
- KD-Tree Implementation: C program (exposed via FFI/CLI) for efficient proximity search in 3D space
- React Components: Modular UI components for admin and visualization pages
- Three.js: 3D visualization of product relationships
- Flask API Integration: Fetches products and recommendations from the Flask backend (which reads from Supabase)
- Tailwind CSS: Styling and responsive design
-
Product Creation:
- Admin enters product name and description
- Backend sends text to OpenRouter embeddings API
- OpenRouter generates embeddings
- Embeddings are converted to 3D coordinates via the embedding → 3D engine (UMAP + spacing)
- Product data, embeddings, and coordinates are stored in Supabase
-
Visualization:
- Frontend fetches all products from the Flask backend (
/products), which reads from Supabase - Products are rendered as spheres in 3D space
- User can select products to see details
- Backend calculates nearest products using KD-tree algorithm
- Similar products are highlighted in the visualization
- Frontend fetches all products from the Flask backend (
-
Recommendation:
- When a product is selected, backend finds similar products via the KD-tree search engine
- Similarity is calculated based on Euclidean distance in 3D space
- Top 5 most similar products are returned and displayed
-
/generate_embedding(POST)- Receives product name and description
- Generates embeddings using Mistral AI
- Converts embeddings to 3D coordinates
- Stores product in Firebase
- Returns product ID and coordinates
-
/recommend/<id>(GET)- Finds similar products to the given product ID
- Uses KD-tree approach for proximity search
- Returns the target product, recommendations, and all products
-
/products(GET)- Returns all products stored in the database
-
AdminPanel.js- Form for adding new products
- Communicates with backend to generate embeddings
-
ProductVisualization.js- 3D visualization using Three.js
- Interactive product selection
- Displays product details and recommendations
- Shows all available products in a list
-
App.js- Main application component with routing
- Navigation between admin and visualization pages
- Python 3.8+
- Node.js and npm
- Supabase project (URL + service role key)
- OpenRouter API key
-
Navigate to the backend directory:
cd orthos/backend -
Install dependencies:
pip install -r requirements.txt -
Set up environment variables in
.env(you can copy from.env.example):SUPABASE_URL=your_supabase_project_url SUPABASE_SERVICE_KEY=your_supabase_service_role_key OPENROUTER_API_KEY=your_openrouter_api_key FLASK_ENV=development FLASK_HOST=127.0.0.1 FLASK_PORT=5001 -
Apply the Supabase schema (e.g. from
supabase/schema.sql) in your Supabase project. -
Run the Flask server:
python app.pyThe server will automatically find an available port starting from 5000.
-
Navigate to the frontend directory:
cd orthos/frontend -
Install dependencies:
npm install -
Start the development server:
npm start
-
Adding Products:
- Navigate to the Admin Panel
- Enter product name and description
- Click "Submit" to add the product
-
Exploring Products:
- Navigate to the Visualization Page
- Interact with the 3D visualization using mouse controls:
- Left-click to select products
- Right-click and drag to rotate the view
- Scroll to zoom in/out
- View product details and recommendations in the side panel
- Use the product list to quickly find and select specific products
OpenRouter's embeddings API is used to generate embeddings from product descriptions. These embeddings capture the semantic meaning of products and are converted to 3D coordinates by the embedding → 3D engine (UMAP + repulsion + Poisson-disk–style spacing).
A KD-tree data structure is implemented in C for efficient proximity search in 3D space. This allows the system to quickly find products that are close to each other in the semantic space.
The visualization uses an 8-quadrant coordinate system with grid helpers and quadrant labels for better spatial understanding. This helps users navigate the 3D space more intuitively.
This document summarizes all the major enhancements, technology changes, and system improvements made in the upgraded version of Orthos.
- Replaced Firebase Firestore with Supabase PostgreSQL.
- All product data, embeddings, cluster IDs, and coordinates are now stored in structured SQL tables.
- Better querying performance and relational data handling.
- Built-in authentication available for future extensions.
- Switched from Mistral AI’s API to OpenRouter API.
- Supports multiple embedding-capable models (Mistral, Qwen, Llama, Claude, Gemini).
- More flexible and cheaper LLM routing.
- Unified API format simplifies embedding generation and semantic analysis.
- AI now returns:
- Embeddings
- Semantic cluster identity
- Suggested quadrant
- Product attribute vectors
- Recommended axes (X/Y meaning)
- Better capturing of product meaning and relationships.
Replaced the previous “embedding → 3D coordinate” approach with a new deterministic quadrant-based scatter engine.
- Attribute normalization into [-1, 1] space
- Semantically assigned quadrants
- Cluster centroid calculation
- Controlled jitter scatter (prevents clumping)
- Collision avoidance between coordinates
- Spread-out but meaningful product placement
- Compute engine can now be built in:
- C (high performance)
- C++ (balanced)
- Rust (high precision & safety — recommended)
Products now store:
embeddingcluster_idquadrantx,y(final coordinates)semantic_tagsaxes_used- timestamps & metadata
Structured for semantic search + visualization.
- Products no longer appear in tight clusters.
- Natural scattering algorithm makes visuals more readable.
- Clusters remain together but spaced for clarity.
- Rendering now supports D3.js / Three.js easily.
New workflow:
- Admin adds product
- Sent to OpenRouter → AI gives embedding + semantic info
- Compute engine calculates coordinates
- Coordinates stored in Supabase
- Frontend renders layout
A cleaner, faster, more controllable pipeline.
Config file now supports:
- model selection
- axis mapping
- engine type (C/C++/Rust)
- jitter radius
- cluster radius
- global seed
- min-distance for collision avoidance
Easier experimentation and tuning.
- Removed Firebase SDK dependencies.
- Added
.envvariables:OPENROUTER_API_KEYSUPABASE_URLSUPABASE_KEY
- Secure server-to-server calls.
- Rewritten
README.md(v2.0) with full architecture, logic, and workflow. - New
NEW_CHANGES.md(this file) for release notes.
The new Orthos system is:
- More accurate
- Better structured
- AI-driven
- Faster
- Scalable
- Visually cleaner
This upgrade sets the foundation for future expansions such as:
- personalization
- real-time re-clustering
- multi-level semantic grouping
- 3D mapping
Orthos provides an innovative way to explore product relationships through 3D visualization. By leveraging OpenRouter (for semantic understanding), Supabase (for storage, logging, and security), and Three.js (for interactive visualization), the system offers an intuitive and engaging product discovery experience.