Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

None values in head_type and tail_type #19

Open
philippmaa opened this issue Nov 20, 2024 · 0 comments
Open

None values in head_type and tail_type #19

philippmaa opened this issue Nov 20, 2024 · 0 comments

Comments

@philippmaa
Copy link

philippmaa commented Nov 20, 2024

Hi,

thank you very much for this very helpful library - I like it a lot!
Processing some documents I stumbled around a NoneType error during the validation of the Node BaseModel.

In the for-loop of LLMGraphTransformer -> process_response with self._function_call == False there is a check for None values of the head, tail and relation keys in the parsed_json. A few lines later there is:

source_node = Node(id=rel["head"], type=rel.get("head_type", DEFAULT_NODE_TYPE))

In my case it occurred, that rel["head_type"] is present but is None. In this case, rel.get("head_type", DEFAULT_NODE_TYPE) yields None instead of DEFAULT_NODE_TYPE and a pydantic.ValidatonError is raised.

Maybe there should be another sanity check like:

rel["head_type"] = rel.get("head_type", DEFAULT_NODE_TYPE) or DEFAULT_NODE_TYPE
rel["tail_type"] = rel.get("tail_type", DEFAULT_NODE_TYPE) or DEFAULT_NODE_TYPE

to make sure the type values are not None?

Best, Philipp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant