🔥 refactor(run.py): remove unused imports and commented out code in run.py
🔥 refactor(test_cache.py): remove unused imports and commented out code in test_cache.py
This commit is contained in:
parent
00290d0f9e
commit
7a63b5635d
2 changed files with 0 additions and 43 deletions
|
|
@ -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):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue