diff --git a/src/backend/langflow/interface/run.py b/src/backend/langflow/interface/run.py index 83d8ab305..81c3f6910 100644 --- a/src/backend/langflow/interface/run.py +++ b/src/backend/langflow/interface/run.py @@ -1,22 +1,8 @@ from typing import Any, Dict, Tuple -from langflow.services.cache.utils import Memoize from langflow.graph import Graph -from langflow.services.utils import get_cache_manager from loguru import logger -@Memoize(get_cache_manager=get_cache_manager) -def build_langchain_object_with_caching(data_graph): - """ - Build langchain object from data_graph. - """ - - logger.debug("Building langchain object") - graph = Graph.from_payload(data_graph) - return graph.build() - - -# @Memoize(get_cache_manager=get_cache_manager) def build_sorted_vertices(data_graph) -> Tuple[Any, Dict]: """ Build langchain object from data_graph. @@ -32,23 +18,6 @@ def build_sorted_vertices(data_graph) -> Tuple[Any, Dict]: artifacts.update(vertex.artifacts) return graph.build(), artifacts - # def build_sorted_vertices_with_caching(data_graph): - # # Build the result if not in cache - # logger.debug("Building langchain object") - # graph = Graph.from_payload(data_graph) - # sorted_vertices = graph.topological_sort() - # artifacts = {} - # for vertex in sorted_vertices: - # vertex.build() - # if vertex.artifacts: - # artifacts.update(vertex.artifacts) - # result = (graph.build(), artifacts) - - # Save to cache - # cache_manager.set(session_id, result) - - # return result - def build_langchain_object(data_graph): """ diff --git a/tests/test_cache.py b/tests/test_cache.py index 94e4e8553..4ceea2c2a 100644 --- a/tests/test_cache.py +++ b/tests/test_cache.py @@ -1,11 +1,7 @@ import json from langflow.graph import Graph -from langflow.services.cache.utils import compute_dict_hash import pytest -from langflow.interface.run import ( - build_langchain_object_with_caching, -) def get_graph(_type="basic"): @@ -41,14 +37,6 @@ def langchain_objects_are_equal(obj1, obj2): return str(obj1) == str(obj2) -# Test build_langchain_object_with_caching -def test_build_langchain_object_with_caching(client, basic_data_graph): - session_id = compute_dict_hash(basic_data_graph) - build_langchain_object_with_caching.clear_cache(session_id) - graph = build_langchain_object_with_caching(basic_data_graph) - assert graph is not None - - # Test build_graph def test_build_graph(basic_data_graph): graph = Graph.from_payload(basic_data_graph)