From JSON to Vector Search: What I Learned Storing Structured User Data for AI
Description and use
The article explains how SpendWise integrated structured user data into a vector database for semantic search while keeping SQL for exact queries.
Problem
How to make structured user data retrievable and useful for an AI system during user interactions.
Outcome
By separating structured storage from semantic search, SpendWise can retrieve relevant user context efficiently, improving AI answer relevance while keeping deterministic queries in SQL.
Workflow
- Collect structured user data during onboarding
- Store raw JSON in PostgreSQL as source of truth
- Convert relevant fields into natural‑language summaries
- Generate embeddings with an embedding model
- Index embeddings in a vector database with metadata
- When a user asks a question, determine if it requires semantic similarity or exact match
- If semantic, query vector database for relevant context
- If exact or range, query PostgreSQL via SQL
- Feed retrieved context to the LLM for response
Evidence
"The AI might need context such as: ..."
"A vector database doesn’t magically understand JSON."
"If I need an exact value: What is my monthly income? A structured database is perfect."
- Record date: 2026-10-06T19:55:51.778Z