Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passing a new query in retrieval QA chain its building the entire flow. #1881

Open
baksh07 opened this issue May 13, 2024 · 1 comment
Open
Labels
bug Something isn't working

Comments

@baksh07
Copy link

baksh07 commented May 13, 2024

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
Screenshot 2024-05-13 094923

Copy link

dosubot bot commented May 13, 2024

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:

from langchain_community.embeddings.huggingface import HuggingFaceEmbeddings
from langflow.interface.custom.custom_component import CustomComponent

hugging_face_embeddings_component = HuggingFaceEmbeddingsComponent().build(
    cache_folder='/path/to/your/cache/folder',  # Path to cache folder
    encode_kwargs={},  # Optional: Additional encoding kwargs
    model_kwargs={},  # Optional: Additional model kwargs
    model_name='sentence-transformers/all-mpnet-base-v2',  # Model name
    multi_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.

Details

Sources


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.

To continue the conversation, mention @dosu.

@dosubot dosubot bot added the bug Something isn't working label May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant