Bug: GraphIndexCreator raises PydanticUserError when instantiated; NetworkX tutorial notebook not running. #29067
Labels
🤖:bug
Related to a bug, vulnerability, unexpected error with an existing feature
Checked other resources
Example Code
Run the following code:
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 exist99 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 defineBaseCache
, then callGraphIndexCreator.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.
The text was updated successfully, but these errors were encountered: