langflow icon indicating copy to clipboard operation
langflow copied to clipboard

performance of run_flow_from_json function

Open d0uub opened this issue 3 months ago • 9 comments

Bug Description

For the basic general LLM/ChatGPT query, execution time took 17 seconds for the process, but for pure Python, it took only 4-7 seconds, which after debug into langflow code, see that around 10 seconds for job initialization. Is it possible to cache it or find a solution to run it as fast as hosting the Langflow service? here is sample code:

from langflow.load import run_flow_from_json
import time
 
start_time = time.time()
 
result = run_flow_from_json(flow="Basic Prompting (Hello, World).json",input_value="hello tell me a joke",cache="test")
 
end_time = time.time()
execution_time = end_time - start_time
 
print(result)
print(f"Execution time: {execution_time} seconds")

Reproduction

just want to know any solution to speed up run_flow_from_json

Expected behavior

from 17 seconds running time down to 4-7 seconds

Who can help?

@italojohnny @ogabrielluiz @nicoloboschi @zzzming @jordanrfrazier @mfortman11 @NadirJ

Operating System

Windows 11

Langflow Version

1.0.19.post1

Python Version

3.11

Screenshot

No response

Flow File

No response

d0uub avatar Nov 05 '24 06:11 d0uub