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

client.tasks.list with fields = 'all' fails on comment_authors #348

Open
LeoVrana opened this issue Oct 30, 2024 · 1 comment
Open

client.tasks.list with fields = 'all' fails on comment_authors #348

LeoVrana opened this issue Oct 30, 2024 · 1 comment

Comments

@LeoVrana
Copy link

Hi!

I am on Label Studio enterprise, on version 1.0.5. I am trying to get annotation data for a project via the SDK + API. The problem is that when I iterate over tasks, any task with a comment inevitably throws a pydantic ValidationError:

>>> tasks = ls.tasks.list(project=project_id, fields='all')
>>> for t in tasks:
...     pass
... 
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ls/.st_env/lib/python3.10/site-packages/label_studio_sdk/_extensions/pager_ext.py", line 23, in __iter__
    for item in super().__iter__():
  File "/home/ls/.st_env/lib/python3.10/site-packages/label_studio_sdk/core/pagination.py", line 42, in __iter__
    for page in self.iter_pages():
  File "/home/ls/.st_env/lib/python3.10/site-packages/label_studio_sdk/core/pagination.py", line 53, in iter_pages
    page = page.get_next()
  File "/home/ls/.st_env/lib/python3.10/site-packages/label_studio_sdk/tasks/client.py", line 217, in <lambda>
    _get_next = lambda: self.list(
  File "/home/ls/.st_env/lib/python3.10/site-packages/label_studio_sdk/tasks/client_ext.py", line 10, in list
    return SyncPagerExt.from_sync_pager(super().list(**kwargs))
  File "/home/ls/.st_env/lib/python3.10/site-packages/label_studio_sdk/tasks/client.py", line 215, in list
    _parsed_response = pydantic_v1.parse_obj_as(TasksListResponse, _response.json())  # type: ignore
  File "/home/ls/.st_env/lib/python3.10/site-packages/pydantic/v1/tools.py", line 38, in parse_obj_as
    return model_type(__root__=obj).__root__
  File "/home/ls/.st_env/lib/python3.10/site-packages/pydantic/v1/main.py", line 341, in __init__
    raise validation_error
pydantic.v1.error_wrappers.ValidationError: 3 validation errors for ParsingModel[TasksListResponse]
__root__ -> tasks -> 11 -> comment_authors -> 0
  value is not a valid integer (type=type_error.integer)
__root__ -> tasks -> 20 -> comment_authors -> 0
  value is not a valid integer (type=type_error.integer)
__root__ -> tasks -> 78 -> comment_authors -> 0
  value is not a valid integer (type=type_error.integer)

Let me know if there is any other information you might need.

@dsinghvi
Copy link
Contributor

@LeoVrana thanks for submitting this issue, will follow up

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