You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
i have created a RAG pipeline using langflow, Where im using Huggingfacepipeline for llm, HuggingFaceEmbeddings for Embeddings and retrivalQA as chain and chat input and chat output for the same. So when i enter playground and send a query its builing the flow from start like documentloader, text splitters, embeddings.. and so on any suggestion will be of big help i will be attaching the image of my flow
The text was updated successfully, but these errors were encountered:
To address the issue of your RAG pipeline rebuilding the entire flow with each new query, consider implementing a caching mechanism for the HuggingFaceEmbeddingsComponent. This involves specifying a cache_folder in its configuration, allowing the component to store and reuse embeddings for subsequent queries, thus avoiding the need to recompute them. Here's a concise example on how to set this up:
fromlangchain_community.embeddings.huggingfaceimportHuggingFaceEmbeddingsfromlangflow.interface.custom.custom_componentimportCustomComponenthugging_face_embeddings_component=HuggingFaceEmbeddingsComponent().build(
cache_folder='/path/to/your/cache/folder', # Path to cache folderencode_kwargs={}, # Optional: Additional encoding kwargsmodel_kwargs={}, # Optional: Additional model kwargsmodel_name='sentence-transformers/all-mpnet-base-v2', # Model namemulti_process=True# Optional: Enable multi-processing
)
By leveraging the cache_folder, the component will check for existing embeddings before processing new queries, significantly reducing the computational load and speeding up the response time for your pipeline. This approach optimizes the use of document loaders, text splitters, and embeddings, ensuring efficient reuse across queries.
About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
i have created a RAG pipeline using langflow, Where im using Huggingfacepipeline for llm, HuggingFaceEmbeddings for Embeddings and retrivalQA as chain and chat input and chat output for the same. So when i enter playground and send a query its builing the flow from start like documentloader, text splitters, embeddings.. and so on any suggestion will be of big help i will be attaching the image of my flow
The text was updated successfully, but these errors were encountered: