Skip to content

Commit e9ea20c

Browse files
committed
feat: regenerate services using current API def
1 parent 9aa13e9 commit e9ea20c

12 files changed

+582
-207
lines changed

ibm_watson/assistant_v1.py

Lines changed: 115 additions & 20 deletions
Large diffs are not rendered by default.

ibm_watson/assistant_v2.py

Lines changed: 133 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1219,17 +1219,21 @@ class MessageContextSkill():
12191219
12201220
:attr dict user_defined: (optional) Arbitrary variables that can be read and
12211221
written by a particular skill.
1222-
:attr dict system: (optional) For internal use only.
1222+
:attr MessageContextSkillSystem system: (optional) System context data used by
1223+
the skill.
12231224
"""
12241225

1225-
def __init__(self, *, user_defined: dict = None,
1226-
system: dict = None) -> None:
1226+
def __init__(self,
1227+
*,
1228+
user_defined: dict = None,
1229+
system: 'MessageContextSkillSystem' = None) -> None:
12271230
"""
12281231
Initialize a MessageContextSkill object.
12291232
12301233
:param dict user_defined: (optional) Arbitrary variables that can be read
12311234
and written by a particular skill.
1232-
:param dict system: (optional) For internal use only.
1235+
:param MessageContextSkillSystem system: (optional) System context data
1236+
used by the skill.
12331237
"""
12341238
self.user_defined = user_defined
12351239
self.system = system
@@ -1247,7 +1251,8 @@ def from_dict(cls, _dict: Dict) -> 'MessageContextSkill':
12471251
if 'user_defined' in _dict:
12481252
args['user_defined'] = _dict.get('user_defined')
12491253
if 'system' in _dict:
1250-
args['system'] = _dict.get('system')
1254+
args['system'] = MessageContextSkillSystem._from_dict(
1255+
_dict.get('system'))
12511256
return cls(**args)
12521257

12531258
@classmethod
@@ -1261,7 +1266,7 @@ def to_dict(self) -> Dict:
12611266
if hasattr(self, 'user_defined') and self.user_defined is not None:
12621267
_dict['user_defined'] = self.user_defined
12631268
if hasattr(self, 'system') and self.system is not None:
1264-
_dict['system'] = self.system
1269+
_dict['system'] = self.system._to_dict()
12651270
return _dict
12661271

12671272
def _to_dict(self):
@@ -1283,6 +1288,89 @@ def __ne__(self, other: 'MessageContextSkill') -> bool:
12831288
return not self == other
12841289

12851290

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+
12861374
class MessageContextSkills():
12871375
"""
12881376
Information specific to particular skills used by the Assistant.
@@ -1488,49 +1576,68 @@ class MessageInputOptions():
14881576
Optional properties that control how the assistant responds.
14891577
14901578
:attr bool debug: (optional) Whether to return additional diagnostic
1491-
information. Set to `true` to return additional information under the
1492-
`output.debug` key.
1579+
information. Set to `true` to return additional information in the
1580+
`output.debug` property. If you also specify **return_context**=`true`, the
1581+
returned skill context includes the `system.state` property.
14931582
:attr bool restart: (optional) Whether to restart dialog processing at the root
14941583
of the dialog, regardless of any previously visited nodes. **Note:** This does
14951584
not affect `turn_count` or any other context variables.
14961585
:attr bool alternate_intents: (optional) Whether to return more than one intent.
14971586
Set to `true` to return all matching intents.
14981587
:attr bool return_context: (optional) Whether to return session context with the
1499-
response. If you specify `true`, the response will include the `context`
1500-
property.
1588+
response. If you specify `true`, the response includes the `context` property.
1589+
If you also specify **debug**=`true`, the returned skill context includes the
1590+
`system.state` property.
1591+
:attr bool export: (optional) Whether to return session context, including full
1592+
conversation state. If you specify `true`, the response includes the `context`
1593+
property, and the skill context includes the `system.state` property.
1594+
**Note:** If **export**=`true`, the context is returned regardless of the value
1595+
of **return_context**.
15011596
"""
15021597

15031598
def __init__(self,
15041599
*,
15051600
debug: bool = None,
15061601
restart: bool = None,
15071602
alternate_intents: bool = None,
1508-
return_context: bool = None) -> None:
1603+
return_context: bool = None,
1604+
export: bool = None) -> None:
15091605
"""
15101606
Initialize a MessageInputOptions object.
15111607
15121608
:param bool debug: (optional) Whether to return additional diagnostic
1513-
information. Set to `true` to return additional information under the
1514-
`output.debug` key.
1609+
information. Set to `true` to return additional information in the
1610+
`output.debug` property. If you also specify **return_context**=`true`, the
1611+
returned skill context includes the `system.state` property.
15151612
:param bool restart: (optional) Whether to restart dialog processing at the
15161613
root of the dialog, regardless of any previously visited nodes. **Note:**
15171614
This does not affect `turn_count` or any other context variables.
15181615
:param bool alternate_intents: (optional) Whether to return more than one
15191616
intent. Set to `true` to return all matching intents.
15201617
:param bool return_context: (optional) Whether to return session context
1521-
with the response. If you specify `true`, the response will include the
1522-
`context` property.
1618+
with the response. If you specify `true`, the response includes the
1619+
`context` property. If you also specify **debug**=`true`, the returned
1620+
skill context includes the `system.state` property.
1621+
:param bool export: (optional) Whether to return session context, including
1622+
full conversation state. If you specify `true`, the response includes the
1623+
`context` property, and the skill context includes the `system.state`
1624+
property.
1625+
**Note:** If **export**=`true`, the context is returned regardless of the
1626+
value of **return_context**.
15231627
"""
15241628
self.debug = debug
15251629
self.restart = restart
15261630
self.alternate_intents = alternate_intents
15271631
self.return_context = return_context
1632+
self.export = export
15281633

15291634
@classmethod
15301635
def from_dict(cls, _dict: Dict) -> 'MessageInputOptions':
15311636
"""Initialize a MessageInputOptions object from a json dictionary."""
15321637
args = {}
1533-
valid_keys = ['debug', 'restart', 'alternate_intents', 'return_context']
1638+
valid_keys = [
1639+
'debug', 'restart', 'alternate_intents', 'return_context', 'export'
1640+
]
15341641
bad_keys = set(_dict.keys()) - set(valid_keys)
15351642
if bad_keys:
15361643
raise ValueError(
@@ -1544,6 +1651,8 @@ def from_dict(cls, _dict: Dict) -> 'MessageInputOptions':
15441651
args['alternate_intents'] = _dict.get('alternate_intents')
15451652
if 'return_context' in _dict:
15461653
args['return_context'] = _dict.get('return_context')
1654+
if 'export' in _dict:
1655+
args['export'] = _dict.get('export')
15471656
return cls(**args)
15481657

15491658
@classmethod
@@ -1563,6 +1672,8 @@ def to_dict(self) -> Dict:
15631672
_dict['alternate_intents'] = self.alternate_intents
15641673
if hasattr(self, 'return_context') and self.return_context is not None:
15651674
_dict['return_context'] = self.return_context
1675+
if hasattr(self, 'export') and self.export is not None:
1676+
_dict['export'] = self.export
15661677
return _dict
15671678

15681679
def _to_dict(self):
@@ -1836,8 +1947,8 @@ class MessageResponse():
18361947
18371948
:attr MessageOutput output: Assistant output to be rendered or processed by the
18381949
client.
1839-
:attr MessageContext context: (optional) State information for the conversation.
1840-
The context is stored by the assistant on a per-session basis. You can use this
1950+
:attr MessageContext context: (optional) Context data for the conversation. The
1951+
context is stored by the assistant on a per-session basis. You can use this
18411952
property to access context variables.
18421953
**Note:** The context is included in message responses only if
18431954
**return_context**=`true` in the message request.
@@ -1852,7 +1963,7 @@ def __init__(self,
18521963
18531964
:param MessageOutput output: Assistant output to be rendered or processed
18541965
by the client.
1855-
:param MessageContext context: (optional) State information for the
1966+
:param MessageContext context: (optional) Context data for the
18561967
conversation. The context is stored by the assistant on a per-session
18571968
basis. You can use this property to access context variables.
18581969
**Note:** The context is included in message responses only if
@@ -3191,7 +3302,9 @@ class SearchResultMetadata():
31913302
indicates a greater match to the query parameters.
31923303
"""
31933304

