Skip to content

Commit 46a812c

Browse files
committed
feat(AssistantV2): regenerate based on current API def
1 parent a4311fb commit 46a812c

File tree

4 files changed

+11
-95
lines changed

4 files changed

+11
-95
lines changed

ibm_watson/assistant_v2.py

Lines changed: 5 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -1219,21 +1219,19 @@ class MessageContextSkill():
12191219
12201220
:attr dict user_defined: (optional) Arbitrary variables that can be read and
12211221
written by a particular skill.
1222-
:attr MessageContextSkillSystem system: (optional) System context data used by
1223-
the skill.
1222+
:attr dict system: (optional) System context data used by the skill.
12241223
"""
12251224

12261225
def __init__(self,
12271226
*,
12281227
user_defined: dict = None,
1229-
system: 'MessageContextSkillSystem' = None) -> None:
1228+
system: dict = None) -> None:
12301229
"""
12311230
Initialize a MessageContextSkill object.
12321231
12331232
:param dict user_defined: (optional) Arbitrary variables that can be read
12341233
and written by a particular skill.
1235-
:param MessageContextSkillSystem system: (optional) System context data
1236-
used by the skill.
1234+
:param dict system: (optional) System context data used by the skill.
12371235
"""
12381236
self.user_defined = user_defined
12391237
self.system = system
@@ -1251,8 +1249,7 @@ def from_dict(cls, _dict: Dict) -> 'MessageContextSkill':
12511249
if 'user_defined' in _dict:
12521250
args['user_defined'] = _dict.get('user_defined')
12531251
if 'system' in _dict:
1254-
args['system'] = MessageContextSkillSystem._from_dict(
1255-
_dict.get('system'))
1252+
args['system'] = _dict.get('system')
12561253
return cls(**args)
12571254

12581255
@classmethod
@@ -1266,7 +1263,7 @@ def to_dict(self) -> Dict:
12661263
if hasattr(self, 'user_defined') and self.user_defined is not None:
12671264
_dict['user_defined'] = self.user_defined
12681265
if hasattr(self, 'system') and self.system is not None:
1269-
_dict['system'] = self.system._to_dict()
1266+
_dict['system'] = self.system
12701267
return _dict
12711268

12721269
def _to_dict(self):
@@ -1288,89 +1285,6 @@ def __ne__(self, other: 'MessageContextSkill') -> bool:
12881285
return not self == other
12891286

12901287

1291-
class MessageContextSkillSystem():
1292-
"""
1293-
System context data used by the skill.
1294-
1295-
:attr str state: (optional) An encoded string representing the current
1296-
conversation state. By saving this value and then sending it in the context of a
1297-
subsequent message request, you can restore the conversation to the same state.
1298-
This can be useful if you need to return to an earlier point in the conversation
1299-
or resume a paused conversation after the session has expired.
1300-
"""
1301-
1302-
def __init__(self, *, state: str = None, **kwargs) -> None:
1303-
"""
1304-
Initialize a MessageContextSkillSystem object.
1305-
1306-
:param str state: (optional) An encoded string representing the current
1307-
conversation state. By saving this value and then sending it in the context
1308-
of a subsequent message request, you can restore the conversation to the
1309-
same state. This can be useful if you need to return to an earlier point in
1310-
the conversation or resume a paused conversation after the session has
1311-
expired.
1312-
:param **kwargs: (optional) Any additional properties.
1313-
"""
1314-
self.state = state
1315-
for _key, _value in kwargs.items():
1316-
setattr(self, _key, _value)
1317-
1318-
@classmethod
1319-
def from_dict(cls, _dict: Dict) -> 'MessageContextSkillSystem':
1320-
"""Initialize a MessageContextSkillSystem object from a json dictionary."""
1321-
args = {}
1322-
xtra = _dict.copy()
1323-
if 'state' in _dict:
1324-
args['state'] = _dict.get('state')
1325-
del xtra['state']
1326-
args.update(xtra)
1327-
return cls(**args)
1328-
1329-
@classmethod
1330-
def _from_dict(cls, _dict):
1331-
"""Initialize a MessageContextSkillSystem object from a json dictionary."""
1332-
return cls.from_dict(_dict)
1333-
1334-
def to_dict(self) -> Dict:
1335-
"""Return a json dictionary representing this model."""
1336-
_dict = {}
1337-
if hasattr(self, 'state') and self.state is not None:
1338-
_dict['state'] = self.state
1339-
if hasattr(self, '_additionalProperties'):
1340-
for _key in self._additionalProperties:
1341-
_value = getattr(self, _key, None)
1342-
if _value is not None:
1343-
_dict[_key] = _value
1344-
return _dict
1345-
1346-
def _to_dict(self):
1347-
"""Return a json dictionary representing this model."""
1348-
return self.to_dict()
1349-
1350-
def __setattr__(self, name: str, value: object) -> None:
1351-
properties = {'state'}
1352-
if not hasattr(self, '_additionalProperties'):
1353-
super(MessageContextSkillSystem,
1354-
self).__setattr__('_additionalProperties', set())
1355-
if name not in properties:
1356-
self._additionalProperties.add(name)
1357-
super(MessageContextSkillSystem, self).__setattr__(name, value)
1358-
1359-
def __str__(self) -> str:
1360-
"""Return a `str` version of this MessageContextSkillSystem object."""
1361-
return json.dumps(self._to_dict(), indent=2)
1362-
1363-
def __eq__(self, other: 'MessageContextSkillSystem') -> bool:
1364-
"""Return `true` when self and other are equal, false otherwise."""
1365-
if not isinstance(other, self.__class__):
1366-
return False
1367-
return self.__dict__ == other.__dict__
1368-
1369-
def __ne__(self, other: 'MessageContextSkillSystem') -> bool:
1370-
"""Return `true` when self and other are not equal, false otherwise."""
1371-
return not self == other
1372-
1373-
13741288
class MessageContextSkills():
13751289
"""
13761290
Information specific to particular skills used by the Assistant.

ibm_watson/speech_to_text_v1_adapter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ def recognize_using_websocket(self,
5353
audio_metrics=None,
5454
end_of_phrase_silence_time=None,
5555
split_transcript_at_phrase_end=None,
56-
speech_detector_sensitivity = None,
57-
background_audio_suppression = None,
56+
speech_detector_sensitivity=None,
57+
background_audio_suppression=None,
5858
**kwargs):
5959
"""
6060
Sends audio for speech recognition using web sockets.

ibm_watson/visual_recognition_v3.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,8 @@ def classify(self,
170170
form_data.append(('owners', (None, owners, 'text/plain')))
171171
if classifier_ids:
172172
classifier_ids = self._convert_list(classifier_ids)
173-
form_data.append(('classifier_ids', (None, classifier_ids, 'text/plain')))
173+
form_data.append(
174+
('classifier_ids', (None, classifier_ids, 'text/plain')))
174175

175176
url = '/v3/classify'
176177
request = self.prepare_request(method='POST',

ibm_watson/visual_recognition_v4.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,8 @@ def analyze(self,
138138

139139
form_data = []
140140
collection_ids = self._convert_list(collection_ids)
141-
form_data.append(('collection_ids', (None, collection_ids, 'text/plain')))
141+
form_data.append(
142+
('collection_ids', (None, collection_ids, 'text/plain')))
142143
features = self._convert_list(features)
143144
form_data.append(('features', (None, features, 'text/plain')))
144145
if images_file:

0 commit comments

Comments
 (0)