Intro In the previous step we made the application a little more useful by introducing a very simple form of retrieval. Instead of sending every document to the LLM, we split the documents into chunks and tried to find the ones that looked relevant to the question. But there is an obvious problem with that approach which is we were essentially just counting words. That works when the question and the document use the same terminology, but it breaks very easily when the same idea is expressed differently. Imagine that one of our documents says:Authentication uses JWT tokens. And the user asks:How do users log into the system? This is where embeddings become useful. There isn’t much overlap between the above two sentences if we look at the actual words. A simple keyword search could easily miss the relevant document even though a human would immediately understand that they are talking about the same thing. This is where embeddings become useful. As usual, here is the code for what we are about to do: https://github.com/genoiucosmin/AIApp1/tree/Step3 Moving from words to meaning An embedding is a numerical representation of text. Instead of treating a sentence simply as a collection of words, an…