Skip to content

extract_and_store_graph(d) failed with validationError, Help! #45

@Jiancong

Description

@Jiancong

When I ran this on colab

from tqdm import tqdm

for i, d in tqdm(enumerate(documents), total=len(documents)):
    extract_and_store_graph(d)

The following errors are happened. It seems the paramters is missing, is it?

0%|          | 0/3 [00:00<?, ?it/s]<ipython-input-7-20bca8150e5d>:47: LangChainDeprecationWarning: The function `create_structured_output_chain` was deprecated in LangChain 0.1.1 and will be removed in 1.0. Use :meth:`~ChatOpenAI.with_structured_output` instead.
  return create_structured_output_chain(KnowledgeGraph, llm, prompt, verbose=False)
/usr/local/lib/python3.10/dist-packages/pydantic/json_schema.py:2191: PydanticJsonSchemaWarning: Default value default=Ellipsis description='key' extra={} is not JSON serializable; excluding default from JSON schema [non-serializable-default]
  warnings.warn(message, PydanticJsonSchemaWarning)
/usr/local/lib/python3.10/dist-packages/pydantic/json_schema.py:2191: PydanticJsonSchemaWarning: Default value default=Ellipsis description='value' extra={} is not JSON serializable; excluding default from JSON schema [non-serializable-default]
  warnings.warn(message, PydanticJsonSchemaWarning)
/usr/local/lib/python3.10/dist-packages/pydantic/json_schema.py:2191: PydanticJsonSchemaWarning: Default value description='List of node properties' extra={} is not JSON serializable; excluding default from JSON schema [non-serializable-default]
  warnings.warn(message, PydanticJsonSchemaWarning)
/usr/local/lib/python3.10/dist-packages/pydantic/json_schema.py:2191: PydanticJsonSchemaWarning: Default value default=Ellipsis description='List of nodes in the knowledge graph' extra={} is not JSON serializable; excluding default from JSON schema [non-serializable-default]
  warnings.warn(message, PydanticJsonSchemaWarning)
/usr/local/lib/python3.10/dist-packages/pydantic/json_schema.py:2191: PydanticJsonSchemaWarning: Default value description='List of relationship properties' extra={} is not JSON serializable; excluding default from JSON schema [non-serializable-default]
  warnings.warn(message, PydanticJsonSchemaWarning)
/usr/local/lib/python3.10/dist-packages/pydantic/json_schema.py:2191: PydanticJsonSchemaWarning: Default value default=Ellipsis description='List of relationships in the knowledge graph' extra={} is not JSON serializable; excluding default from JSON schema [non-serializable-default]
  warnings.warn(message, PydanticJsonSchemaWarning)
  0%|          | 0/3 [00:36<?, ?it/s]
---------------------------------------------------------------------------
ValidationError                           Traceback (most recent call last)
[<ipython-input-10-f0346f4eaff5>](https://localhost:8080/#) in <cell line: 3>()
      2 
      3 for i, d in tqdm(enumerate(documents), total=len(documents)):
----> 4     extract_and_store_graph(d)

8 frames
[/usr/local/lib/python3.10/dist-packages/pydantic/main.py](https://localhost:8080/#) in model_validate_json(cls, json_data, strict, context)
    623         # `__tracebackhide__` tells pytest and some other tools to omit this function from tracebacks
    624         __tracebackhide__ = True
--> 625         return cls.__pydantic_validator__.validate_json(json_data, strict=strict, context=context)
    626 
    627     @classmethod

ValidationError: 20 validation errors for _OutputFormatter
output.nodes.21.properties
  Input should be a valid array [type=list_type, input_value={'location': 'Anaheim, California'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.9/v/list_type
output.nodes.23.properties
  Input should be a valid array [type=list_type, input_value={'year': '1959'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.9/v/list_type
output.nodes.24.properties
  Input should be a valid array [type=list_type, input_value={'year': '1960'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.9/v/list_type
output.nodes.25.properties
  Input should be a valid array [type=list_type, input_value={'year': '1964'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.9/v/list_type
output.rels.1.properties
  Input should be a valid array [type=list_type, input_value={'awardsEarned': '22', 'nominations': '59'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.9/v/list_type
output.rels.4.properties
  Input should be a valid array [type=list_type, input_value={'organization': 'Library of Congress'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.9/v/list_type
output.rels.6.properties
  Input should be a valid array [type=list_type, input_value={'year': '1901'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.9/v/list_type
output.rels.7.properties
  Input should be a valid array [type=list_type, input_value={'year': '1920s'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.9/v/list_type
output.rels.8.properties
  Input should be a valid array [type=list_type, input_value={'co-founder': 'Roy Disney'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.9/v/list_type
output.rels.9.properties
  Input should be a valid array [type=list_type, input_value={'year': '1928'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.9/v/list_type
output.rels.10.properties
  Input should be a valid array [type=list_type, input_value={'year': '1937'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.9/v/list_type
output.rels.11.properties
  Input should be a valid array [type=list_type, input_value={'year': '1940'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.9/v/list_type
output.rels.12.properties
  Input should be a valid array [type=list_type, input_value={'year': '1940'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.9/v/list_type
output.rels.13.properties
  Input should be a valid array [type=list_type, input_value={'year': '1941'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.9/v/list_type
output.rels.14.properties

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions