Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 2.6.0
* [#104](https://github.com/cohere-ai/cohere-python/pull/96)
* Remove experimental `moderate` api
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this be a major semver bump, since it is breaking with past versions that use moderate?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh unless we don't consider it breaking because the endpoint was experimental 🤔 -- pls disregard comment if so.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We haven't formalized it, but unofficially we talk about experimental APIs as pre-beta. That means that an experimental api can be pulled at any point without a version change


## 2.5.0
* [#96](https://github.com/cohere-ai/cohere-python/pull/96)
* The default `max_tokens` value is now configured on the backend
Expand Down
1 change: 0 additions & 1 deletion cohere/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
EMBED_URL = 'embed'
CLASSIFY_URL = 'classify'
EXTRACT_URL = 'extract'
MODERATE_URL= 'moderate'

CHECK_API_KEY_URL = 'check-api-key'
TOKENIZE_URL = 'tokenize'
Expand Down
17 changes: 0 additions & 17 deletions cohere/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
from cohere.extract import Example as ExtractExample
from cohere.extract import Extraction, Extractions
from cohere.generation import Generation, Generations, TokenLikelihood
from cohere.moderate import Moderation, Moderations
from cohere.tokenize import Tokens
from cohere.detokenize import Detokenization

Expand Down Expand Up @@ -193,22 +192,6 @@ def classify(

return Classifications(classifications)

def moderate(self, inputs: List[str], model: str = None, truncate: str = 'NONE') -> Moderations:
json_body = json.dumps({
'model': model,
'inputs': inputs,
'truncate': truncate,
})
response = self.__request(json_body, cohere.MODERATE_URL)

moderations = []
for res in response['results']:
moderations.append(
Moderation(res['profanity'], res['hate_speech'], res['violence'], res['self_harm'], res['sexual'],
res['sexual_non_consensual'], res['spam']))

return Moderations(moderations=moderations)

def unstable_extract(self, examples: List[ExtractExample], texts: List[str]) -> Extractions:
'''
Makes a request to the Cohere API to extract entities from a list of texts.
Expand Down
32 changes: 0 additions & 32 deletions cohere/moderate.py

This file was deleted.

18 changes: 0 additions & 18 deletions tests/test_moderate.py

This file was deleted.