-
Notifications
You must be signed in to change notification settings - Fork 400
Description
I don't have OpenAI but I can access Mistral models on Amazon Bedrock so i'm using that. But I have ben stuck on this error for a while:
AttributeError Traceback (most recent call last)
Cell In[45], line 30
24 graph = Neo4jGraph(
25 url=os.getenv('NEO4J_URI'),
26 username=os.getenv('NEO4J_USERNAME'),
27 password=os.getenv('NEO4J_PASSWORD')
28 )
---> 30 graph.add_graph_documents(
31 graph_documents,
32 baseEntityLabel=True,
33 include_source=True
34 )
File /opt/homebrew/Cellar/micromamba/2.0.8/envs/cs109b/lib/python3.11/site-packages/langchain_community/graphs/neo4j_graph.py:657, in Neo4jGraph.add_graph_documents(self, graph_documents, include_source, baseEntityLabel)
655 # Remove backticks from node types
656 for node in document.nodes:
--> 657 node.type = _remove_backticks(node.type)
658 # Import nodes
659 self.query(
660 node_import_query,
661 {
(...)
664 },
665 )
File /opt/homebrew/Cellar/micromamba/2.0.8/envs/cs109b/lib/python3.11/site-packages/pydantic/main.py:940, in BaseModel.setattr(self, name, value)
938 else:
939 self.dict[name] = value
--> 940 self.pydantic_fields_set.add(name)
AttributeError: 'dict' object has no attribute 'add'
I wasn't able to find a solution online. Anyone has any idea what may be causing the issue? Does passing Mistral model as the LLM result in different ways how nodes are stored?
For the reference: here is the code I used to generate the graph_documents:
bedrock_runtime = boto3.client('bedrock-runtime', region_name='us-west-2')
llm = BedrockLLM(model_id="mistral.mistral-large-2407-v1:0",client=bedrock_runtime,model_kwargs={"max_tokens": 3000} )
llm_transformer = LLMGraphTransformer(llm=llm)
graph_documents = llm_transformer.convert_to_graph_documents(documents)
graph = Neo4jGraph(
url=os.getenv('NEO4J_URI'),
username=os.getenv('NEO4J_USERNAME'),
password=os.getenv('NEO4J_PASSWORD')
)
graph.add_graph_documents(
graph_documents,
baseEntityLabel=True,
include_source=True