The Need for Vectors
Large Language Models (LLMs) have a limited context window—they can only process a certain amount of information at one time. To build applications that access massive volumes of proprietary data (like internal documentation or customer histories), developers use Vector Databases.
By converting text, images, and audio into high-dimensional numerical coordinates (embeddings), databases can perform mathematical similarity searches in milliseconds.
How Semantic Search Works
Traditional databases search for exact word matches. If you search for “automobile,” a SQL database might miss records containing only “car.” A vector database understands that “automobile” and “car” are semantically close, returning relevant matches even if the exact words are different.
# Conceptual flow of a vector query
query_text = "How do I reset my password?"
query_vector = embedding_model.embed(query_text)
# Search vector database for closest matches
results = vector_db.query(
vector=query_vector,
top_k=3,
metric="cosine_similarity"
)