AI Backend InfrastructureHNSW nearest-neighbour
Vector Semantic Search API
An image-based product search service using CLIP embeddings and PostgreSQL pgvector with HNSW indexing.
Role
Backend engineering, data modelling and async processing
Timeline
2 months
Tech
Python, FastAPI, PostgreSQL
Problem
Image search needs more than keyword matching: it has to understand visual similarity at scale while staying fast under real query load.
Approach
- Generate image embeddings with the OpenAI CLIP model.
- Store vectors in PostgreSQL using the pgvector extension.
- Add an HNSW index to keep similarity queries fast as the catalogue grows.
- Run embedding generation asynchronously so uploads stay responsive.
- Expose product CRUD and search through a typed FastAPI service.
Solution
A FastAPI backend that turns uploaded product images into vectors, indexes them for approximate nearest-neighbour search and returns visually similar products in real time.
Outcomes
- Visual, image-based product search
- Approximate nearest-neighbour matching with HNSW
- Asynchronous background embedding generation
- Typed, documented API with full CRUD