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

camel_graph_rag: ValueError: Values of type <class 'uuid.UUID'> are not supported #85

Open
iamsk opened this issue Aug 13, 2024 · 2 comments

Comments

@iamsk
Copy link

iamsk commented Aug 13, 2024

100% follow the camel_graph_rag.ipynb

ValueError Traceback (most recent call last)
Cell In[23], line 2
1 # Add the element to neo4j database
----> 2 n4j.add_graph_elements(graph_elements=[graph_elements])

File /usr/local/anaconda3/lib/python3.10/site-packages/camel/storages/graph_storages/neo4j_graph.py:562, in Neo4jGraph.add_graph_elements(self, graph_elements, include_source, base_entity_label)
557 element.source.to_dict()['element_id'] = md5(
558 str(element).encode("utf-8")
559 ).hexdigest()
561 # Import nodes
--> 562 self.query(
563 node_import_query,
564 {
565 "data": [el.dict for el in element.nodes],
566 "element": element.source.to_dict(),
567 },
568 )
569 # Import relationships
570 self.query(
571 rel_import_query,
572 {
(...)
584 },
585 )

File /usr/local/anaconda3/lib/python3.10/site-packages/camel/storages/graph_storages/neo4j_graph.py:237, in Neo4jGraph.query(self, query, params)
235 with self.driver.session(database=self.database) as session:
236 try:
--> 237 data = session.run(
238 Query(text=query, timeout=self.timeout), params
239 )
240 json_data = [r.data() for r in data]
241 if self.truncate:

File /usr/local/anaconda3/lib/python3.10/site-packages/neo4j/_sync/work/session.py:314, in Session.run(self, query, parameters, **kwargs)
312 bookmarks = self._get_bookmarks()
313 parameters = dict(parameters or {}, **kwargs)
--> 314 self._auto_result._run(
315 query, parameters, self._config.database,
316 self._config.impersonated_user, self._config.default_access_mode,
317 bookmarks, self._config.notifications_min_severity,
318 self._config.notifications_disabled_classifications,
319 )
321 return self._auto_result

File /usr/local/anaconda3/lib/python3.10/site-packages/neo4j/_sync/work/result.py:203, in Result._run(self, query, parameters, db, imp_user, access_mode, bookmarks, notifications_min_severity, notifications_disabled_classifications)
200 self._attached = False
201 Util.callback(self._on_closed)
--> 203 self._connection.run(
204 query_text,
205 parameters=parameters,
206 mode=access_mode,
207 bookmarks=bookmarks,
208 metadata=query_metadata,
209 timeout=query_timeout,
210 db=db,
211 imp_user=imp_user,
212 notifications_min_severity=notifications_min_severity,
213 notifications_disabled_classifications=
214 notifications_disabled_classifications,
215 dehydration_hooks=self._hydration_scope.dehydration_hooks,
216 on_success=on_attached,
217 on_failure=on_failed_attach,
218 )
219 self._pull()
220 self._connection.send_all()

File /usr/local/anaconda3/lib/python3.10/site-packages/neo4j/_sync/io/_common.py:178, in ConnectionErrorHandler.getattr..outer..inner(*args, **kwargs)
176 def inner(*args, **kwargs):
177 try:
--> 178 func(*args, **kwargs)
179 except (Neo4jError, ServiceUnavailable, SessionExpired) as exc:
180 assert not asyncio.iscoroutinefunction(self.__on_error)

File /usr/local/anaconda3/lib/python3.10/site-packages/neo4j/_sync/io/_bolt5.py:619, in Bolt5x2.run(self, query, parameters, mode, bookmarks, metadata, timeout, db, imp_user, notifications_min_severity, notifications_disabled_classifications, dehydration_hooks, hydration_hooks, **handlers)
616 fields = (query, parameters, extra)
617 log.debug("[#%04X] C: RUN %s", self.local_port,
618 " ".join(map(repr, fields)))
--> 619 self._append(b"\x10", fields,
620 Response(self, "run", hydration_hooks, **handlers),
621 dehydration_hooks=dehydration_hooks)

