liveBook · Manning

Vectorization

As explained in AI Agents and Applications

An embedding model is a model that maps text or other data to numerical vectors representing semantic or contextual properties.

A question may use different words from the document that answers it. Vectorization makes meaning-based retrieval possible: an embedding model converts text into numerical vectors, or embeddings, so a vector store can compare a question with stored content by similarity rather than exact wording. section 6.1.3

In a retrieval-augmented generation (RAG) application, vectorization happens on both sides of the search:

  • Indexing: load documents, split them into manageable chunks, convert each chunk into an embedding, and store the chunks alongside their vectors. Small chunks help searches find focused passages; embedding models also have finite input sizes. section 6.1.3
  • Answering: embed the user's question, search for similar stored vectors, and put the retrieved text—not just its vector—into the prompt for the language model. section 7.1.2

Search without matching words

A search for “feline animals” can retrieve chunks about cats, lions, and tigers even when those chunks never say “feline.” In a Chroma example, a question about Paestum's Doric temples retrieves the chunk containing the answer, its source metadata, and a query-to-chunk distance. section 6.1.3 section 6.2.5

text_splitter = RecursiveCharacterTextSplitter(
    chunk_size=500, chunk_overlap=0)
embeddings_model = OpenAIEmbeddings(
    openai_api_key=OPENAI_API_KEY)
vector_db = Chroma("tourist_info", embeddings_model)

This LangChain setup pairs a text splitter with OpenAIEmbeddings and a Chroma vector store; documents are then split and added to the store. section 7.2.1

Keep ingestion and retrieval embeddings compatible: their dimensions must match, and changing models requires re-embedding the stored content. Vectorization does not rescue poor chunks; mid-sentence splits or missing context can still produce weak answers. Some vector stores generate embeddings when text is added, so a separate precomputation step is not always needed. section 6.4 section 7.1.1

How AI Agents and Applications covers it

How deep it goes
Walks through chunk and query embedding workflows with Chroma examples, but does not explain embedding-model internals.
Examples
Uses a “feline animals” search and a Chroma query about Paestum's Doric temples to demonstrate semantic matches.
What it assumes
Introduces embeddings and vector stores before implementation; the worked Chroma setup uses a Python notebook.
What you can do after
Apply it via LangChain's OpenAIEmbeddings and Chroma to index document chunks and retrieve relevant text for questions.
How it connects
Connects text splitting, embedding models, vector stores, similarity search, retrievers, prompt construction, and RAG.

Also explained in

Compare how 18 books explain vectorization →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of AI Agents and Applications. The section links point to the parts of the book it draws on.