3194-
def __init__(self, *, confidence: float = None,
3305+
def __init__(self,
3306+
*,
3307+
confidence: float = None,
31953308
score: float = None) -> None:
31963309
"""
31973310
Initialize a SearchResultMetadata object.

ibm_watson/compare_comply_v1.py

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,10 @@ def list_feedback(self,
487487
response = self.send(request)
488488
return response
489489

490-
def get_feedback(self, feedback_id: str, *, model: str = None,
490+
def get_feedback(self,
491+
feedback_id: str,
492+
*,
493+
model: str = None,
491494
**kwargs) -> 'DetailedResponse':
492495
"""
493496
Get a specified feedback entry.
@@ -528,7 +531,10 @@ def get_feedback(self, feedback_id: str, *, model: str = None,
528531
response = self.send(request)
529532
return response
530533

531-
def delete_feedback(self, feedback_id: str, *, model: str = None,
534+
def delete_feedback(self,
535+
feedback_id: str,
536+
*,
537+
model: str = None,
532538
**kwargs) -> 'DetailedResponse':
533539
"""
534540
Delete a specified feedback entry.
@@ -589,10 +595,10 @@ def create_batch(self,
589595
590596
Run Compare and Comply methods over a collection of input documents.
591597
**Important:** Batch processing requires the use of the [IBM Cloud Object Storage
592-
service](https://cloud.ibm.com/docs/services/cloud-object-storage?topic=cloud-object-storage-about#about-ibm-cloud-object-storage).
598+
service](https://cloud.ibm.com/docs/cloud-object-storage?topic=cloud-object-storage-about#about-ibm-cloud-object-storage).
593599
The use of IBM Cloud Object Storage with Compare and Comply is discussed at [Using
594600
batch
595-
processing](https://cloud.ibm.com/docs/services/compare-comply?topic=compare-comply-batching#before-you-batch).
601+
processing](https://cloud.ibm.com/docs/compare-comply?topic=compare-comply-batching#before-you-batch).
596602
597603
:param str function: The Compare and Comply method to run across the
598604
submitted input documents.
@@ -996,7 +1002,9 @@ class Address():
9961002
`end`.
9971003
"""
9981004

999-
def __init__(self, *, text: str = None,
1005+
def __init__(self,
1006+
*,
1007+
text: str = None,
10001008
location: 'Location' = None) -> None:
10011009
"""
10021010
Initialize a Address object.
@@ -1725,7 +1733,9 @@ class Category():
17251733
IBM to provide feedback or receive support.
17261734
"""
17271735

1728-
def __init__(self, *, label: str = None,
1736+
def __init__(self,
1737+
*,
1738+
label: str = None,
17291739
provenance_ids: List[str] = None) -> None:
17301740
"""
17311741
Initialize a Category object.
@@ -2502,7 +2512,9 @@ class Contexts():
25022512
`end`.
25032513
"""
25042514

2505-
def __init__(self, *, text: str = None,
2515+
def __init__(self,
2516+
*,
2517+
text: str = None,
25062518
location: 'Location' = None) -> None:
25072519
"""
25082520
Initialize a Contexts object.
@@ -3150,7 +3162,10 @@ class DocInfo():
31503162
:attr str hash: (optional) The MD5 hash of the input document.
31513163
"""
31523164

3153-
def __init__(self, *, html: str = None, title: str = None,
3165+
def __init__(self,
3166+
*,
3167+
html: str = None,
3168+
title: str = None,
31543169
hash: str = None) -> None:
31553170
"""
31563171
Initialize a DocInfo object.
@@ -4761,7 +4776,9 @@ class KeyValuePair():
47614776
:attr List[Value] value: (optional) A list of values in a key-value pair.
47624777
"""
47634778

4764-
def __init__(self, *, key: 'Key' = None,
4779+
def __init__(self,
4780+
*,
4781+
key: 'Key' = None,
47654782
value: List['Value'] = None) -> None:
47664783
"""
47674784
Initialize a KeyValuePair object.
@@ -5070,7 +5087,9 @@ class Mention():
50705087
`end`.
50715088
"""
50725089

5073-
def __init__(self, *, text: str = None,
5090+
def __init__(self,
5091+
*,
5092+
text: str = None,
50745093
location: 'Location' = None) -> None:
50755094
"""
50765095
Initialize a Mention object.
@@ -5896,7 +5915,9 @@ class SectionTitle():
58965915
`end`.
58975916
"""
58985917

5899-
def __init__(self, *, text: str = None,
5918+
def __init__(self,
5919+
*,
5920+
text: str = None,
59005921
location: 'Location' = None) -> None:
59015922
"""
59025923
Initialize a SectionTitle object.
@@ -6369,7 +6390,9 @@ class TableTitle():
63696390
:attr str text: (optional) The text of the identified table title or caption.
63706391
"""
63716392

6372-
def __init__(self, *, location: 'Location' = None,
6393+
def __init__(self,
6394+
*,
6395+
location: 'Location' = None,
63736396
text: str = None) -> None:
63746397
"""
63756398
Initialize a TableTitle object.

0 commit comments

Comments
 (0)