Mayil-AI-Sandbox / kuzudb_jan15

MIT License
0 stars 0 forks source link

RuntimeError: Parameters must be a dict (hashtag2856) #11

Open vikramsubramanian opened 7 months ago

vikramsubramanian commented 7 months ago

Hi Team, I am facing issue with the interface. Can someone help me with this error. I am running this in colab.

hashtaghashtag Code

documents = SimpleDirectoryReader("/content/data").load_data()
from llama_index.storage.storage_context import StorageContext

storage_context = StorageContext.from_defaults(graph_store=graph_store)

hashtag NOTE: can take a while!
index = KnowledgeGraphIndex.from_documents(documents=documents,max_triplets_per_chunk=2,storage_context=storage_context,service_context=service_context,show_progress=True)

hashtaghashtag Error Log

Parsing nodes: 100%.         92/92 [00:00<00:00, 175.95it/s]
Processing nodes: 0%.       0/222 [00:01<?, ?it/s]
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
[<ipython-input-20-a9b7fc827b8f>]( in <cell line: 6>()
      4 
      5 hashtag NOTE: can take a while!
----> 6 index = KnowledgeGraphIndex.from_documents(documents=documents,max_triplets_per_chunk=2,storage_context=storage_context,service_context=service_context,show_progress=True)

8 frames
[/usr/local/lib/python3.10/dist-packages/kuzu/connection.py]( in execute(self, query, parameters)
     77             hashtag TODO(Chang): remove ROLLBACK once we can guarantee database is deleted after conn
     78             self._connection.execute(self.prepare("ROLLBACK")._prepared_statement, {})
---> 79             raise RuntimeError("Parameters must be a dict")
     80         prepared_statement = self.prepare(
     81             query) if type(query) == str else query

RuntimeError: Parameters must be a dict

)

mayil-ai[bot] commented 7 months ago

Summary: The code is throwing a RuntimeError "Parameters must be a dict" while executing in Colab.

Possible Solution

Based on the provided information, the issue is that the execute method in connection.py is expecting a dictionary for its parameters argument, but it is receiving a non-dict type, which leads to a RuntimeError: Parameters must be a dict. To resolve this issue:

Here is an example of how to correctly call the execute method with a dictionary for the parameters:

conn.execute("MATCH (a:person) WHERE a.registerTime = $1 RETURN COUNT(*);", {"1": datetime.datetime(2011, 8, 20, 11, 25, 30)})

Make sure that all calls to execute follow this pattern and that the parameters are indeed a dictionary.

Code snippets to check