Skip to content

Commit 9954e59

Browse files
fix(nlu): fix listClassificationsModels response model
1 parent a598231 commit 9954e59

File tree

1 file changed

+46
-103
lines changed

1 file changed

+46
-103
lines changed

ibm_watson/natural_language_understanding_v1.py

Lines changed: 46 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# coding: utf-8
22

3-
# (C) Copyright IBM Corp. 2021.
3+
# (C) Copyright IBM Corp. 2017, 2021.
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
# IBM OpenAPI SDK Code Generator Version: 99-SNAPSHOT-902c9336-20210507-162723
17+
# IBM OpenAPI SDK Code Generator Version: 3.38.0-07189efd-20210827-205025
1818
"""
1919
Analyze various features of text content at scale. Provide text, raw HTML, or a public URL
2020
and IBM Watson Natural Language Understanding will give you results for the features you
@@ -24,6 +24,9 @@
2424
models](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-customizing)
2525
with Watson Knowledge Studio to detect custom entities and relations in Natural Language
2626
Understanding.
27+
28+
API Version: 1.0
29+
See: https://cloud.ibm.com/docs/natural-language-understanding
2730
"""
2831

2932
from datetime import datetime
@@ -59,7 +62,7 @@ def __init__(
5962
Construct a new client for the Natural Language Understanding service.
6063
6164
:param str version: Release date of the API version you want to use.
62-
Specify dates in YYYY-MM-DD format. The current version is `2021-03-25`.
65+
Specify dates in YYYY-MM-DD format. The current version is `2021-08-01`.
6366
6467
:param Authenticator authenticator: The authenticator specifies the authentication mechanism.
6568
Get up to date information from https://github.com/IBM/python-sdk-core/blob/master/README.md
@@ -182,7 +185,7 @@ def analyze(self,
182185
params=params,
183186
data=data)
184187

185-
response = self.send(request)
188+
response = self.send(request, **kwargs)
186189
return response
187190

188191
#########################
@@ -220,7 +223,7 @@ def list_models(self, **kwargs) -> DetailedResponse:
220223
headers=headers,
221224
params=params)
222225

223-
response = self.send(request)
226+
response = self.send(request, **kwargs)
224227
return response
225228

226229
def delete_model(self, model_id: str, **kwargs) -> DetailedResponse:
@@ -258,7 +261,7 @@ def delete_model(self, model_id: str, **kwargs) -> DetailedResponse:
258261
headers=headers,
259262
params=params)
260263

261-
response = self.send(request)
264+
response = self.send(request, **kwargs)
262265
return response
263266

264267
#########################
@@ -337,7 +340,7 @@ def create_sentiment_model(self,
337340
params=params,
338341
files=form_data)
339342

340-
response = self.send(request)
343+
response = self.send(request, **kwargs)
341344
return response
342345

343346
def list_sentiment_models(self, **kwargs) -> DetailedResponse:
@@ -369,7 +372,7 @@ def list_sentiment_models(self, **kwargs) -> DetailedResponse:
369372
headers=headers,
370373
params=params)
371374

372-
response = self.send(request)
375+
response = self.send(request, **kwargs)
373376
return response
374377

375378
def get_sentiment_model(self, model_id: str, **kwargs) -> DetailedResponse:
@@ -407,7 +410,7 @@ def get_sentiment_model(self, model_id: str, **kwargs) -> DetailedResponse:
407410
headers=headers,
408411
params=params)
409412

410-
response = self.send(request)
413+
response = self.send(request, **kwargs)
411414
return response
412415

