-
Notifications
You must be signed in to change notification settings - Fork 238
Possible Regression: ValueError when creating Request object with DocList of ImageDocs #1501
Copy link
Copy link
Closed
Description
Description
I have tested the latest version from the main branch and encountered a failure with the following code snippet. This issue does not occur with the latest release, so it might be a regression. It is worth investigating before the next release.
from docarray import DocVec, BaseDoc, DocList
from docarray.documents.image import ImageDoc
class Request(BaseDoc):
images: DocList[ImageDoc]
images = DocList[ImageDoc]([ImageDoc(url=f'http://url.com/{i}.png') for i in range(10)])
request = Request(images=images)
request.json()The code above results in the following error:
ValueError: {'id': '8695291365f8c39b5dc7e5272aff41be', 'url': ImageUrl('http://url.com/0.png', host_type='domain'), 'tensor': None, 'embedding': None, 'bytes_': None} is not a <class 'docarray.documents.image.ImageDoc'>
Steps to reproduce
- Run the code snippet provided above using the latest version from the main branch.
- Observe the
ValueError.
Expected behavior
The code should run without errors, creating a Request object with a DocList of ImageDoc objects, and output the JSON representation of the request object.
Additional information
The issue does not occur with the latest release. It might be a regression introduced in recent commits.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Done