diff --git a/src/backend/langflow/interface/run.py b/src/backend/langflow/interface/run.py index 48ba918a8..bab211c2a 100644 --- a/src/backend/langflow/interface/run.py +++ b/src/backend/langflow/interface/run.py @@ -67,40 +67,6 @@ def build_langchain_object(data_graph): return graph.build() -def process_graph(data_graph: Dict[str, Any]): - """ - Process graph by extracting input variables and replacing ZeroShotPrompt - with PromptTemplate,then run the graph and return the result and thought. - """ - # Load langchain object - logger.debug("Loading langchain object") - message = data_graph.pop("message", "") - is_first_message = len(data_graph.get("chatHistory", [])) == 0 - computed_hash, langchain_object = load_langchain_object( - data_graph, is_first_message - ) - logger.debug("Loaded langchain object") - - if langchain_object is None: - # Raise user facing error - raise ValueError( - "There was an error loading the langchain_object. Please, check all the nodes and try again." - ) - - # Generate result and thought - logger.debug("Generating result and thought") - result, thought = get_result_and_steps(langchain_object, message) - logger.debug("Generated result and thought") - - # Save langchain_object to cache - # We have to save it here because if the - # memory is updated we need to keep the new values - logger.debug("Saving langchain object to cache") - # save_cache(computed_hash, langchain_object, is_first_message) - logger.debug("Saved langchain object to cache") - return {"result": str(result), "thought": thought.strip()} - - def process_graph_cached(data_graph: Dict[str, Any], message: str): """ Process graph by extracting input variables and replacing ZeroShotPrompt diff --git a/tests/test_graph.py b/tests/test_graph.py index 73c05099f..a0f5945fc 100644 --- a/tests/test_graph.py +++ b/tests/test_graph.py @@ -14,7 +14,7 @@ from langflow.graph.nodes import ( ToolNode, WrapperNode, ) -from langflow.interface.run import get_result_and_steps +from langflow.interface.run import get_result_and_thought from langflow.utils.payload import get_root_node # Test cases for the graph module @@ -335,7 +335,7 @@ def test_get_result_and_thought(basic_graph): # now build again and check if FakeListLLM was used # Get the result and thought - result, thought = get_result_and_steps(langchain_object, message) + result, thought = get_result_and_thought(langchain_object, message) # The result should be a str assert isinstance(result, str) # The thought should be a Thought