413416
def update_sentiment_model(self,
@@ -488,7 +491,7 @@ def update_sentiment_model(self,
488491
params=params,
489492
files=form_data)
490493

491-
response = self.send(request)
494+
response = self.send(request, **kwargs)
492495
return response
493496

494497
def delete_sentiment_model(self, model_id: str,
@@ -528,7 +531,7 @@ def delete_sentiment_model(self, model_id: str,
528531
headers=headers,
529532
params=params)
530533

531-
response = self.send(request)
534+
response = self.send(request, **kwargs)
532535
return response
533536

534537
#########################
@@ -612,7 +615,7 @@ def create_categories_model(self,
612615
params=params,
613616
files=form_data)
614617

615-
response = self.send(request)
618+
response = self.send(request, **kwargs)
616619
return response
617620

618621
def list_categories_models(self, **kwargs) -> DetailedResponse:
@@ -644,7 +647,7 @@ def list_categories_models(self, **kwargs) -> DetailedResponse:
644647
headers=headers,
645648
params=params)
646649

647-
response = self.send(request)
650+
response = self.send(request, **kwargs)
648651
return response
649652

650653
def get_categories_model(self, model_id: str, **kwargs) -> DetailedResponse:
@@ -682,7 +685,7 @@ def get_categories_model(self, model_id: str, **kwargs) -> DetailedResponse:
682685
headers=headers,
683686
params=params)
684687

685-
response = self.send(request)
688+
response = self.send(request, **kwargs)
686689
return response
687690

