Skip to content

Release V2.0.0#554

Merged
ehdsouza merged 23 commits intomasterfrom
v2.0.0
Sep 12, 2018
Merged

Release V2.0.0#554
ehdsouza merged 23 commits intomasterfrom
v2.0.0

Conversation

@ehdsouza
Copy link
Copy Markdown
Contributor

@ehdsouza ehdsouza commented Sep 7, 2018

The following would be the MIGRATION

Version 2.0.0

GENERAL CHANGES FOR ALL SERVICES:

  • DetailedResponse is now the default response which contains the result, headers and HTTP status code. Previously, the response only contained the direct response from the service. Use get_result() to obtain the method response.
from watson_developer_cloud import AssistantV1
 assistant = AssistantV1(
    username='xxx',
    password='yyy',
    version='2017-04-21')
 response = assistant.list_workspaces(headers={'Custom-Header': 'custom_value'})
print(response.get_result())
print(response.get_headers())
print(response.get_status_code())
  • iam_api_key renamed to iam_apikey
    The constructor for each service now looks like:
    def __init__(
            self,
            url=default_url,
            username=None,
            password=None,
            iam_apikey=None,
            iam_access_token=None,
            iam_url=None,
    ):

PERSONALITY INSIGHTS:

  • profile method parameter reordering:
	    def profile(self,
                content,
                content_type,
                accept=None,
                content_language=None,
                accept_language=None,
                raw_scores=None,
                csv_headers=None,
                consumption_preferences=None,
                **kwargs):

VISUAL RECOGNITION:

  • classify would no longer support the parameters keyword, the new interface is:
    def classify(self,
                 images_file=None,
                 accept_language=None,
                 url=None,
                 threshold=None,
                 owners=None,
                 classifier_ids=None,
                 images_file_content_type=None,
                 images_filename=None,
                 **kwargs):
  • detect_faces would no longer support the parameters keyword, the new interface is:
    def detect_faces(self,
                     images_file=None,
                     url=None,
                     images_file_content_type=None,
                     images_filename=None,
                     **kwargs):

SPEECH TO TEXT:

  • recognize parameter reordering and version parameter renamed to base_model_version
    def recognize(self,
                  audio,
                  content_type,
                  model=None,
                  customization_id=None,
                  acoustic_customization_id=None,
                  base_model_version=None,
                  customization_weight=None,
                  inactivity_timeout=None,
                  keywords=None,
                  keywords_threshold=None,
                  max_alternatives=None,
                  word_alternatives_threshold=None,
                  word_confidence=None,
                  timestamps=None,
                  profanity_filter=None,
                  smart_formatting=None,
                  speaker_labels=None,
                  **kwargs):
  • create_job, parameter reordering and version parameter renamed to base_model_version
    def create_job(self,
                   audio,
                   content_type,
                   model=None,
                   callback_url=None,
                   events=None,
                   user_token=None,
                   results_ttl=None,
                   customization_id=None,
                   acoustic_customization_id=None,
                   base_model_version=None,
                   customization_weight=None,
                   inactivity_timeout=None,
                   keywords=None,
                   keywords_threshold=None,
                   max_alternatives=None,
                   word_alternatives_threshold=None,
                   word_confidence=None,
                   timestamps=None,
                   profanity_filter=None,
                   smart_formatting=None,
                   speaker_labels=None,
                   **kwargs):
  • add_corpus no longer supports corpus_file_content_type and corpus_filename. The corpus_file should be A TEXT file.
    def add_corpus(self,
                   customization_id,
                   corpus_name,
                   corpus_file,
                   allow_overwrite=None,
                   **kwargs):
  • add_word
    def add_word(self,
                 customization_id,
                 word_name,
                 word=None,
                 sounds_like=None,
                 display_as=None,
                 **kwargs):
  • recognize_using_websocket
    • A new underlying websocket client is now used
    • audio is of type AudioSource
    • recognize_callback’s on_transcription () and on_hypothesis () results swapped with each other
    def recognize_using_websocket(self,
                                  audio,
                                  content_type,
                                  recognize_callback,
                                  model=None,
                                  customization_id=None,
                                  acoustic_customization_id=None,
                                  customization_weight=None,
                                  base_model_version=None,
                                  inactivity_timeout=None,
                                  interim_results=None,
                                  keywords=None,
                                  keywords_threshold=None,
                                  max_alternatives=None,
                                  word_alternatives_threshold=None,
                                  word_confidence=None,
                                  timestamps=None,
                                  profanity_filter=None,
                                  smart_formatting=None,
                                  speaker_labels=None,
                                  http_proxy_host=None,
                                  http_proxy_port=None,
                                  **kwargs):

@codecov-io
Copy link
Copy Markdown

codecov-io commented Sep 7, 2018

Codecov Report

Merging #554 into master will not change coverage.
The diff coverage is 0%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #554    +/-   ##
=======================================
  Coverage       0%      0%            
