HumanSignal / HumanSignal/label-studio-sdk

Inconsistency between SDK and API

Open
#405 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
192
Forks
127
Avg merge
1d 18h
Merged PRs (30d)
1

Description

I have previously created predictions using the Python SDK like this:
```python
prediction = PredictionValue(
model_version="test", score=0.99, result=[result]
)
client.predictions.create(task=task.id, **prediction.model_dump())
```

I am now trying to create annotations through the Python SDK like this:
```python
annotation = AnnotationValue(result=[result])
client.annotations.create(id=task.id, **annotation.model_dump())
```

Unfortunately, `AnnotationValue` requires the field `completed_by`, not required by the API, which makes me get this error:
```sh
pydantic_core._pydantic_core.ValidationError: 1 validation error for AnnotationValue
completed_by
```
and AnnotationValue includes fields like `result_count` which is not expected from the API, which makes me get this error:
```sh
TypeError: AnnotationsClient.create() got an unexpected keyword argument 'result_count'
```

Initially, I thought this could be an issue with missmatch of versions, since I was using `label-studio-sdk==1.0.8` and `label-studio:1.15.0` (docker image). I saw in the release notes that the last time the SDK version was bumped was for [release 1.13.1](https://github.com/HumanSignal/label-studio/releases/tag/1.13.1) to SDK version 1.05, so I changed to `label-studio-sdk==1.0.5`, but it still doesn't work.

## Questions

Are PredictionValue and AnnotationValue supposed to be used not in this context? Did I do something wrong?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.