Hi!
I’m using Weaviate (Version 1.22.3) and Python client V4 (Version 4.3b2). When trying to load data with the following code. I get the error AttributeError: 'DataObject' object has no attribute 'items'
Code:
import weaviate
import weaviate.classes as wvc
...
wvc.DataObject(
properties={
"title": capture.title,
"text": capture.text,
},
vector=list(embedding_model.embed(capture.text))[0],
)
_extension.data.insert(data_object)
Error:
Traceback (most recent call last):
File "/Users/maruthi/.pyenv/versions/_extension/lib/python3.11/site-packages/uvicorn/protocols/http/h11_impl.py", line 408, in run_asgi
result = await app( # type: ignore[func-returns-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/maruthi/.pyenv/versions/_extension/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 84, in __call__
return await self.app(scope, receive, send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/maruthi/.pyenv/versions/_extension/lib/python3.11/site-packages/fastapi/applications.py", line 1106, in __call__
await super().__call__(scope, receive, send)
File "/Users/maruthi/.pyenv/versions/_extension/lib/python3.11/site-packages/starlette/applications.py", line 122, in __call__
await self.middleware_stack(scope, receive, send)
File "/Users/maruthi/.pyenv/versions/_extension/lib/python3.11/site-packages/starlette/middleware/errors.py", line 184, in __call__
raise exc
File "/Users/maruthi/.pyenv/versions/_extension/lib/python3.11/site-packages/starlette/middleware/errors.py", line 162, in __call__
await self.app(scope, receive, _send)
File "/Users/maruthi/.pyenv/versions/_extension/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 79, in __call__
raise exc
File "/Users/maruthi/.pyenv/versions/_extension/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 68, in __call__
await self.app(scope, receive, sender)
File "/Users/maruthi/.pyenv/versions/_extension/lib/python3.11/site-packages/fastapi/middleware/asyncexitstack.py", line 20, in __call__
raise e
File "/Users/maruthi/.pyenv/versions/_extension/lib/python3.11/site-packages/fastapi/middleware/asyncexitstack.py", line 17, in __call__
await self.app(scope, receive, send)
File "/Users/maruthi/.pyenv/versions/_extension/lib/python3.11/site-packages/starlette/routing.py", line 718, in __call__
await route.handle(scope, receive, send)
File "/Users/maruthi/.pyenv/versions/_extension/lib/python3.11/site-packages/starlette/routing.py", line 276, in handle
await self.app(scope, receive, send)
File "/Users/maruthi/.pyenv/versions/_extension/lib/python3.11/site-packages/starlette/routing.py", line 66, in app
response = await func(request)
^^^^^^^^^^^^^^^^^^^
File "/Users/maruthi/.pyenv/versions/_extension/lib/python3.11/site-packages/fastapi/routing.py", line 274, in app
raw_response = await run_endpoint_function(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/maruthi/.pyenv/versions/_extension/lib/python3.11/site-packages/fastapi/routing.py", line 191, in run_endpoint_function
return await dependant.call(**values)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/maruthi/oasis/_extension/backend/app/api/handlers/_extension.py", line 123, in capture
web_extension.data.insert(data_object)
File "/Users/maruthi/.pyenv/versions/_extension/lib/python3.11/site-packages/weaviate/collections/data.py", line 348, in insert
"properties": self._serialize_properties(properties),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/maruthi/.pyenv/versions/chrome_extension/lib/python3.11/site-packages/weaviate/collections/data.py", line 265, in _serialize_properties
for key, val in data.items()
^^^^^^^^^^
AttributeError: 'DataObject' object has no attribute 'items'