Flow building each time when use langflow as a python code #1923
Replies: 4 comments 2 replies
-
To address the issue of the flow being rebuilt with each new query in your langflow application, you can optimize the process by implementing caching mechanisms. This approach involves checking if the flow already exists in the cache before deciding to rebuild it, thus saving time by reusing the built flow for subsequent queries. Here's a streamlined way to achieve this:
By following these steps, you ensure that the flow is built only once and reused for each new query, significantly reducing the processing time and improving the efficiency of your application.
|
Beta Was this translation helpful? Give feedback.
-
Hi there : I would also like to know how to optimise this : I don't think the @dosu code looks correct/up to date for 1.0.14 ? |
Beta Was this translation helpful? Give feedback.
-
did you consider freezing the components that you don't want to re-execute? https://docs.langflow.org/whats-new-a-new-chapter-langflow#4912d08da5464ff2aff595d6b26fd809 |
Beta Was this translation helpful? Give feedback.
-
@codenprogressive I want all the components to execute : the issue is that I think the flow is rebuilt from the JSON definition each time the flow is called. However : Im on version 1.0.14 now, and I'm seeing on the docs pages, load_flow_from_json/run_flow_from_json may not be the correct way to address the endpoint for interactive messages : def run_flow(message: str,
|
Beta Was this translation helpful? Give feedback.
-
I am trying to use my flow build in langflow as a python code as below :
But each time when I am entering a new query , everytime build is building which is taking time for each new query and I dont want that . I want build to happen only once and then for every query full process should not repeat .
Please suggest a way to do that ?
Beta Was this translation helpful? Give feedback.
All reactions