-
Notifications
You must be signed in to change notification settings - Fork 661
v4 Migration Guide
Upgrading to [email protected]
-
Breaking changes
- Methods no longer return stream
- Error Handling Compatibility
- Default Methods Compatibility
- Removed Services
- Constructor Compatibility
- Assistant V1 Compatibility
- Assistant V2 Compatibility
- Discovery Compatibility
- Compare Comply Compatibility
- Natural Language Classifier Compatibility
- Personality Insights v3 Compatibility
- Speech to Text Compatibility
- Text to Speech Compatibility
- Tone Analyzer Compatibility
- Visual Recognition Compatibility
Previously, if a callback was not provided, each service method would return a pipeable stream. Now, this will no longer happen. A Promise is returned instead. This should not affect many users, as authenticating with IAM already prevented methods from returning streams.
The entire response is received with the third callback (if using callbacks) or when using Promises with return_response: true set as a parameter. This response now has a different structure for consistency with the other Watson SDKs.
The object returned has the following properties:
-
data: The body of the response -
headers: The HTTP response headers -
status: The HTTP status code -
statusText: The HTTP status message -
request: The actual request instance sent to the service -
config: The parameters used to build the request
The logic that formats errors returned from a service has been changed. That means that the Error object returned now has a different structure. If there is logic in your code that parses the error returned from service methods, this will need to change. The new structure is outlined below.
The object returned is of class Error and has the following properties:
-
name: Short title describing the error. Ex) 'Not Found' -
code: HTTP status code. Ex) 404 -
message: More descriptive error message. Ex) Model not found. -
body: Full error object returned by the service, stringified. If the object cannot be stringified due to a circular reference, it will be left as an object -
headers: Object containing response headers returned from the service, including the transaction id
If a request is made but no response is received (very rare), error.body will be an instance of HTTP.ClientRequest.
- The method
getCredentials, which formerly returned an object containing all user credentials (username, password, etc.), has been renamed togetServiceCredentials
The following services have been deprecated for an extended period of time and will no longer be supported in the SDK:
- Dialog
- Language Translator v2
- Conversation v1
- Parameter name changed:
version_date->version - The parameter
apikeyis no longer supported
- Parameter name changed:
export->_export(All instances)
- Parameter name changed:
new_type->new_value_type
- Parameter name changed:
new_type->new_node_type
- Interface
MessageContextSkillremoved
- Parameter name changed:
model_id->model
- Parameter name changed:
model_id->model
- Parameter name changed:
model_id->model
- Parameter name changed:
model_id->model
- Parameter name changed:
model_id->model
- Parameter name changed:
model_id->model
- Parameter name changed:
model_id->model
- Parameter name changed:
model_id->model
- Method name changed:
getSourceCredentials->getCredentials
- Parameter
stopword_filenameis now required
- Method name changed:
getEnvironments->listEnvironments
- Method name changed:
getCollections->listCollections
- Method name changed:
getConfigurations->listConfigurations
- Method name changed:
getCollectionFields->listFields - Parameter name changed:
collection_id->collection_ids(collection_idsis an Array)
- Method name changed:
addJsonDocument->addDocument
- Method name changed:
updateJsonDocument->updateDocument
- Parameter
sizewill no longer be set to1if not given
- Parameter
nameis now required - Parameter
fileis now split intoconversions,enrichmentsandnormalizations
- Parameter
nameis now required - Parameter
fileis now split intoconversions,enrichmentsandnormalizations
- Parameter name changed:
language_code->language - Parameter
languagewill no longer be set to'en_us'if not given
- Parameter name changed:
collection_name->name
- Parameter name changed:
return->return_fields -
queryandnatural_language_querycan't both be populated - this is no longer corrected internally - Parameter name changed:
passages.fields->passages_fields - Parameter name changed:
passages.count->passages_count - Parameter name changed:
passages.characters->passages_characters - Parameter type changed from Array to String:
return_fields,sort,passages_fields,collection_ids,similar_document_ids,similar_fields
- Parameter type changed from Array to String:
return_fields,sort,passages_fields,collection_ids,similar_document_ids,similar_fields
- Model name changed:
QueryResultResultMetadata->QueryResultMetadata
- Method name changed:
create->createClassifier - Parameter
training_datais now required to be CSV format - Parameter
metadatano longer constructed internally
- Parameter name changed:
classifier->classifier_id
- Method name changed:
status->getClassifier - Parameter name changed:
classifier->classifier_id
- Method name changed:
list->listClassifiers
- Method name changed:
remove->deleteClassifier - Parameter name changed:
classifier->classifier_id
- Parameters
accept_language,content_type,content_languagenow belong at the top-level of theparamsobject, rather than withinheaders - Parameter
acceptis no longer supported - useprofile()forapplication/jsonandprofileAsCsv()fortext/csv - Parameters
textandcontentItemsare no longer supported - Parameter
content_itemsbelongs within the parametercontentand not at the top level - this is no longer internally corrected
- Method name changed:
profile_csv->profileAsCsv
- Method name changed:
getModels->listModels
- Method name changed:
getCustomization->getLanguageModel
- Method name changed:
getRecognitionJob->checkJob
- Method name changed:
createCustomization->createLanguageModel
- Method name changed:
getRecognitionJobs->checkJobs
- Method name changed:
deleteRecognitionJob->deleteJob
- Method name changed:
getCustomizations->listLanguageModels
- Method name changed:
createRecognitionJob->createJob - The parameter
eventsmust be a comma-separated string, not an Array. This is no longer corrected internally
- Parameter name changed:
name->corpus_name - Parameter name changed:
corpus->corpus_file
- Parameter name changed:
name->corpus_name
- Parameter name changed:
name->corpus_name
- Method name changed:
getCorpora->listCorpora
- Parameter name changed:
name->corpus_name
- Method name changed:
word->word_name
- Method name changed:
word->word_name
- Method name changed:
word->word_name
- Method name changed:
trainCustomization->trainLanguageModel
- Method name changed:
resetCustomization->resetLanguageModel
- Method name changed:
deleteCustomization->deleteLanguageModel
- Method name changed:
createRecognizeStream->recognizeUsingWebSocket
- This method is no longer supported. Use
recognizeUsingWebSocketinstead
- This method is no longer supported. Use
recognizeUsingWebSocketinstead
- Method name changed:
getCustomizations->listVoiceModels
- Method name changed:
getCustomization->getVoiceModel
- Method name changed:
updateCustomization->updateVoiceModel
- Method name changed:
deleteCustomization->deleteVoiceModel
- Method name changed:
createCustomization->createVoiceModel
- Method name changed:
getWords->listWords
- Method name changed:
voices->listVoices
- Method name changed:
voice->getVoice
- Method name changed:
pronunciation->getPronunciation
- Parameter name changed:
text->tone_input - Parameter
content_typeis now required - Parameter
tonesis now required to be an Array - Parameter name changed:
language->content_language
- Method name changed:
tone_chat->toneChat - Parameter
utterancesis now required to be at the top level of the params object
- Parameter
{classname}_positive_exampleschanged to mappositive_examples
Instead of passing in multiple parameters like car_positive_examples and boat_positive_examples, the method now takes a single map with the classnames as the keys:
"positive_examples": {
"car": <car examples>,
"boat": <boat examples>
}- Parameter
{classname}_positive_exampleschanged to mappositive_examples
Instead of passing in multiple parameters like car_positive_examples and boat_positive_examples, the method now takes a single map with the classnames as the keys:
"positive_examples": {
"car": <car examples>,
"boat": <boat examples>
}- Parameter name changed:
image_file->images_file - Parameter
parametersis no longer supported
- Parameter name changed:
image_file->images_file - Parameter
parametersis no longer supported
- Method name changed:
retrainClassifier->updateClassifier
- This method is no longer supported
- This method is no longer supported
- This method is no longer supported
- This method is no longer supported
- This method is no longer supported
- This method is no longer supported
- This method is no longer supported
- This method is no longer supported
- This method is no longer supported
- This method is no longer supported
- This method is no longer supported
- This method is no longer supported
- This method is no longer supported