Similarity
2D map
RAG
RAG (Retrieval-Augmented Generation) combines information retrieval with text generation. It works in three steps: index, retrieve and generate. This tool demonstrates steps 1 and 2.
Split the corpus into chunks (separated by a blank line) and compute the embedding of each one: a numeric vector that captures its meaning.
When a query arrives, its embedding is computed and compared against those of the corpus using cosine similarity. The K most similar chunks are returned.
In a full RAG system, an LLM receives the retrieved chunks as context and generates the answer. The embedding model is all-MiniLM-L6-v2 (~22 MB), the same one used in the semantic similarity tool.