Skip to content

Commit 155c6a9

Browse files
authored
fix: adding depracation warning to all TSMs, custom models and datasets (#223)
1 parent 5de5ae5 commit 155c6a9

15 files changed

+66
-0
lines changed

ai21/clients/sagemaker/resources/sagemaker_answer.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
from ai21.clients.common.answer_base import Answer
22
from ai21.clients.sagemaker.resources.sagemaker_resource import SageMakerResource, AsyncSageMakerResource
33
from ai21.models import AnswerResponse
4+
from ai21.version_utils import V3_DEPRECATION_MESSAGE, deprecated
45

56

67
class SageMakerAnswer(SageMakerResource, Answer):
8+
@deprecated(V3_DEPRECATION_MESSAGE)
79
def create(
810
self,
911
context: str,
@@ -17,6 +19,7 @@ def create(
1719

1820

1921
class AsyncSageMakerAnswer(AsyncSageMakerResource, Answer):
22+
@deprecated(V3_DEPRECATION_MESSAGE)
2023
async def create(
2124
self,
2225
context: str,

ai21/clients/sagemaker/resources/sagemaker_gec.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
from ai21.clients.common.gec_base import GEC
22
from ai21.clients.sagemaker.resources.sagemaker_resource import SageMakerResource, AsyncSageMakerResource
33
from ai21.models import GECResponse
4+
from ai21.version_utils import V3_DEPRECATION_MESSAGE, deprecated
45

56

67
class SageMakerGEC(SageMakerResource, GEC):
8+
@deprecated(V3_DEPRECATION_MESSAGE)
79
def create(self, text: str, **kwargs) -> GECResponse:
810
body = self._create_body(text=text)
911

@@ -13,6 +15,7 @@ def create(self, text: str, **kwargs) -> GECResponse:
1315

1416

1517
class AsyncSageMakerGEC(AsyncSageMakerResource, GEC):
18+
@deprecated(V3_DEPRECATION_MESSAGE)
1619
async def create(self, text: str, **kwargs) -> GECResponse:
1720
body = self._create_body(text=text)
1821

ai21/clients/sagemaker/resources/sagemaker_paraphrase.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
from ai21.clients.common.paraphrase_base import Paraphrase
44
from ai21.clients.sagemaker.resources.sagemaker_resource import SageMakerResource, AsyncSageMakerResource
55
from ai21.models import ParaphraseStyleType, ParaphraseResponse
6+
from ai21.version_utils import V3_DEPRECATION_MESSAGE, deprecated
67

78

89
class SageMakerParaphrase(SageMakerResource, Paraphrase):
10+
@deprecated(V3_DEPRECATION_MESSAGE)
911
def create(
1012
self,
1113
text: str,
@@ -27,6 +29,7 @@ def create(
2729

2830

2931
class AsyncSageMakerParaphrase(AsyncSageMakerResource, Paraphrase):
32+
@deprecated(V3_DEPRECATION_MESSAGE)
3033
async def create(
3134
self,
3235
text: str,

ai21/clients/sagemaker/resources/sagemaker_summarize.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
from ai21.clients.common.summarize_base import Summarize
66
from ai21.clients.sagemaker.resources.sagemaker_resource import SageMakerResource, AsyncSageMakerResource
77
from ai21.models import SummarizeResponse, SummaryMethod
8+
from ai21.version_utils import V3_DEPRECATION_MESSAGE, deprecated
89

910

1011
class SageMakerSummarize(SageMakerResource, Summarize):
12+
@deprecated(V3_DEPRECATION_MESSAGE)
1113
def create(
1214
self,
1315
source: str,
@@ -30,6 +32,7 @@ def create(
3032

3133

3234
class AsyncSageMakerSummarize(AsyncSageMakerResource, Summarize):
35+
@deprecated(V3_DEPRECATION_MESSAGE)
3336
async def create(
3437
self,
3538
source: str,

ai21/clients/studio/resources/studio_answer.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
from ai21.clients.common.answer_base import Answer
22
from ai21.clients.studio.resources.studio_resource import StudioResource, AsyncStudioResource
33
from ai21.models import AnswerResponse
4+
from ai21.version_utils import deprecated, V3_DEPRECATION_MESSAGE
45

56

67
class StudioAnswer(StudioResource, Answer):
8+
@deprecated(V3_DEPRECATION_MESSAGE)
79
def create(
810
self,
911
context: str,
@@ -16,6 +18,7 @@ def create(
1618

1719

1820
class AsyncStudioAnswer(AsyncStudioResource, Answer):
21+
@deprecated(V3_DEPRECATION_MESSAGE)
1922
async def create(
2023
self,
2124
context: str,

ai21/clients/studio/resources/studio_custom_model.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
from ai21.clients.common.custom_model_base import CustomModel
44
from ai21.clients.studio.resources.studio_resource import StudioResource, AsyncStudioResource
55
from ai21.models import CustomBaseModelResponse
6+
from ai21.version_utils import deprecated, V3_DEPRECATION_MESSAGE
67

78

89
class StudioCustomModel(StudioResource, CustomModel):
10+
@deprecated(V3_DEPRECATION_MESSAGE)
911
def create(
1012
self,
1113
dataset_id: str,
@@ -26,14 +28,17 @@ def create(
2628
)
2729
self._post(path=f"/{self._module_name}", body=body, response_cls=None)
2830

31+
@deprecated(V3_DEPRECATION_MESSAGE)
2932
def list(self) -> List[CustomBaseModelResponse]:
3033
return self._get(path=f"/{self._module_name}", response_cls=List[CustomBaseModelResponse])
3134

35+
@deprecated(V3_DEPRECATION_MESSAGE)
3236
def get(self, resource_id: str) -> CustomBaseModelResponse:
3337
return self._get(path=f"/{self._module_name}/{resource_id}", response_cls=CustomBaseModelResponse)
3438

3539

3640
class AsyncStudioCustomModel(AsyncStudioResource, CustomModel):
41+
@deprecated(V3_DEPRECATION_MESSAGE)
3742
async def create(
3843
self,
3944
dataset_id: str,
@@ -54,8 +59,10 @@ async def create(
5459
)
5560
await self._post(path=f"/{self._module_name}", body=body, response_cls=None)
5661

62+
@deprecated(V3_DEPRECATION_MESSAGE)
5763
async def list(self) -> List[CustomBaseModelResponse]:
5864
return await self._get(path=f"/{self._module_name}", response_cls=List[CustomBaseModelResponse])
5965

66+
@deprecated(V3_DEPRECATION_MESSAGE)
6067
async def get(self, resource_id: str) -> CustomBaseModelResponse:
6168
return await self._get(path=f"/{self._module_name}/{resource_id}", response_cls=CustomBaseModelResponse)

ai21/clients/studio/resources/studio_dataset.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
from ai21.clients.common.dataset_base import Dataset
44
from ai21.clients.studio.resources.studio_resource import StudioResource, AsyncStudioResource
55
from ai21.models import DatasetResponse
6+
from ai21.version_utils import V3_DEPRECATION_MESSAGE, deprecated
67

78

89
class StudioDataset(StudioResource, Dataset):
10+
@deprecated(V3_DEPRECATION_MESSAGE)
911
def create(
1012
self,
1113
file_path: str,
@@ -32,14 +34,17 @@ def create(
3234
files=files,
3335
)
3436

37+
@deprecated(V3_DEPRECATION_MESSAGE)
3538
def list(self) -> List[DatasetResponse]:
3639
return self._get(path=f"/{self._module_name}", response_cls=List[DatasetResponse])
3740

41+
@deprecated(V3_DEPRECATION_MESSAGE)
3842
def get(self, dataset_pid: str) -> DatasetResponse:
3943
return self._get(path=f"/{self._module_name}/{dataset_pid}", response_cls=DatasetResponse)
4044

4145

4246
class AsyncStudioDataset(AsyncStudioResource, Dataset):
47+
@deprecated(V3_DEPRECATION_MESSAGE)
4348
async def create(
4449
self,
4550
file_path: str,
@@ -67,8 +72,10 @@ async def create(
6772
files=files,
6873
)
6974

75+
@deprecated(V3_DEPRECATION_MESSAGE)
7076
async def list(self) -> List[DatasetResponse]:
7177
return await self._get(path=f"/{self._module_name}", response_cls=List[DatasetResponse])
7278

79+
@deprecated(V3_DEPRECATION_MESSAGE)
7380
async def get(self, dataset_pid: str) -> DatasetResponse:
7481
return await self._get(path=f"/{self._module_name}/{dataset_pid}", response_cls=DatasetResponse)

ai21/clients/studio/resources/studio_embed.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,19 @@
33
from ai21.clients.common.embed_base import Embed
44
from ai21.clients.studio.resources.studio_resource import StudioResource, AsyncStudioResource
55
from ai21.models import EmbedType, EmbedResponse
6+
from ai21.version_utils import V3_DEPRECATION_MESSAGE, deprecated
67

78

89
class StudioEmbed(StudioResource, Embed):
10+
@deprecated(V3_DEPRECATION_MESSAGE)
911
def create(self, texts: List[str], type: Optional[EmbedType] = None, **kwargs) -> EmbedResponse:
1012
body = self._create_body(texts=texts, type=type, **kwargs)
1113

1214
return self._post(path=f"/{self._module_name}", body=body, response_cls=EmbedResponse)
1315

1416

1517
class AsyncStudioEmbed(AsyncStudioResource, Embed):
18+
@deprecated(V3_DEPRECATION_MESSAGE)
1619
async def create(self, texts: List[str], type: Optional[EmbedType] = None, **kwargs) -> EmbedResponse:
1720
body = self._create_body(texts=texts, type=type, **kwargs)
1821

ai21/clients/studio/resources/studio_gec.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
from ai21.clients.common.gec_base import GEC
22
from ai21.clients.studio.resources.studio_resource import StudioResource, AsyncStudioResource
33
from ai21.models import GECResponse
4+
from ai21.version_utils import V3_DEPRECATION_MESSAGE, deprecated
45

56

67
class StudioGEC(StudioResource, GEC):
8+
@deprecated(V3_DEPRECATION_MESSAGE)
79
def create(self, text: str, **kwargs) -> GECResponse:
810
body = self._create_body(text=text, **kwargs)
911

1012
return self._post(path=f"/{self._module_name}", body=body, response_cls=GECResponse)
1113

1214

1315
class AsyncStudioGEC(AsyncStudioResource, GEC):
16+
@deprecated(V3_DEPRECATION_MESSAGE)
1417
async def create(self, text: str, **kwargs) -> GECResponse:
1518
body = self._create_body(text=text, **kwargs)
1619

ai21/clients/studio/resources/studio_improvements.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
from ai21.clients.common.improvements_base import Improvements
44
from ai21.clients.studio.resources.studio_resource import StudioResource, AsyncStudioResource
55
from ai21.models import ImprovementType, ImprovementsResponse
6+
from ai21.version_utils import V3_DEPRECATION_MESSAGE, deprecated
67

78

89
class StudioImprovements(StudioResource, Improvements):
10+
@deprecated(V3_DEPRECATION_MESSAGE)
911
def create(self, text: str, types: List[ImprovementType], **kwargs) -> ImprovementsResponse:
1012
self._validate_types(types)
1113

@@ -15,6 +17,7 @@ def create(self, text: str, types: List[ImprovementType], **kwargs) -> Improveme
1517

1618

1719
class AsyncStudioImprovements(AsyncStudioResource, Improvements):
20+
@deprecated(V3_DEPRECATION_MESSAGE)
1821
async def create(self, text: str, types: List[ImprovementType], **kwargs) -> ImprovementsResponse:
1922
self._validate_types(types)
2023

0 commit comments

Comments
 (0)