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:
basirsedighi 2024-08-22 21:09:43 +02:00 committed by GitHub
parent 8bde04079b
commit 0f3fe44e44
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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"]))