File /usr/local/anaconda3/lib/python3.10/site-packages/neo4j/_sync/io/_bolt.py:804, in Bolt._append(self, signature, fields, response, dehydration_hooks)
792 def _append(self, signature, fields=(), response=None,
793 dehydration_hooks=None):
794 """ Appends a message to the outgoing queue.
795
796 :param signature: the signature of the message
(...)
802 object of type understood by packstream.
803 """
--> 804 self.outbox.append_message(signature, fields, dehydration_hooks)
805 self.responses.append(response)
806 if response:

File /usr/local/anaconda3/lib/python3.10/site-packages/neo4j/_sync/io/_common.py:132, in Outbox.append_message(self, tag, fields, dehydration_hooks)
130 def append_message(self, tag, fields, dehydration_hooks):
131 with self._buffer.tmp_buffer():
--> 132 self._packer.pack_struct(tag, fields, dehydration_hooks)
133 self._wrap_message()

File /usr/local/anaconda3/lib/python3.10/site-packages/neo4j/_codec/packstream/v1/init.py:222, in Packer.pack_struct(self, signature, fields, dehydration_hooks)
221 def pack_struct(self, signature, fields, dehydration_hooks=None):
--> 222 self._pack_struct(
223 signature, fields,
224 dehydration_hooks=self._inject_hooks(dehydration_hooks)
225 )

File /usr/local/anaconda3/lib/python3.10/site-packages/neo4j/_codec/packstream/v1/init.py:238, in Packer._pack_struct(self, signature, fields, dehydration_hooks)
236 write(signature)
237 for field in fields:
--> 238 self._pack(field, dehydration_hooks)

File /usr/local/anaconda3/lib/python3.10/site-packages/neo4j/_codec/packstream/v1/init.py:65, in Packer._pack(self, data, dehydration_hooks)
64 def _pack(self, data, dehydration_hooks=None):
---> 65 self._py_pack(data, dehydration_hooks)

File /usr/local/anaconda3/lib/python3.10/site-packages/neo4j/_codec/packstream/v1/init.py:143, in Packer._py_pack(self, value, dehydration_hooks)
139 raise TypeError(
140 "Map keys must be strings, not {}".format(type(key))
141 )
142 self._py_pack(key, dehydration_hooks)
--> 143 self._py_pack(item, dehydration_hooks)
145 # Structure
146 elif isinstance(value, Structure):

File /usr/local/anaconda3/lib/python3.10/site-packages/neo4j/_codec/packstream/v1/init.py:143, in Packer._py_pack(self, value, dehydration_hooks)
139 raise TypeError(
140 "Map keys must be strings, not {}".format(type(key))
141 )
142 self._py_pack(key, dehydration_hooks)
--> 143 self._py_pack(item, dehydration_hooks)
145 # Structure
146 elif isinstance(value, Structure):

File /usr/local/anaconda3/lib/python3.10/site-packages/neo4j/_codec/packstream/v1/init.py:157, in Packer._py_pack(self, value, dehydration_hooks)
154 self._py_pack(transformer(value), dehydration_hooks)
155 return
--> 157 raise ValueError("Values of type %s are not supported" % type(value))

ValueError: Values of type <class 'uuid.UUID'> are not supported

@iamsk
Copy link
Author

iamsk commented Aug 13, 2024

@Wendong-Fan please have a look, thanks.

@Wendong-Fan
Copy link
Contributor

Wendong-Fan commented Aug 13, 2024

Hey @iamsk , thanks for bringing up the issue. It seems this problem arose because the CAMEL package was updated, but the code in the cookbook wasn't aligned with the new version. You can quickly fix this by running
pip install camel-ai[all]==0.1.6.0 when install CAMEL package

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