Upgrading to [email protected]
Note: If migrating from a version less than 5.0, also see the v5 migration guide wiki.
Support for callbacks has been dropped in favor of promises. All functions will no longer accept a callback parameter. An example of replacing a callback with a promise using then/catch
and async/await
syntax is shown below
//Callback
const assistant = new AssistantV2(options);
assistant.message(params, (err, res) => {
if(err){
console.log(err) //Print out error
return
}
console.log(res.result) //Print out body
});
//Promise with then/catch
const assistant = new AssistantV2(options);
assistant.message(params)
.then(res => {
console.log(res.result) //Print out body
})
.catch(err => {
console.log(err) //Print out error
})
//Promise with async/await
//Use of the await keyword must be used within an async function
async myFunction() {
const assistant = new AssistantV2(options);
try{
const res = await assistant.message(params);
console.log(res.result) //Print out body
} catch(err){
console.log(err) //Print out error
}
}
myFunction()
The SDK no longer supports Node version 10, as reflected in the engines
property in the package.json file. Version 10 will reach end of life on 30 April 2021.
- Parameter
context
type changed fromJsonObject
toDialogNodeContext
increateDialogNode()
- Parameter
newContext
type changed fromJsonObject
toDialogNodeContext
inupdateDialogNode()
- Interface
Context
propertysystem
type changed fromSystemResponse
toJsonObject
- Interface
DialogNode
propertycontext
type changed fromJsonObject
toDialogNodeContext
- Interface
DialogSuggestion
propertyoutput
type changed fromDialogSuggestionOutput
toJsonObject
- Interface
SystemResponse
removed - Interface
DialogSuggestionOuput
removed - Interface
DialogNodeOutputGeneric
expanded into multiple interfaces - Interface
RuntimeResponseGeneric
expanded into multiple interfaces
- Interface
MessageContext
propertyskills
type changed fromMessageContextSkills
toJsonObject
- Interface
MessageContextStateless
propertyskills
type changed fromMessageContextSkills
toJsonObject
- Interface
MessageInputOptions
property_export
renamed toexport
- Interface
MessageContextSkills
removed - Interface
RuntimeResponseGeneric
expanded into multiple interfaces
- Parameter
before
andafter
removed inlistFeedback()
- Interface
OriginalLabelsOut
propertymodification
removed - Interface
UpdatedLabelsOut
propertymodification
removed - Interface
BatchStatus
property_function
renamed tofunction
- Interface
NluEnrichmentCategories
removed - Interface
NluEnrichmentFeatures
propertycategories
type changed fromNluEnrichmentCategories
toJsonObject
- Interface
DefaultQueryParams
property_return
renamedreturn
- Interface
AnalysisResults
propertymetadata
type changed fromAnalysisResultsMetadata
toFeaturesResultsMetadata
- Interface
Features
propertymetadata
type changed fromMetadataOptions
toJsonObject
- Interface
AnalysisResultsMetadata
removed - Interface
MetadataOptions
removed
- Interface
Content
propertycontent_items
renamedcontentItems
- Interface
CreateVoiceModelParams
renamed toCreateCustomModelParams
- Interface
ListVoiceModelParams
renamed toListCustomModelParams
- Interface
GetVoiceModelParams
renamed toGetCustomModelParams
- Interface
UpdateVoiceModelParams
renamed toUpdateCustomModelParams
- Interface
DeleteVoiceModelParams
renamed toDeleteCustomModelParams
- Interface
CreateVoiceModelConstants
renamed toCreateCustomModelConstants
- Interface
ListVoiceModelConstants
renamed toListCustomModelConstants
- Interface
VoiceModel
renamed toCustomModel
- Use of
VoiceModel[]
replaced with interfaceCustomModels
- Interface
Class
property_class
renamedclass
- Interface
ClassResult
property_class
renamedclass
- Interface
Collection
propertytraining_status
type changed fromTrainingStatus
toCollectionTrainingStatus
- Interface
ObjectDetail
propertylocation
type changed fromLocation
toObjectDetailLocation
includeCount
parameter added to several methods: Whether to include information about the number of records that satisfy the request, regardless of the page limit.bulkClassify()
method added: Identify intents and entities in multiple user utterances.- Interface
DialogNodeContext
added - Interface
DialogNodeOutput
propertyintegrations
added: Output intended for specific integrations. For more information, see the documentation
bulkClassify()
method added: Identify intents and entities in multiple user utterances.
- Interface
Category
propertymodification
added: The type of modification of the feedback entry in the updated labels response. - Interface
TypeLabel
propertymodification
added: The type of modification of the feedback entry in the updated labels response.
analyzeDocument()
method added: Process a document using the specified collection's settings and return it for realtime use. Note: This method is only supported on IBM Cloud Pak for Data instances of Discovery.- Interface
QueryResponsePassage
added - Interface
QueryResponse
propertypassages
added: Passages returned by Discovery.
translateDocument()
now supports these subtitle/caption formats:text/sbv
,text/srt
, andtext/vtt
- Interface
FeaturesResultsMetadata
added: Webpage metadata, such as the author and the title of the page.
recognize()
andcreateJob()
now support Canadian French broadband and narrowband modelscreateLanguageModel()
andcreateAcousticModel()
now supports Australian English broadband and narrowband modelsaddGrammar()
parametergrammarFile
now supportsReadableStream
andBuffer
- Interface
CollectionTrainingStatus
added: Training status information for the collection. - Interface
ObjectDetailLocation
added: Defines the location of the bounding box around the object.