688691
def update_categories_model(self,
@@ -768,7 +771,7 @@ def update_categories_model(self,
768771
params=params,
769772
files=form_data)
770773

771-
response = self.send(request)
774+
response = self.send(request, **kwargs)
772775
return response
773776

774777
def delete_categories_model(self, model_id: str,
@@ -808,7 +811,7 @@ def delete_categories_model(self, model_id: str,
808811
headers=headers,
809812
params=params)
810813

811-
response = self.send(request)
814+
response = self.send(request, **kwargs)
812815
return response
813816

814817
#########################
@@ -829,9 +832,9 @@ def create_classifications_model(self,
829832
"""
830833
Create classifications model.
831834
832-
(Beta) Creates a custom classifications model by uploading training data and
833-
associated metadata. The model begins the training and deploying process and is
834-
ready to use when the `status` is `available`.
835+
Creates a custom classifications model by uploading training data and associated
836+
metadata. The model begins the training and deploying process and is ready to use
837+
when the `status` is `available`.
835838
836839
:param str language: The 2-letter language code of this model.
837840
:param BinaryIO training_data: Training data in JSON format. For more
@@ -893,19 +896,18 @@ def create_classifications_model(self,
893896
params=params,
894897
files=form_data)
895898

896-
response = self.send(request)
899+
response = self.send(request, **kwargs)
897900
return response
898901

899902
def list_classifications_models(self, **kwargs) -> DetailedResponse:
900903
"""
901904
List classifications models.
902905
903-
(Beta) Returns all custom classifications models associated with this service
904-
instance.
906+
Returns all custom classifications models associated with this service instance.
905907
906908
:param dict headers: A `dict` containing the request headers
907909
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
908-
:rtype: DetailedResponse with `dict` result representing a `ListClassificationsModelsResponse` object
910+
:rtype: DetailedResponse with `dict` result representing a `ClassificationsModelList` object
909911
"""
910912

911913
headers = {}
@@ -927,15 +929,15 @@ def list_classifications_models(self, **kwargs) -> DetailedResponse:
927929
headers=headers,
928930
params=params)
929931

930-
response = self.send(request)
932+
response = self.send(request, **kwargs)
931933
return response
932934

933935
def get_classifications_model(self, model_id: str,
934936
**kwargs) -> DetailedResponse:
935937
"""
936938
Get classifications model details.
937939
938-
(Beta) Returns the status of the classifications model with the given model ID.
940+
Returns the status of the classifications model with the given model ID.
939941
940942
:param str model_id: ID of the model.
941943
:param dict headers: A `dict` containing the request headers
@@ -966,7 +968,7 @@ def get_classifications_model(self, model_id: str,
966968
headers=headers,
967969
params=params)
968970

969-
response = self.send(request)
971+
response = self.send(request, **kwargs)
970972
return response
971973

972974
def update_classifications_model(self,
@@ -984,8 +986,8 @@ def update_classifications_model(self,
984986
"""
985987
Update classifications model.
986988
987-
(Beta) Overwrites the training data associated with this custom classifications
988-
model and retrains the model. The new model replaces the current deployment.
989+
Overwrites the training data associated with this custom classifications model and
990+
retrains the model. The new model replaces the current deployment.
989991
990992
:param str model_id: ID of the model.
991993
:param str language: The 2-letter language code of this model.
@@ -1053,17 +1055,16 @@ def update_classifications_model(self,
10531055
params=params,
10541056
files=form_data)
10551057

1056-
response = self.send(request)
1058+
response = self.send(request, **kwargs)
10571059
return response
10581060

10591061
def delete_classifications_model(self, model_id: str,
10601062
**kwargs) -> DetailedResponse:
10611063
"""
10621064
Delete classifications model.
10631065
1064-
(Beta) Un-deploys the custom classifications model with the given model ID and
1065-
deletes all associated customer data, including any training data or binary
1066-
artifacts.
1066+
Un-deploys the custom classifications model with the given model ID and deletes
1067+
all associated customer data, including any training data or binary artifacts.
10671068
10681069
:param str model_id: ID of the model.
10691070
:param dict headers: A `dict` containing the request headers
@@ -1095,7 +1096,7 @@ def delete_classifications_model(self, model_id: str,
10951096
headers=headers,
10961097
params=params)
10971098

1098-
response = self.send(request)
1099+
response = self.send(request, **kwargs)
10991100
return response
11001101

11011102

@@ -1756,7 +1757,8 @@ def __ne__(self, other: 'CategoriesModelList') -> bool:
17561757

17571758
class CategoriesOptions():
17581759
"""
1759-
Returns a five-level taxonomy of the content. The top three categories are returned.
1760+
Returns a hierarchical taxonomy of the content. The top three categories are returned
1761+
by default.
17601762
Supported languages: Arabic, English, French, German, Italian, Japanese, Korean,
17611763
Portuguese, Spanish.
17621764
@@ -1897,7 +1899,7 @@ class CategoriesResult():
18971899
"""
18981900
A categorization of the analyzed text.
18991901
1900-
:attr str label: (optional) The path to the category through the 5-level
1902+
:attr str label: (optional) The path to the category through the multi-level
19011903
taxonomy hierarchy. For more information about the categories, see [Categories
19021904
hierarchy](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-categories#categories-hierarchy).
19031905
:attr float score: (optional) Confidence score for the category classification.
@@ -1914,9 +1916,9 @@ def __init__(self,
19141916
"""
19151917
Initialize a CategoriesResult object.
19161918
1917-
:param str label: (optional) The path to the category through the 5-level
1918-
taxonomy hierarchy. For more information about the categories, see
1919-
[Categories
1919+
:param str label: (optional) The path to the category through the
1920+
multi-level taxonomy hierarchy. For more information about the categories,
1921+
see [Categories
19201922
hierarchy](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-categories#categories-hierarchy).
19211923
:param float score: (optional) Confidence score for the category
19221924
classification. Higher values indicate greater confidence.
@@ -2305,7 +2307,7 @@ class ClassificationsOptions():
23052307
Returns text classifications for the content.
23062308
Supported languages: English only.
23072309
2308-
:attr str model: (optional) (Beta) Enter a [custom
2310+
:attr str model: (optional) Enter a [custom
23092311
model](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-customizing)
23102312
ID of the classification model to be used.
23112313
"""
@@ -2314,7 +2316,7 @@ def __init__(self, *, model: str = None) -> None:
23142316
"""
23152317
Initialize a ClassificationsOptions object.
23162318
2317-
:param str model: (optional) (Beta) Enter a [custom
2319+
:param str model: (optional) Enter a [custom
23182320
model](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-customizing)
23192321
ID of the classification model to be used.
23202322
"""
@@ -3485,8 +3487,8 @@ class Features():
34853487
:attr SummarizationOptions summarization: (optional) (Experimental) Returns a
34863488
summary of content.
34873489
Supported languages: English only.
3488-
:attr CategoriesOptions categories: (optional) Returns a five-level taxonomy of
3489-
the content. The top three categories are returned.
3490+
:attr CategoriesOptions categories: (optional) Returns a hierarchical taxonomy
3491+
of the content. The top three categories are returned by default.
34903492
Supported languages: Arabic, English, French, German, Italian, Japanese, Korean,
34913493
Portuguese, Spanish.
34923494
:attr SyntaxOptions syntax: (optional) Returns tokens and sentences from the
@@ -3558,8 +3560,8 @@ def __init__(self,
35583560
:param SummarizationOptions summarization: (optional) (Experimental)
35593561
Returns a summary of content.
35603562
Supported languages: English only.
3561-
:param CategoriesOptions categories: (optional) Returns a five-level
3562-
taxonomy of the content. The top three categories are returned.
3563+
:param CategoriesOptions categories: (optional) Returns a hierarchical
3564+
taxonomy of the content. The top three categories are returned by default.
35633565
Supported languages: Arabic, English, French, German, Italian, Japanese,
35643566
Korean, Portuguese, Spanish.
35653567
:param SyntaxOptions syntax: (optional) Returns tokens and sentences from
@@ -3990,65 +3992,6 @@ def __ne__(self, other: 'KeywordsResult') -> bool:
39903992
return not self == other
39913993

39923994

3993-
class ListClassificationsModelsResponse():
3994-
"""
3995-
ListClassificationsModelsResponse.
3996-
3997-
:attr List[ClassificationsModelList] models: (optional)
3998-
"""
3999-
4000-
def __init__(self,
4001-
*,
4002-
models: List['ClassificationsModelList'] = None) -> None:
4003-
"""
4004-
Initialize a ListClassificationsModelsResponse object.
4005-
4006-
:param List[ClassificationsModelList] models: (optional)
4007-
"""
4008-
self.models = models
4009-
4010-
@classmethod
4011-
def from_dict(cls, _dict: Dict) -> 'ListClassificationsModelsResponse':
4012-
"""Initialize a ListClassificationsModelsResponse object from a json dictionary."""
4013-
args = {}
4014-
if 'models' in _dict:
4015-
args['models'] = [
4016-
ClassificationsModelList.from_dict(x)
4017-
for x in _dict.get('models')
4018-
]
4019-
return cls(**args)
4020-
4021-
@classmethod
4022-
def _from_dict(cls, _dict):
4023-
"""Initialize a ListClassificationsModelsResponse object from a json dictionary."""
4024-
return cls.from_dict(_dict)
4025-
4026-
def to_dict(self) -> Dict:
4027-
"""Return a json dictionary representing this model."""
4028-
_dict = {}
4029-
if hasattr(self, 'models') and self.models is not None:
4030-
_dict['models'] = [x.to_dict() for x in self.models]
4031-
return _dict
4032-
4033-
def _to_dict(self):
4034-
"""Return a json dictionary representing this model."""
4035-
return self.to_dict()
4036-
4037-
def __str__(self) -> str:
4038-
"""Return a `str` version of this ListClassificationsModelsResponse object."""
4039-
return json.dumps(self.to_dict(), indent=2)
4040-
4041-
def __eq__(self, other: 'ListClassificationsModelsResponse') -> bool:
4042-
"""Return `true` when self and other are equal, false otherwise."""
4043-
if not isinstance(other, self.__class__):
4044-
return False
4045-
return self.__dict__ == other.__dict__
4046-
4047-
def __ne__(self, other: 'ListClassificationsModelsResponse') -> bool:
4048-
"""Return `true` when self and other are not equal, false otherwise."""
4049-
return not self == other
4050-
4051-
40523995
class ListModelsResults():
40533996
"""
40543997
Custom models that are available for entities and relations.

0 commit comments

Comments
 (0)