-
Notifications
You must be signed in to change notification settings - Fork 80
Add support for multilabel classification #324
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
Conversation
e1c27dd to
634c298
Compare
cohere/responses/classify.py
Outdated
| self.input = input | ||
| self.prediction = prediction | ||
| self.confidence = confidence | ||
| self.prediction = prediction # to be deprecated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how do you expect to deprecate this field in the future?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lfayoux You're probably better positioned to answer this question than me. I'm not sure what the standard procedure is for field deprecation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be deprecated when we do an api version change. Not sure if we still want to support this field in the future
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about the following?
@property
def prediction(self):
print("your deprecation warning here")
return self.prediction
After a couple of release you can remove it altogether
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Took that into account
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely no print calls, we have logger for that.
@mkozakov could you comment on versioning and if the above is an acceptable way to have breaking api and sdk changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logging warnings for now is ok. when we deprecate we will need to bump the major SDK version
sanderland
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a test that covers this, add to changelog, and bump the minor version
|
@sanderland I implemented all your requested changes 👍. For the tests it is not possible to use a real co.classify() call as it would require to finetune a model first (which takes ~30min). Instead, I mocked the |
cohere/responses/classify.py
Outdated
|
|
||
| if self._prediction is None or self._confidence is None: | ||
| if self._prediction is not None or self._confidence is not None: | ||
| raise ValueError("Cannot have one of prediction and confidence be None and not the other one") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| raise ValueError("Cannot have one of prediction and confidence be None and not the other one") | |
| raise ValueError("Cannot have one of `prediction` and `confidence` be `None` and not the other one") |
cohere/responses/classify.py
Outdated
| self.input = input | ||
| self.prediction = prediction | ||
| self.confidence = confidence | ||
| self.prediction = prediction # to be deprecated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logging warnings for now is ok. when we deprecate we will need to bump the major SDK version
acba0ea to
da18bbc
Compare
* add support for multilabel * address comments * replace mocker with monkeypatch * print -> log * address comment * remove ambiguity in comments
predictionsandconfidences. Add support for these fields.predictionandconfidencefields. Mark these fields as optional.predictionandconfidencefields will eventually be removed. Add "to be deprecated" comments.Important note: this PR does not introduce any breaking change.