langchain icon indicating copy to clipboard operation
langchain copied to clipboard

experimental: Handle possible KeyError in 'convert_to_graph_documents' in llm.py

Open olliequ opened this issue 5 months ago • 1 comments

It's possible some returned dicts don't have the "head" or "tail_type" key which results in a KeyError if not handled (which it currently isn't). So, ignore dicts returned that displays this behaviour, as well as those who have head as "". I noticed rel dicts that have head as "" (empty string) are usually dicts which are text duplicates of a previous rel, hence why they can be safely ignored.

olliequ avatar Sep 11 '24 02:09 olliequ