Skip to content

Commit b1b3744

Browse files
refactor(assistantv2): update model names
1 parent 65b749b commit b1b3744

File tree

6 files changed

+178
-160
lines changed

6 files changed

+178
-160
lines changed

ibm_watson/assistant_v1.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -674,8 +674,8 @@ def create_workspace_async(
674674
workspace components defining the content of the new workspace.
675675
A successful call to this method only initiates asynchronous creation of the
676676
workspace. The new workspace is not available until processing completes. To check
677-
the status of the asynchronous operation, use the **Export workspace
678-
asynchronously** method.
677+
the status of the asynchronous operation, use the **Get information about a
678+
workspace** method.
679679

680680
:param str name: (optional) The name of the workspace. This string cannot
681681
contain carriage return, newline, or tab characters.
@@ -781,8 +781,8 @@ def update_workspace_async(
781781
provide component objects defining the content of the updated workspace.
782782
A successful call to this method only initiates an asynchronous update of the
783783
workspace. The updated workspace is not available until processing completes. To
784-
check the status of the asynchronous operation, use the **Export workspace
785-
asynchronously** method.
784+
check the status of the asynchronous operation, use the **Get information about a
785+
workspace** method.
786786

787787
:param str workspace_id: Unique identifier of the workspace.
788788
:param str name: (optional) The name of the workspace. This string cannot
@@ -10519,11 +10519,9 @@ class Workspace():
1051910519
:attr str status: (optional) The current status of the workspace:
1052010520
- **Available**: The workspace is available and ready to process messages.
1052110521
- **Failed**: An asynchronous operation has failed. See the **status_errors**
10522-
property for more information about the cause of the failure. Returned only by
10523-
the **Export workspace asynchronously** method.
10522+
property for more information about the cause of the failure.
1052410523
- **Non Existent**: The workspace does not exist.
10525-
- **Processing**: An asynchronous operation has not yet completed. Returned
10526-
only by the **Export workspace asynchronously** method.
10524+
- **Processing**: An asynchronous operation has not yet completed.
1052710525
- **Training**: The workspace is training based on new data such as intents or
1052810526
examples.
1052910527
:attr List[StatusError] status_errors: (optional) An array of messages about
@@ -10778,11 +10776,9 @@ class StatusEnum(str, Enum):
1077810776
The current status of the workspace:
1077910777
- **Available**: The workspace is available and ready to process messages.
1078010778
- **Failed**: An asynchronous operation has failed. See the **status_errors**
10781-
property for more information about the cause of the failure. Returned only by the
10782-
**Export workspace asynchronously** method.
10779+
property for more information about the cause of the failure.
1078310780
- **Non Existent**: The workspace does not exist.
10784-
- **Processing**: An asynchronous operation has not yet completed. Returned only
10785-
by the **Export workspace asynchronously** method.
10781+
- **Processing**: An asynchronous operation has not yet completed.
1078610782
- **Training**: The workspace is training based on new data such as intents or
1078710783
examples.
1078810784
"""

ibm_watson/assistant_v2.py

Lines changed: 97 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def create_assistant(self,
100100
string cannot contain carriage return, newline, or tab characters.
101101
:param dict headers: A `dict` containing the request headers
102102
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
103-
:rtype: DetailedResponse with `dict` result representing a `Assistant` object
103+
:rtype: DetailedResponse with `dict` result representing a `AssistantData` object
104104
"""
105105

106106
headers = {}
@@ -1865,9 +1865,94 @@ def __ne__(self, other: 'AgentAvailabilityMessage') -> bool:
18651865
return not self == other
18661866

18671867

1868-
class Assistant():
1868+
class AssistantCollection():
1869+
"""
1870+
AssistantCollection.
1871+
1872+
:attr List[AssistantData] assistants: An array of objects describing the
1873+
assistants associated with the instance.
1874+
:attr Pagination pagination: The pagination data for the returned objects. For
1875+
more information about using pagination, see [Pagination](#pagination).
18691876
"""
1870-
Assistant.
1877+
1878+
def __init__(self, assistants: List['AssistantData'],
1879+
pagination: 'Pagination') -> None:
1880+
"""
1881+
Initialize a AssistantCollection object.
1882+
1883+
:param List[AssistantData] assistants: An array of objects describing the
1884+
assistants associated with the instance.
1885+
:param Pagination pagination: The pagination data for the returned objects.
1886+
For more information about using pagination, see [Pagination](#pagination).
1887+
"""
1888+
self.assistants = assistants
1889+
self.pagination = pagination
1890+
1891+
@classmethod
1892+
def from_dict(cls, _dict: Dict) -> 'AssistantCollection':
1893+
"""Initialize a AssistantCollection object from a json dictionary."""
1894+
args = {}
1895+
if 'assistants' in _dict:
1896+
args['assistants'] = [
1897+
AssistantData.from_dict(v) for v in _dict.get('assistants')
1898+
]
1899+
else:
1900+
raise ValueError(
1901+
'Required property \'assistants\' not present in AssistantCollection JSON'
1902+
)
1903+
if 'pagination' in _dict:
1904+
args['pagination'] = Pagination.from_dict(_dict.get('pagination'))
1905+
else:
1906+
raise ValueError(
1907+
'Required property \'pagination\' not present in AssistantCollection JSON'
1908+
)
1909+
return cls(**args)
1910+
1911+
@classmethod
1912+
def _from_dict(cls, _dict):
1913+
"""Initialize a AssistantCollection object from a json dictionary."""
1914+
return cls.from_dict(_dict)
1915+
1916+
def to_dict(self) -> Dict:
1917+
"""Return a json dictionary representing this model."""
1918+
_dict = {}
1919+
if hasattr(self, 'assistants') and self.assistants is not None:
1920+
assistants_list = []
1921+
for v in self.assistants:
1922+
if isinstance(v, dict):
1923+
assistants_list.append(v)
1924+
else:
1925+
assistants_list.append(v.to_dict())
1926+
_dict['assistants'] = assistants_list
1927+
if hasattr(self, 'pagination') and self.pagination is not None:
1928+
if isinstance(self.pagination, dict):
1929+
_dict['pagination'] = self.pagination
1930+
else:
1931+
_dict['pagination'] = self.pagination.to_dict()
1932+
return _dict
1933+
1934+
def _to_dict(self):
1935+
"""Return a json dictionary representing this model."""
1936+
return self.to_dict()
1937+
1938+
def __str__(self) -> str:
1939+
"""Return a `str` version of this AssistantCollection object."""
1940+
return json.dumps(self.to_dict(), indent=2)
1941+
1942+
def __eq__(self, other: 'AssistantCollection') -> bool:
1943+
"""Return `true` when self and other are equal, false otherwise."""
1944+
if not isinstance(other, self.__class__):
1945+
return False
1946+
return self.__dict__ == other.__dict__
1947+
1948+
def __ne__(self, other: 'AssistantCollection') -> bool:
1949+
"""Return `true` when self and other are not equal, false otherwise."""
1950+
return not self == other
1951+
1952+
1953+
class AssistantData():
1954+
"""
1955+
AssistantData.
18711956

18721957
:attr str assistant_id: (optional) The unique identifier of the assistant.
18731958
:attr str name: (optional) The name of the assistant. This string cannot contain
@@ -1892,7 +1977,7 @@ def __init__(
18921977
assistant_environments: List['EnvironmentReference'] = None
18931978
) -> None:
18941979
"""
1895-
Initialize a Assistant object.
1980+
Initialize a AssistantData object.
18961981

18971982
:param str language: The language of the assistant.
18981983
:param str name: (optional) The name of the assistant. This string cannot
@@ -1908,8 +1993,8 @@ def __init__(
19081993
self.assistant_environments = assistant_environments
19091994

19101995
@classmethod
1911-
def from_dict(cls, _dict: Dict) -> 'Assistant':
1912-
"""Initialize a Assistant object from a json dictionary."""
1996+
def from_dict(cls, _dict: Dict) -> 'AssistantData':
1997+
"""Initialize a AssistantData object from a json dictionary."""
19131998
args = {}
19141999
if 'assistant_id' in _dict:
19152000
args['assistant_id'] = _dict.get('assistant_id')
@@ -1921,7 +2006,8 @@ def from_dict(cls, _dict: Dict) -> 'Assistant':
19212006
args['language'] = _dict.get('language')
19222007
else:
19232008
raise ValueError(
1924-
'Required property \'language\' not present in Assistant JSON')
2009+
'Required property \'language\' not present in AssistantData JSON'
2010+
)
19252011
if 'assistant_skills' in _dict:
19262012
args['assistant_skills'] = [
19272013
AssistantSkill.from_dict(v)
@@ -1936,7 +2022,7 @@ def from_dict(cls, _dict: Dict) -> 'Assistant':
19362022

19372023
@classmethod
19382024
def _from_dict(cls, _dict):
1939-
"""Initialize a Assistant object from a json dictionary."""
2025+
"""Initialize a AssistantData object from a json dictionary."""
19402026
return cls.from_dict(_dict)
19412027

19422028
def to_dict(self) -> Dict:
@@ -1976,101 +2062,16 @@ def _to_dict(self):
19762062
return self.to_dict()
19772063

19782064
def __str__(self) -> str:
1979-
"""Return a `str` version of this Assistant object."""
2065+
"""Return a `str` version of this AssistantData object."""
19802066
return json.dumps(self.to_dict(), indent=2)
19812067

1982-
def __eq__(self, other: 'Assistant') -> bool:
2068+
def __eq__(self, other: 'AssistantData') -> bool:
19832069
"""Return `true` when self and other are equal, false otherwise."""
19842070
if not isinstance(other, self.__class__):
19852071
return False
19862072
return self.__dict__ == other.__dict__
19872073

1988-
def __ne__(self, other: 'Assistant') -> bool:
1989-
"""Return `true` when self and other are not equal, false otherwise."""
1990-
return not self == other
1991-
1992-
1993-
class AssistantCollection():
1994-
"""
1995-
AssistantCollection.
1996-
1997-
:attr List[Assistant] assistants: An array of objects describing the assistants
1998-
associated with the instance.
1999-
:attr Pagination pagination: The pagination data for the returned objects. For
2000-
more information about using pagination, see [Pagination](#pagination).
2001-
"""
2002-
2003-
def __init__(self, assistants: List['Assistant'],
2004-
pagination: 'Pagination') -> None:
2005-
"""
2006-
Initialize a AssistantCollection object.
2007-
2008-
:param List[Assistant] assistants: An array of objects describing the
2009-
assistants associated with the instance.
2010-
:param Pagination pagination: The pagination data for the returned objects.
2011-
For more information about using pagination, see [Pagination](#pagination).
2012-
"""
2013-
self.assistants = assistants
2014-
self.pagination = pagination
2015-
2016-
@classmethod
2017-
def from_dict(cls, _dict: Dict) -> 'AssistantCollection':
2018-
"""Initialize a AssistantCollection object from a json dictionary."""
2019-
args = {}
2020-
if 'assistants' in _dict:
2021-
args['assistants'] = [
2022-
Assistant.from_dict(v) for v in _dict.get('assistants')
2023-
]
2024-
else:
2025-
raise ValueError(
2026-
'Required property \'assistants\' not present in AssistantCollection JSON'
2027-
)
2028-
if 'pagination' in _dict:
2029-
args['pagination'] = Pagination.from_dict(_dict.get('pagination'))
2030-
else:
2031-
raise ValueError(
2032-
'Required property \'pagination\' not present in AssistantCollection JSON'
2033-
)
2034-
return cls(**args)
2035-
2036-
@classmethod
2037-
def _from_dict(cls, _dict):
2038-
"""Initialize a AssistantCollection object from a json dictionary."""
2039-
return cls.from_dict(_dict)
2040-
2041-
def to_dict(self) -> Dict:
2042-
"""Return a json dictionary representing this model."""
2043-
_dict = {}
2044-
if hasattr(self, 'assistants') and self.assistants is not None:
2045-
assistants_list = []
2046-
for v in self.assistants:
2047-
if isinstance(v, dict):
2048-
assistants_list.append(v)
2049-
else:
2050-
assistants_list.append(v.to_dict())
2051-
_dict['assistants'] = assistants_list
2052-
if hasattr(self, 'pagination') and self.pagination is not None:
2053-
if isinstance(self.pagination, dict):
2054-
_dict['pagination'] = self.pagination
2055-
else:
2056-
_dict['pagination'] = self.pagination.to_dict()
2057-
return _dict
2058-
2059-
def _to_dict(self):
2060-
"""Return a json dictionary representing this model."""
2061-
return self.to_dict()
2062-
2063-
def __str__(self) -> str:
2064-
"""Return a `str` version of this AssistantCollection object."""
2065-
return json.dumps(self.to_dict(), indent=2)
2066-
2067-
def __eq__(self, other: 'AssistantCollection') -> bool:
2068-
"""Return `true` when self and other are equal, false otherwise."""
2069-
if not isinstance(other, self.__class__):
2070-
return False
2071-
return self.__dict__ == other.__dict__
2072-
2073-
def __ne__(self, other: 'AssistantCollection') -> bool:
2074+
def __ne__(self, other: 'AssistantData') -> bool:
20742075
"""Return `true` when self and other are not equal, false otherwise."""
20752076
return not self == other
20762077

ibm_watson/natural_language_understanding_v1.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@
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+
IBM is sunsetting Watson Natural Language Understanding Custom Sentiment (BETA). From
28+
**June 1, 2023** onward, you will no longer be able to use the Custom Sentiment
29+
feature.<br /><br />To ensure we continue providing our clients with robust and powerful
30+
text classification capabilities, IBM recently announced the general availability of a new
31+
[single-label text classification
32+
capability](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-classifications).
33+
This new feature includes extended language support and training data customizations
34+
suited for building a custom sentiment classifier.<br /><br />If you would like more
35+
information or further guidance, please contact IBM Cloud Support.{: deprecated}
2736
2837
API Version: 1.0
2938
See: https://cloud.ibm.com/docs/natural-language-understanding

ibm_watson/speech_to_text_v1.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1700,11 +1700,17 @@ def train_language_model(self,
17001700
fields. A status of `available` means that the custom model is trained and ready
17011701
to use. The service cannot accept subsequent training requests or requests to add
17021702
new resources until the existing request completes.
1703+
For custom models that are based on improved base language models, training also
1704+
performs an automatic upgrade to a newer version of the base model. You do not
1705+
need to use the [Upgrade a custom language model](#upgradelanguagemodel) method to
1706+
perform the upgrade.
17031707
**See also:**
1704-
* [Train the custom language
1705-
model](https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-languageCreate#trainModel-language)
17061708
* [Language support for
17071709
customization](https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-custom-support)
1710+
* [Train the custom language
1711+
model](https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-languageCreate#trainModel-language)
1712+
* [Upgrading custom language models that are based on improved next-generation
1713+
models](https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-custom-upgrade#custom-upgrade-language-ng)
17081714
### Training failures
17091715
Training can fail to start for the following reasons:
17101716
* The service is currently handling another request for the custom model, such as
@@ -1862,11 +1868,17 @@ def upgrade_language_model(self, customization_id: str,
18621868
upgrade is complete, the model resumes the status that it had prior to upgrade.
18631869
The service cannot accept subsequent requests for the model until the upgrade
18641870
completes.
1871+
For custom models that are based on improved base language models, the [Train a
1872+
custom language model](#trainlanguagemodel) method also performs an automatic
1873+
upgrade to a newer version of the base model. You do not need to use the upgrade
1874+
method.
18651875
**See also:**
1876+
* [Language support for
1877+
customization](https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-custom-support)
18661878
* [Upgrading a custom language
18671879
model](https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-custom-upgrade#custom-upgrade-language)
1868-
* [Language support for
1869-
customization](https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-custom-support).
1880+
* [Upgrading custom language models that are based on improved next-generation
1881+
models](https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-custom-upgrade#custom-upgrade-language-ng).
18701882
18711883
:param str customization_id: The customization ID (GUID) of the custom
18721884
language model that is to be used for the request. You must make the

0 commit comments

Comments
 (0)