-
Help with Query Embeddings Serialization (using stored Query embeddings in RAG pipeline)Task description:In my RAG pipeline I want to create embeddings for my query dataset beforehand and use them during the RAG process instead of generating them every time on the go, which causes additional costs and time delays. Issue:I believe that serializing the embeddings should be straightforward, but I don't see it somewhere clear in the documentation. Have I understood something wrong? Most solutions point to creating a custom VectorStoreIndex, but I would be delighted if someone could point out the best way to do it. Code:Some of the already established code that I use is the following (hope it will help you understand the context):
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
To efficiently use stored query embeddings in your RAG pipeline, follow these steps:
For practical implementation, consider looking into the This approach will enhance the performance and scalability of your RAG pipeline by reducing the computational overhead associated with on-the-fly embedding generation.
|
Beta Was this translation helpful? Give feedback.
-
AnswerI found the answer to my question. The queries can be serialized through the QueryBundle class. You just have to add the following Code before retrieving the nodes. The embeddings_query_df is a DataFrame that contains the embeddings for all the queries.
|
Beta Was this translation helpful? Give feedback.
Answer
I found the answer to my question. The queries can be serialized through the QueryBundle class. You just have to add the following Code before retrieving the nodes. The embeddings_query_df is a DataFrame that contains the embeddings for all the queries.