A customer-service chatbot may need an answer from a company support article, not just from an LLM’s pre-trained knowledge. An embedding turns a piece of text into a vector—a list of numbers—so the app can search for relevant content by similarity. In retrieval-augmented generation (RAG), that search helps select context to give the LLM alongside the customer’s question. section 10.7 section 10.5.1
Think of recommending a movie
Imagine rating movies on two scales: comedic value and explosions per hour. A movie rated 1.2 and 6 becomes the vector [1.2, 6]. Plotting such vectors makes similarity easier to picture. Text embeddings serve a comparable search purpose, though the example does not explain how a text-embedding model chooses its numbers. section 10.5.1
To put embeddings to work in a support chatbot:
- Split support articles into chunks and add them, with their embeddings, to a vector index. section 10.5.2
- Configure the index for the chosen embedding model and a similarity metric; one setup uses OpenAI’s text-embedding-3-small, 1536 dimensions, and cosine similarity in Pinecone. section 10.5.2
- Search the index with the customer’s question, then place the retrieved excerpts in the context supplied to the LLM. section 10.5.2
splitter = RecursiveCharacterTextSplitter(
chunk_size=1000,
chunk_overlap=200
)
texts = splitter.split_documents(documents)
The splitter divides loaded documents into overlapping chunks before they are added to the vector store. section 10.5.2
An embedding is a search aid, not the answer itself. Retrieval supplies the article excerpts; the LLM then uses those excerpts to generate a response. You can implement this workflow without learning the embedding model’s internals first. section 10.5.1 section 10.5.2














































