🐛 fix(process.py): add support for processing Document objects in process_graph_cached function
This commit is contained in:
parent
489394a051
commit
f379d54686
1 changed files with 3 additions and 0 deletions
|
|
@ -11,6 +11,7 @@ from langflow.graph import Graph
|
||||||
from langchain.chains.base import Chain
|
from langchain.chains.base import Chain
|
||||||
from langchain.vectorstores.base import VectorStore
|
from langchain.vectorstores.base import VectorStore
|
||||||
from typing import Any, Dict, List, Optional, Tuple, Union
|
from typing import Any, Dict, List, Optional, Tuple, Union
|
||||||
|
from langchain.schema import Document
|
||||||
|
|
||||||
|
|
||||||
def fix_memory_inputs(langchain_object):
|
def fix_memory_inputs(langchain_object):
|
||||||
|
|
@ -126,6 +127,8 @@ def process_graph_cached(
|
||||||
logger.debug("Generated result and thought")
|
logger.debug("Generated result and thought")
|
||||||
elif isinstance(langchain_object, VectorStore):
|
elif isinstance(langchain_object, VectorStore):
|
||||||
result = langchain_object.search(**inputs)
|
result = langchain_object.search(**inputs)
|
||||||
|
elif isinstance(langchain_object, Document):
|
||||||
|
result = langchain_object.dict()
|
||||||
else:
|
else:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
f"Unknown langchain_object type: {type(langchain_object).__name__}"
|
f"Unknown langchain_object type: {type(langchain_object).__name__}"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue