Giovanni Bricconi

My site on WordPress.com

Archive for March 2024

FAISS, Chroma and Pinecone in action

leave a comment »

Developing RAG (retrieval augmented generation) applications requires you to process your documents and store them along with embedding vectors in a sort of database. You need to store the document, because you want to retrieve the exact text that will help the LLM crafting an answer. Nowadays you may not want to do textual search on your documents: leveraging some LLM model you can map a text to a vector of real numbers, that represents the document position in a sort of euclidean brain space. In this space “the bank of the river” and “the bank downtown opens at 09:00” will be mapped to different places, and will be clear that the 2 phrases speaks about different things even though the word “bank” appears in both. One of such embedding model is text-embedding-ada-002.

When the user asks a question, the question is mapped to a real number vector and you have to search the documents more similar to that vector. This requires some sort of specialized database. Looking at LangChain documentation I found that there are at least 3 different databases to explore: FAISS, Chroma and Pinecone.

I searched for a comparison between them: I did not find it but I come across this interesting video Vector Databases with FAISS, Chromadb, and Pinecone: A comprehensive guide. It will not teach you about the differences between the databases, but it will show you how to use theirs API, and tell you about the difficulties you may have installing them. Happy watching!

Written by Giovanni

March 10, 2024 at 6:05 pm

Posted in Varie

Tagged with , , , ,