Long-Term Memory
Master how AI agents store and retrieve knowledge across sessions using persistent memory systems
Your Progress
0 / 5 completedVector Databases: Semantic Search at Scale
Traditional databases search for exact matchesβyou ask for "password reset," you get documents with those exact words. But AI agents need semantic search: understanding that "forgot credentials" means the same thing as "password reset."
Enter vector databasesβsystems designed to store and search high-dimensional vectors (embeddings) that capture meaning.
π How Embeddings Work
Traditional Keyword Search
Vector Search (Semantic)
An embedding is a list of numbers (a vector) that represents the meaning of text. Similar meanings produce similar vectors. Models like OpenAI's text-embedding-ada-002 convert text β 1536-dimensional vectors.
Interactive: Similarity Search
[0.8, 0.6, 0.3][0.7, 0.5, 0.4][0.1, 0.2, 0.1]The "Recipe: Chocolate Cake" document has very low similarity to the password reset query because the meaning is completely different, even though it might share some words like "enter" or "click." Vector search understands context.
ποΈ Popular Vector Databases
Pinecone
Fully managed, serverless
- β’ Easy to set up
- β’ Auto-scales
- β’ Pay-as-you-go
pgvector
PostgreSQL extension
- β’ Use existing Postgres
- β’ No new infrastructure
- β’ Good for small/medium scale
Weaviate
Open-source, GraphQL API
- β’ Built-in vectorization
- β’ Hybrid search
- β’ Self-hosted or cloud
Chroma
Lightweight, Python-first
- β’ Easy local development
- β’ LangChain integration
- β’ Great for prototyping
π RAG: Retrieval-Augmented Generation
Vector databases power RAG systemsβthe most common pattern for giving AI agents long-term memory.
π‘ Key Insight
Vector databases enable agents to search by meaning, not just keywords. This is how ChatGPT with plugins, Notion AI, and customer support bots can answer questions about your specific documentsβthey retrieve relevant context, then generate answers.