From 0f3fe44e4452a6b68d5f9443ce8f42cefeeaf714 Mon Sep 17 00:00:00 2001 From: basirsedighi <31671555+basirsedighi@users.noreply.github.com> Date: Thu, 22 Aug 2024 21:09:43 +0200 Subject: [PATCH] =?UTF-8?q?parsed=5Fjson=20is=20expected=20to=20be=20a=20l?= =?UTF-8?q?ist=20of=20dictionaries,=20but=20it=20seems=20to=E2=80=A6=20(#2?= =?UTF-8?q?4018)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit parsed_json is expected to be a list of dictionaries, but it seems to… be a single dictionary instead. This is at libs/experimental/langchain_experimental/graph_transformers/llm.py process process_response Thank you for contributing to LangChain! - [ ] **Bugfix**: "experimental: bugfix" --------- Co-authored-by: based Co-authored-by: Chester Curme --- .../langchain_experimental/graph_transformers/llm.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libs/experimental/langchain_experimental/graph_transformers/llm.py b/libs/experimental/langchain_experimental/graph_transformers/llm.py index 6b1c60ad83e..7f1eb9b8fb3 100644 --- a/libs/experimental/langchain_experimental/graph_transformers/llm.py +++ b/libs/experimental/langchain_experimental/graph_transformers/llm.py @@ -729,6 +729,8 @@ class LLMGraphTransformer: if not isinstance(raw_schema, str): raw_schema = raw_schema.content parsed_json = self.json_repair.loads(raw_schema) + if isinstance(parsed_json, dict): + parsed_json = [parsed_json] for rel in parsed_json: # Nodes need to be deduplicated using a set nodes_set.add((rel["head"], rel["head_type"]))