mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-14 15:16:21 +00:00
parsed_json is expected to be a list of dictionaries, but it seems to… (#24018)
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 <basir.sedighi@nris.no> Co-authored-by: Chester Curme <chester.curme@gmail.com>
This commit is contained in:
parent
8bde04079b
commit
0f3fe44e44
@ -729,6 +729,8 @@ class LLMGraphTransformer:
|
|||||||
if not isinstance(raw_schema, str):
|
if not isinstance(raw_schema, str):
|
||||||
raw_schema = raw_schema.content
|
raw_schema = raw_schema.content
|
||||||
parsed_json = self.json_repair.loads(raw_schema)
|
parsed_json = self.json_repair.loads(raw_schema)
|
||||||
|
if isinstance(parsed_json, dict):
|
||||||
|
parsed_json = [parsed_json]
|
||||||
for rel in parsed_json:
|
for rel in parsed_json:
|
||||||
# Nodes need to be deduplicated using a set
|
# Nodes need to be deduplicated using a set
|
||||||
nodes_set.add((rel["head"], rel["head_type"]))
|
nodes_set.add((rel["head"], rel["head_type"]))
|
||||||
|
Loading…
Reference in New Issue
Block a user