Embeddings, splitters, vector stores, and retrievers
The retrieval interfaces live in langchain-core, the splitters in langchain-text-splitters, and each store in a partner package, and an agent reaches a retriever through a tool.
You copy a retrieval example from 2024. It imports RetrievalQA from langchain.chains and a vector store from langchain_community.vectorstores. The first import fails at the pin, and the second one comes from a package that is sunset.
When you finish this section, you can say which package holds each piece of a retrieval pipeline at the pin. You can also build the pipeline offline, and give it to an agent as a tool.
Where each piece lives
Retriever: an object with invoke(query) that returns a list of Document objects. Its base class is BaseRetriever in langchain-core.
The 0.x namespace held loaders, splitters, stores, and chains in one package. At the pin they are spread over five places:
| Piece | Package at the pin | What is there |
|---|---|---|
Embeddings, VectorStore, BaseRetriever, Document | langchain-core 1.8.0 | the base classes, InMemoryVectorStore, DeterministicFakeEmbedding, create_retriever_tool, and the indexing API |
init_embeddings | langchain 1.5.0 | a model string such as openai:text-embedding-3-small to an embeddings object |
| text splitters | langchain-text-splitters 1.1.3 | RecursiveCharacterTextSplitter, CharacterTextSplitter, and splitters for Markdown, HTML, code, and JSON |
| a real store or embedding model | a partner package | such as langchain-chroma, langchain-qdrant, langchain-openai, and langchain-ollama |
MultiQueryRetriever, RetrievalQA, CacheBackedEmbeddings | langchain-classic 1.0.8 | the old chains and retrievers, kept for migration |
The base classes are in core. InMemoryVectorStore keeps vectors in a dict and scores them with cosine similarity in NumPy. langchain.embeddings exports only Embeddings and init_embeddings, and its docstring says that the other embeddings modules moved to langchain-classic. The v1 release notes list the old retrievers among the moves.
PyPI lists langchain-community 0.4.2 as its last release, and its repository is archived. Most loaders and stores of the 0.x years came from there. The Chroma and Qdrant packages live in the main repository, under libs/partners, and each has its own version. For any other store, look for a partner package before you install the community one.
The documentation has no retrieval page in the LangChain tab. The Retrieval entry of the navigation opens a Deep Agents page. That page names two styles: a fixed retrieve-then-answer step, and an agent that decides when to search. The semantic search tutorial builds the pipeline of this section step by step.
The pipeline in the capture kit
Figure 7.1 shows the pipeline of the kit. It runs at index time once, and the agent uses it at query time on each tool call.
The splitter
Text splitter: an object that cuts a document into chunks of at most chunk_size characters, with chunk_overlap characters repeated between two chunks.
RecursiveCharacterTextSplitter tries to cut at paragraph breaks first, then at line breaks, then at spaces. The kit cuts three short files with a size of 80 and an overlap of 20:
{
"source": "checkpoints.md",
"chars": 77,
"text": "A checkpointer saves graph state after each step. InMemorySaver keeps it in a"
},
{
"source": "checkpoints.md",
"chars": 75,
"text": "keeps it in a dict. SqliteSaver writes it to a file, so a thread survives a"
},The splitter cuts at a space, so a chunk ends in the middle of a sentence. The first chunk stops at in a, and the next chunk repeats those words. Each chunk keeps the source metadata of its file, because the kit passed it to create_documents.
The embedding model
Embedding model: an object with embed_query and embed_documents that turns text into a vector of numbers.
The kit uses OllamaEmbeddings(model="nomic-embed-text") from langchain-ollama, on the Ollama server of the x86 server guest. The embedding model is a real model, so the files that use it are recorded files, with the model on the line under the title.
{
"dims": 768,
"first 4": [
0.051004,
-0.024986,
-0.178736,
0.040572
],
"repeat equal": true,
"other text equal": false
}Each vector has 768 numbers. The same text gave the same vector twice in the run, and another text gave another vector. run.py --check does not compare these numbers, because a model made them. It checks that the file has its model line and the strings that expect.py lists.
The vector store
add_documents with explicit ids stores the seven chunks as doc-0 to doc-6. similarity_search_with_score returns pairs of a document and a score. A query that is the exact text of a chunk scores 1.0:
query 'A checkpointer saves graph state after each step. InMemorySaver keeps it in a':
[
{
"id": "doc-0",
"source": "checkpoints.md",
"score": 1.0,
…The next hit, doc-2, scored 0.556317. It is the last chunk of the same file. A query with other words, Where does long-term memory live?, returned doc-3, the first chunk of stores.md, with 0.683653, and doc-1 from checkpoints.md with 0.455558. The query What does a checkpointer do? returned doc-0 with 0.68785, and doc-2 with 0.507239.
InMemoryVectorStore takes a Python function as its filter. The kit kept only the chunks of stores.md and got doc-3 and doc-4. A partner store takes its own filter syntax, so a filter does not move from one store to another. delete(["doc-0"]) removed the first chunk, and get_by_ids then returned only doc-1. max_marginal_relevance_search for memory returned doc-3 and doc-2.
A retriever as a tool
Vector store retriever: the retriever that as_retriever() returns. It runs one search on the store with the search_kwargs you gave it.
create_agent has no retrieval parameter. You give the agent a tool, and the tool calls the retriever. The kit wraps the retriever in a plain @tool:
retriever = store.as_retriever(search_kwargs={"k": 1})
@tool
def search_docs(query: str) -> str:
"""Search the local corpus."""
return "\n".join(f"[{d.metadata['source']}] {d.page_content}" for d in retriever.invoke(query))The kit asked Qwen3 4B What does a checkpointer do?. The model called search_docs once with that question, and the tool returned one chunk with its source in brackets:
"type": "ToolMessage",
"content": "[checkpoints.md] A checkpointer saves graph state after each step. InMemorySaver keeps it in a",
"name": "search_docs",
"id": "<uuid-3>",
"tool_call_id": "<uuid-2>",
"status": "success"The retriever returned chunk 0 of 7, the first chunk of checkpoints.md, which answers the question. The model answered from it: A checkpointer saves the graph state after each step. For example, the InMemorySaver keeps the state in memory.. With k=1 the model saw one chunk. The chunk stops at keeps it in a, and the words dict and SqliteSaver are in doc-1, which the model did not get. So the answer is right, and it is only as complete as the one chunk.
Put the source into the text of the result. The model sees only the content of the ToolMessage, so it can cite a file only when the tool writes the name into that text. Core also has create_retriever_tool, which builds the same kind of tool from a retriever, a name, and a description. With response_format="content_and_artifact", it also keeps the documents as the artifact of the message.
Index time and query time do different work. The kit embeds every chunk once, before the agent runs. Each tool call embeds only the query. A store that persists, such as a partner store with a server, keeps the index time work across restarts. InMemoryVectorStore loses it when the process ends.
LangChain (Python): langchain, langchain-core, langgraph, deepagents, langsmith 1.5.0 · c2f4036 · 2026-11-11 · Edition 2026.11