8000 Release 3 2020 by mamoonraja · Pull Request #740 · watson-developer-cloud/python-sdk · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
10BC0
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,6 @@ test/__init__.py
# ignore detect secrets files
.pre-commit-config.yaml
.secrets.baseline

.openapi-generator-ignore
.openapi-generator/
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ IBM Cloud has migrated to token-based Identity and Access Management (IAM) authe
You supply either an IAM service **API key** or a **bearer token**:

- Use the API key to have the SDK manage the lifecycle of the access token. The SDK requests an access token, ensures that the access token is valid, and refreshes it if necessary.
- Use the access token if you want to manage the lifecycle yourself. For details, see [Authenticating with IAM tokens](https://cloud.ibm.com/docs/services/watson?topic=watson-iam).
- Use the access token if you want to manage the lifecycle yourself. For details, see [Authenticating with IAM tokens](https://cloud.ibm.com/docs/watson?topic=watson-iam).
- Use a server-side to generate access tokens using your IAM API key for untrusted environments like client-side scripts. The generated access tokens will be valid for one hour and can be refreshed.

#### Supplying the API key
Expand Down Expand Up @@ -513,5 +513,5 @@ This library is licensed under the [Apache 2.0 license][license].
[examples]: https://github.com/watson-developer-cloud/python-sdk/tree/master/examples
[CONTRIBUTING]: https://github.com/watson-developer-cloud/python-sdk/blob/master/CONTRIBUTING.md
[license]: http://www.apache.org/licenses/LICENSE-2.0
[vcap_services]: https://cloud.ibm.com/docs/services/watson?topic=watson-vcapServices
[vcap_services]: https://cloud.ibm.com/docs/watson?topic=watson-vcapServices
[ibm-cloud-onboarding]: https://cloud.ibm.com/registration?target=/developer/watson&cm_sp=WatsonPlatform-WatsonServices-_-OnPageNavLink-IBMWatson_SDKs-_-Python
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* Thresholds for identifying meaningful tones returned by the Watson Tone
Analyzer. Current values are
* based on the recommendations made by the Watson Tone Analyzer at
* https://cloud.ibm.com/docs/services/tone-analyzer?topic=tone-analyzer-utgpe
* https://cloud.ibm.com/docs/tone-analyzer?topic=tone-analyzer-utgpe
* These thresholds can be adjusted to client/domain requirements.
"""

Expand Down
135 changes: 115 additions & 20 deletions ibm_watson/assistant_v1.py

Large diffs are not rendered by default.

61 changes: 44 additions & 17 deletions ibm_watson/assistant_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1219,17 +1219,19 @@ class MessageContextSkill():

:attr dict user_defined: (optional) Arbitrary variables that can be read and
written by a particular skill.
:attr dict system: (optional) For internal use only.
:attr dict system: (optional) System context data used by the skill.
"""

def __init__(self, *, user_defined: dict = None,
def __init__(self,
*,
user_defined: dict = None,
system: dict = None) -> None:
"""
Initialize a MessageContextSkill object.

:param dict user_defined: (optional) Arbitrary variables that can be read
and written by a particular skill.
:param dict system: (optional) For internal use only.
:param dict system: (optional) System context data used by the skill.
"""
self.user_defined = user_defined
self.system = system
Expand Down Expand Up @@ -1488,49 +1490,68 @@ class MessageInputOptions():
Optional properties that control how the assistant responds.

:attr bool debug: (optional) Whether to return additional diagnostic
information. Set to `true` to return additional information under the
`output.debug` key.
information. Set to `true` to return additional information in the
`output.debug` property. If you also specify **return_context**=`true`, the
returned skill context includes the `system.state` property.
:attr bool restart: (optional) Whether to restart dialog processing at the root
of the dialog, regardless of any previously visited nodes. **Note:** This does
not affect `turn_count` or any other context variables.
:attr bool alternate_intents: (optional) Whether to return more than one intent.
Set to `true` to return all matching intents.
:attr bool return_context: (optional) Whether to return session context with the
response. If you specify `true`, the response will include the `context`
property.
response. If you specify `true`, the response includes the `context` property.
If you also specify **debug**=`true`, the returned skill context includes the
`system.state` property.
:attr bool export: (optional) Whether to return session context, including full
conversation state. If you specify `true`, the response includes the `context`
property, and the skill context includes the `system.state` property.
**Note:** If **export**=`true`, the context is returned regardless of the value
of **return_context**.
"""

def __init__(self,
*,
debug: bool = None,
restart: bool = None,
alternate_intents: bool = None,
return_context: bool = None) -> None:
return_context: bool = None,
export: bool = None) -> None:
"""
Initialize a MessageInputOptions object.

:param bool debug: (optional) Whether to return additional diagnostic
information. Set to `true` to return additional information under the
`output.debug` key.
information. Set to `true` to return additional information in the
`output.debug` property. If you also specify **return_context**=`true`, the
returned skill context includes the `system.state` property.
:param bool restart: (optional) Whether to restart dialog processing at the
root of the dialog, regardless of any previously visited nodes. **Note:**
This does not affect `turn_count` or any other context variables.
:param bool alternate_intents: (optional) Whether to return more than one
intent. Set to `true` to return all matching intents.
:param bool return_context: (optional) Whether to return session context
with the response. If you specify `true`, the response will include the
`context` property.
with the response. If you specify `true`, the response includes the
`context` property. If you also specify **debug**=`true`, the returned
skill context includes the `system.state` property.
:param bool export: (optional) Whether to return session context, including
full conversation state. If you specify `true`, the response includes the
`context` property, and the skill context includes the `system.state`
property.
**Note:** If **export**=`true`, the context is returned regardless of the
value of **return_context**.
"""
self.debug = debug
self.restart = restart
self.alternate_intents = alternate_intents
self.return_context = return_context
self.export = export

@classmethod
def from_dict(cls, _dict: Dict) -> 'MessageInputOptions':
"""Initialize a MessageInputOptions object from a json dictionary."""
args = {}
valid_keys = ['debug', 'restart', 'alternate_intents', 'return_context']
valid_keys = [
'debug', 'restart', 'alternate_intents', 'return_context', 'export'
]
bad_keys = set(_dict.keys()) - set(valid_keys)
if bad_keys:
raise ValueError(
Expand All @@ -1544,6 +1565,8 @@ def from_dict(cls, _dict: Dict) -> 'MessageInputOptions':
args['alternate_intents'] = _dict.get('alternate_intents')
if 'return_context' in _dict:
args['return_context'] = _dict.get('return_context')
if 'export' in _dict:
args['export'] = _dict.get('export')
return cls(**args)

@classmethod
Expand All @@ -1563,6 +1586,8 @@ def to_dict(self) -> Dict:
_dict['alternate_intents'] = self.alternate_intents
if hasattr(self, 'return_context') and self.return_context is not None:
_dict['return_context'] = self.return_context
if hasattr(self, 'export') and self.export is not None:
_dict['export'] = self.export
return _dict

def _to_dict(self):
Expand Down Expand Up @@ -1836,8 +1861,8 @@ class MessageResponse():

:attr MessageOutput output: Assistant output to be rendered or processed by the
client.
:attr MessageContext context: (optional) State information for the conversation.
The context is stored by the assistant on a per-session basis. You can use this
:attr MessageContext context: (optional) Context data for the conversation. The
context is stored by the assistant on a per-session basis. You can use this
property to access context variables.
**Note:** The context is included in message responses only if
**return_context**=`true` in the message request.
Expand All @@ -1852,7 +1877,7 @@ def __init__(self,

:param MessageOutput output: Assistant output to be rendered or processed
by the client.
:param MessageContext context: (optional) State information for the
:param MessageContext context: (optional) Context data for the
conversation. The context is stored by the assistant on a per-session
basis. You can use this property to access context variables.
**Note:** The context is included in message responses only if
Expand Down Expand Up @@ -3191,7 +3216,9 @@ class SearchResultMetadata():
indicates a greater match to the query parameters.
"""

def __init__(self, *, confidence: float = None,
def __init__(self,
*,
confidence: float = None,
score: float = None) -> None:
"""
Initialize a SearchResultMetadata object.
Expand Down
47 changes: 35 additions & 12 deletions ibm_watson/compare_comply_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,10 @@ def list_feedback(self,
response = self.send(request)
return response

def get_feedback(self, feedback_id: str, *, model: str = None,
def get_feedback(self,
feedback_id: str,
*,
model: str = None,
**kwargs) -> 'DetailedResponse':
"""
Get a specified feedback entry.
Expand Down Expand Up @@ -528,7 +531,10 @@ def get_feedback(self, feedback_id: str, *, model: str = None,
response = self.send(request)
return response

def delete_feedback(self, feedback_id: str, *, model: str = None,
def delete_feedback(self,
feedback_id: str,
*,
model: str = None,
**kwargs) -> 'DetailedResponse':
"""
Delete a specified feedback entry.
Expand Down Expand Up @@ -589,10 +595,10 @@ def create_batch(self,

Run Compare and Comply methods over a collection of input documents.
**Important:** Batch processing requires the use of the [IBM Cloud Object Storage
service](https://cloud.ibm.com/docs/services/cloud-object-storage?topic=cloud-object-storage-about#about-ibm-cloud-object-storage).
service](https://cloud.ibm.com/docs/cloud-object-storage?topic=cloud-object-storage-about#about-ibm-cloud-object-storage).
The use of IBM Cloud Object Storage with Compare and Comply is discussed at [Using
batch
processing](https://cloud.ibm.com/docs/services/compare-comply?topic=compare-comply-batching#before-you-batch).
processing](https://cloud.ibm.com/docs/compare-comply?topic=compare-comply-batching#before-you-batch).

:param str function: The Compare and Comply method to run across the
submitted input documents.
Expand Down Expand Up @@ -996,7 +1002,9 @@ class Address():
`end`.
"""

def __init__(self, *, text: str = None,
def __init__(self,
*,
text: str = None,
location: 'Location' = None) -> None:
"""
Initialize a Address object.
Expand Down Expand Up @@ -1725,7 +1733,9 @@ class Category():
IBM to provide feedback or receive support.
"""

def __init__(self, *, label: str = None,
def __init__(self,
*,
label: str = None,
provenance_ids: List[str] = None) -> None:
"""
Initialize a Category object.
Expand Down Expand Up @@ -2502,7 +2512,9 @@ class Contexts():
`end`.
"""

def __init__(self, *, text: str = None,
def __init__(self,
*,
text: str = None,
location: 'Location' = None) -> None:
"""
Initialize a Contexts object.
Expand Down Expand Up @@ -3150,7 +3162,10 @@ class DocInfo():
:attr str hash: (optional) The MD5 hash of the input document.
"""

def __init__(self, *, html: str = None, title: str = None,
def __init__(self,
*,
html: str = None,
title: str = None,
hash: str = None) -> None:
"""
Initialize a DocInfo object.
Expand Down Expand Up @@ -4761,7 +4776,9 @@ class KeyValuePair():
:attr List[Value] value: (optional) A list of values in a key-value pair.
"""

def __init__(self, *, key: 'Key' = None,
def __init__(self,
*,
key: 'Key' = None,
value: List['Value'] = None) -> None:
"""
Initialize a KeyValuePair object.
Expand Down Expand Up @@ -5070,7 +5087,9 @@ class Mention():
`end`.
"""

def __init__(self, *, text: str = None,
def __init__(self,
*,
text: str = None,
location: 'Location' = None) -> None:
"""
Initialize a Mention object.
Expand Down Expand Up @@ -5896,7 +5915,9 @@ class SectionTitle():
`end`.
"""

def __init__(self, *, text: str = None,
def __init__(self,
*,
text: str = None,
location: 'Location' = None) -> None:
"""
Initialize a SectionTitle object.
Expand Down Expand Up @@ -6369,7 +6390,9 @@ class TableTitle():
:attr str text: (optional) The text of the identified table title or caption.
"""

def __init__(self, *, location: 'Location' = None,
def __init__(self,
*,
location: 'Location' = None,
text: str = None) -> None:
"""
Initialize a TableTitle object.
Expand Down
Loading
0