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

Bug: GraphIndexCreator raises PydanticUserError when instantiated; NetworkX tutorial notebook not running. #29067

Open
5 tasks done
MrVaibhavChamp opened this issue Jan 7, 2025 · 0 comments
Labels
🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature

Comments

@MrVaibhavChamp
Copy link

Checked other resources

  • I added a very descriptive title to this issue.
  • I searched the LangChain documentation with the integrated search.
  • I used the GitHub search to find a similar question and didn't find it.
  • I am sure that this is a bug in LangChain rather than my code.
  • The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).

Example Code

Run the following code:

from langchain_community.graphs.index_creator import GraphIndexCreator
from langchain_openai import OpenAI
index_creator = GraphIndexCreator(llm=OpenAI(temperature=0, api_key=OPENAI_API_KEY))

Remember to use your own OpenAI API key.

Error Message and Stack Trace (if applicable)

PydanticUserError Traceback (most recent call last)
in <cell line: 1>()
----> 1 index_creator = GraphIndexCreator(llm=OpenAI(temperature=0, api_key=OPENAI_API_KEY)) [... skipping hidden 1 frame]

/usr/local/lib/python3.10/dist-packages/pydantic/_internal/_mock_val_ser.py in getattr(self, item)
98 # raise an AttributeError if item doesn't exist
99 getattr(self._val_or_ser, item)
--> 100 raise PydanticUserError(self._error_message, code=self._code)
101
102 def rebuild(self) -> ValSer | None:

PydanticUserError: GraphIndexCreator is not fully defined; you should define BaseCache, then call GraphIndexCreator.model_rebuild().

Description

Was trying to run the following networkx tutorial: https://github.com/langchain-ai/langchain/blob/master/docs/docs/integrations/graphs/networkx.ipynb.

I encountered a PydanticUserError when attempting to instantiate the GraphIndexCreator. It seems that BaseCache needs to be defined and GraphIndexCreator.model_rebuild() must be called, but this isn't mentioned in the documentation or examples.

System Info

This was run in the usual Google Colab environment.

@dosubot dosubot bot added the 🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature label Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature
Projects
None yet
Development

No branches or pull requests

1 participant