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

ValidationError when using LLMGraphTransformer #28

Open
arisylafeta opened this issue Jan 4, 2025 · 1 comment
Open

ValidationError when using LLMGraphTransformer #28

arisylafeta opened this issue Jan 4, 2025 · 1 comment
Assignees

Comments

@arisylafeta
Copy link

Hi, I was trying the GraphRAG tutorial from Neo4j:
https://neo4j.com/developer-blog/global-graphrag-neo4j-langchain/

and upon trying the snippet:

import concurrent.futures
from concurrent.futures import ThreadPoolExecutor, as_completed
from tqdm import tqdm


MAX_WORKERS = 10
NUM_ARTICLES = 200
graph_documents = []

with ThreadPoolExecutor(max_workers=MAX_WORKERS) as executor:
    # Submitting all tasks and creating a list of future objects
    futures = [
        executor.submit(process_text, f"{row['title']} {row['text']}")
        for i, row in news.head(NUM_ARTICLES).iterrows()
    ]

    for future in tqdm(
        as_completed(futures), total=len(futures), desc="Processing documents"
    ):
        graph_document = future.result()
        graph_documents.extend(graph_document)

graph.add_graph_documents(
    graph_documents,
    baseEntityLabel=True,
    include_source=True
)

I get this error:

ValidationError: 1 validation error for Node
properties
  Input should be a valid dictionary [type=dict_type, input_value=FieldInfo(default=Pydanti...class 'dict'>, extra={}), input_type=FieldInfo]
    For further information visit https://errors.pydantic.dev/2.8/v/dict_type

interestingly, I tried implementing one of the examples in the langchain docs: https://python.langchain.com/docs/how_to/graph_constructing/

and lo and behold I get the same error. It seems that something is broken. Can someone confirm getting the same issue?

@alexthomas93
Copy link
Collaborator

Hi @arisylafeta, could you please share more details about your environment, including the versions of langchain and langchain-neo4j you’re using? It would also be helpful if you could provide the full script you’re running. I’m having difficulty reproducing the error based on the Neo4j or LangChain documentation. Thanks!

@alexthomas93 alexthomas93 self-assigned this Jan 10, 2025
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

2 participants