=======================================
  Files          26      24     -2     
  Lines       16707   16251   -456     
=======================================
+ Misses      16707   16251   -456
Impacted Files Coverage Δ
watson_developer_cloud/tone_analyzer_v3.py 0% <ø> (ø) ⬆️
watson_developer_cloud/__init__.py 0% <ø> (ø) ⬆️
watson_developer_cloud/iam_token_manager.py 0% <ø> (ø) ⬆️
watson_developer_cloud/text_to_speech_v1.py 0% <0%> (ø) ⬆️
watson_developer_cloud/websocket/__init__.py 0% <0%> (ø) ⬆️
watson_developer_cloud/language_translator_v3.py 0% <0%> (ø) ⬆️
watson_developer_cloud/discovery_v1.py 0% <0%> (ø) ⬆️
...on_developer_cloud/websocket/recognize_listener.py 0% <0%> (ø)
watson_developer_cloud/assistant_v1.py 0% <0%> (ø) ⬆️
watson_developer_cloud/speech_to_text_v1.py 0% <0%> (ø) ⬆️
... and 11 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 37ce6aa...feac01c. Read the comment docs.

Copy link
Copy Markdown
Contributor

@germanattanasio germanattanasio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good 👍 I can't approve it because I didn't manually test it yet 😿

Copy link
Copy Markdown
Contributor

@mediumTaj mediumTaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good - a few questions and there are some opportunities to remove x-python-alternate-name

README.md Outdated

## Parsing HTTP response info
If you would like access to some HTTP response information along with the response model, you can set the `set_detailed_response()` to `True`
If you would like access to some HTTP response information along with the response model, you can set the `set_detailed_response()` to `True`. Since python `v2.0`, it is set to `True`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since python v2.0 - this part reads like Python v2 not Python SDK v2

appveyor.yml Outdated
deploy: off

matrix:
fast_finish: true No newline at end of file
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a newline at the end here?

## url is optional, and defaults to the URL below. Use the correct URL for your region.
# url='https://gateway.watsonplatform.net/conversation/api',
version='2018-02-16')
url='https://gateway.watsonplatform.net/assistant/api',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this stay conversation?

# ## url is optional, and defaults to the URL below. Use the correct URL for your region.
# url='https://gateway.watsonplatform.net/conversation/api',
# iam_api_key='your_api_key')
# # url='https://gateway.watsonplatform.net/assistant/api',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this stay conversation?

# url='https://gateway.watsonplatform.net/discovery/api',
username='YOUR SERVICE USERNAME',
password='YOUR SERVICE PASSWORD')
url='https://gateway-syd.watsonplatform.net/discovery/api',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want this syd url in the example?

# print(new_collection)
#print(discovery.get_collections(environment_id=writable_environment_id))
#print(discovery.get_collections(environment_id=writable_environment_id).get_result())
#res = discovery.delete_collection(environment_id='10b733d0-1232-4924-a670-e6ffaed2e641',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want this environment_id in the example?


## Delete model
# print(json.dumps(language_translator.delete_model(model_id='9f8d9c6f-2123-462f-9793-f17fdcb77cd6'), indent=2))
# print(json.dumps(language_translator.delete_model(model_id='9f8d9c6f-2123-462f-9793-f17fdcb77cd6').get_result(), indent=2))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want this model_id in the example?


## Get model details
# model = language_translator.get_model(model_id='fdadfc3b-0b96-4276-a6e5-f5c4a29711fc')
# model = language_translator.get_model(model_id='fdadfc3b-0b96-4276-a6e5-f5c4a29711fc').get_result()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want this model_id in the example?

return not self == other


class InlineResponse200(object):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be called DeleteModelResults. x-python-alternate-name needs to be removed from the api def.

https://github.ibm.com/Watson/developer-cloud--api-definitions/blob/master/apis-public/natural-language-understanding-v1.json#L1042

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also it is not listed here but QueryResultResultMetadata needs to be renamed QueryResultMetadata and the api definition needs to have x-python-alternate-name removed.

https://github.ibm.com/Watson/developer-cloud--api-definitions/blob/master/apis-public/discovery-v1.json#L7654

@@ -1 +1 @@
__version__ = '1.7.1'
__version__ = '1.7.0'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this version up?

Copy link
Copy Markdown
Contributor

@mediumTaj mediumTaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 looks good!

api_key = None
if api_key is not None and api_key.startswith(ICP_PREFIX):
self.set_username_and_password(APIKEY, api_key)
return
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@germanattanasio Should we add this to the other SDKs too? I didn't think about this but if users try to authenticate using an icp apikey the SDK does basicauth instead?

@ehdsouza ehdsouza merged commit e4151da into master Sep 12, 2018
@watson-github-bot
Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 2.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@ehdsouza ehdsouza deleted the v2.0.0 branch October 22, 2018 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

5 participants