Embeddings and Vector Stores in LangChain

Discover different ways of storing documents and using them in your applications with LangChain

Let’s dive right into one of the most critical pieces of building intelligent applications with LangChain: vector stores. By now, you’ve already experimented with language models to generate content or answer questions. But how do we store and retrieve text data in a way that actually captures its meaning? That’s where vector stores shine.

What are embeddings?

First, let’s discuss embeddings, which are closely linked with vector stores. An embedding is a numerical representation of text. Whether it’s a word, a sentence, or an entire document, embeddings convert it into a vector, a list of numbers that captures its semantic meaning.

An easy mental image is to think of a giant three-dimensional space (though, in practice, the space often has hundreds or thousands of dimensions). Words or sentences that are related in meaning appear “close” to each other, while unrelated text drifts farther away. For example, “kitten” would be near “cat,” but both would be quite distant from “car.”

Get hands-on with 1400+ tech skills courses.