🐛 fix(process.py): add error handling for unknown langchain_object types

When processing the data graph, if the langchain_object is of an unknown type, a ValueError is now raised. This provides better error handling and helps identify any unexpected langchain_object types that may be encountered during processing.
This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-06-29 18:19:22 -03:00
commit f81a835001

View file

@ -107,6 +107,10 @@ def process_graph_cached(data_graph: Dict[str, Any], inputs: Optional[dict] = No
elif isinstance(langchain_object, VectorStore):
class_name = langchain_object.__class__.__name__
result = {"message": f"Processed {class_name} successfully"}
else:
raise ValueError(
f"Unknown langchain_object type: {type(langchain_object).__name__}"
)
return result