-
Notifications
You must be signed in to change notification settings - Fork 669
Migration
This guide will highlight the major changes in the SDK and how to update your code accordingly. This release contains new usage patterns for a lot of service. Old usage patterns should still be functional in this release; however, in the next major release, your code will be mandated to use those new usage patterns.
In this major release, several services have been generated from the Swagger specifications of our services. Furthermore, the language has changed from NodeJS to TypeScript for these services. The change of language to TypeScript
will not have an impact on NodeJS
usage because the published public package contains NodeJS
that is the result of transpiling the TypeScript
code.
The following services are now being generated programmatically:
- Conversation
- Discovery
- Language Translator
- Natural Language Classifier
- Natural Language Understanding
- Personality Insights
- Text to Speech
- Tone Analyzer
- Speech to Text
- Visual Recognition
It's important to note that with so many of the services being moved to automated generation, there are many minor changes to method names, parameter names, etc. Therefore, this list is not exhaustive. However, we hope that this new approach will result in more consistent, maintainable code going forward.
In each specific project directory the previous structure was something like
- node-sdk/discovery
- v1.js
This has been replaced with something like
- node-sdk/discovery
- v1.ts
- v1-generated.ts
Where v1.ts is an adapter and v1-generated.ts is the new generated code. After building, there will be compiled files v1.js and v1-generated.js which are the JavaScript compilations of the TypeScript files.
Non generated code and helper methods are found in the /lib
folder.
Adapters are provided to ensure your old code will not break. These adapters follow the conventions of the v2 NodeSDK such as method names, parameters, etc. and call upon the generated code.
These are named for example for discovery: v1.ts Generated files follow the convention v1-generated.ts
These adapters should not be relied on and will not be supported for future versions and your code should be migrated to use the generated code.
getIntents
-
getIntents
is nowlistIntents
getExamples
-
getExamples
is nowlistExamples
getEntities
-
getEntities
is nowlistEntities
getValues
-
getValues
is nowlistValues
getSynonyms
-
getSynonyms
is nowlistSynonyms
getDialogNodes
-
getDialogNodes
is nowlistDialogNodes
getLogs
-
getLogs
is nowlistLogs
getCounterExamples
-
getCounterExamples
is nowlistCounterexamples
updateIntent
- parameter
old_intent
is nowintent
- parameter
intent
is nownew_intent
- parameter
description
is nownew_description
- parameter
examples
is nownew_examples
updateEntity
- parameter
old_entity
is nowentity
- parameter
entity
is nownew_entity
- parameter
description
is nownew_description
- parameter
metadata
is nownew_metadata
- parameter
fuzzy_match
is nownew_fuzzy_match
- parameter
values
is nownew_values
updateValue
- parameter
old_value
is nowvalue
- parameter
value
is nownew value
- parameter
metadata
is nownew_metadata
- parameter
synonyms
is nownew_synonyms
updateSynonym
- parameter
old_synonym
is nowsynonym
- parameter
synonym
is nownew_synonym
updateDialogNode
- parameter
old_dialog_node
is nowdialog_node
- parameter
dialog_node
is nownew_dialog_node
- parameter
description
is nownew_description
- parameter
conditions
is nownew_conditions
- parameter
parent
is nownew_parent
- parameter
previous_sibling
is nownew_previous_sibling
- parameter
output
is nownew_output
- parameter
context
is nownew_context
- parameter
metadata
is nownew_metadata
- parameter
next_step
is nownew_next_step
- parameter
title
is nownew_title
- parameter
type
is nownew_type
- parameter
event_name
is nownew_event_name
- parameter
variable
is nownew_variable
- parameter
actions
is nownew_action
updateCounterExample
- parameter
old_text
is nowtext
- parameter
text
is nownew_text
workspaceStatus
- method is no longer supported
New Supported Methods
- new supported method
listAllLogs
getEnvironments
-
getEnvironments
is nowlistEnvironments
- parameter added
name
getConfigurations
-
getConfigurations
is nowlistConfigurations
- parameter added
name
getCollectionFields
-
getCollectionFields
is nowlistCollectionFields
getCollections
-
getCollections
is nowlistCollections
- parameter added
name
createConfiguration
- required parameter added
name
- optional parameter added
description
-
file
is now decomposed into three top-level parameters, namely,conversions
,enrichments
, andnormalizations
.
updateConfiguration
- required parameter added
name
- optional parameter added
description
-
file
is now decomposed into three top-level parameters, namely,conversions
,enrichments
, andnormalizations
.
createCollection
- parameter
language_code
is nowlanguage
updateCollection
- parameter
collection_name
is nowname
- parameter
language_code
is removed
addDocument
- new optional parameter
file_content_type
New Supported Methods
- new supported method
queryNotices
- new supported method
federatedQueryNotices
- new supported method
federatedQuery
- new supported method
addTrainingData
- new supported method
createTrainingExample
- new supported method
deleteAllTrainingData
- new supported method
deleteTrainingData
- new supported method
deleteTrainingExample
- new supported method
getTrainingData
- new supported method
getTrainingExample
- new supported method
listTrainingData
- new supported method
listTrainingExamples
- new supported method
updateTrainingExample
getModels
-
getModels
is nowlistModels
- parameter
default
is nowdefault_models
getIdentifiableLanguages
-
getIdentifiableLanguages
is nowlistIdentifiableLanguages
create
-
create
is nowcreateClassifier
- required parameter added
metadata
status
-
status
is nowgetClassifier
list
-
list
is nowlistClassifiers
remove
-
remove
is nowdeleteClassifier
analyze
- parameter
headers
removed - optional parameters added
clean
,xpath
,fallback_to_raw
,return_analyzed_text
,language
,limit_text_characters
-
features
is now a required parameter
deleteModel
- parameter
headers
removed
listModels
- parameter
headers
removed
profile
- required parameters have changed from either
text
orcontent_items
tocontent
- header parameters
content_type
,accept_language
,content-language
are now top-level parameters and no longer encapsulated in aheaders
object -
content_type
is now required
Method Name Changes
-
voice
is nowgetVoice
-
voices
is nowlistVoices
-
pronunciation
is nowgetPronunciation
-
createCustomization
is nowcreateVoiceModel
-
updateCustomization
is nowupdateVoiceModel
-
getCustomization
is nowgetVoiceModel
-
getCustomizations
is nowlistVoiceModel
-
deleteCustomization
renamed todeleteVoiceModel
-
getWords
renamed tolistWords
tone_chat
-
tone_chat
method is nowtoneChat
-
utterances
are now a top level parameter - new optional parameter
accept_language
tone
- required parameter added
content_type
- required parameter
text
is nowtone_input
- removed parameter
isHTML
getModels
-
getModels
is nowlistModels
getCustomizaition
-
getCustomization
is nowgetLanguageModel
getCustomizations
-
getCustomizations
is nowlistLanguageModels
getRecognizeStatus
-
getRecognizeStatus
is nowgetSessionStatus
getRecognitionJob
-
getRecognitionJob
is nowcheckJob
getRecognitionJobs
-
getRecognitionJobs
is nowcheckJobs
createRecognitionJob
-
createRecognitionJob
is nowcreateJob
deleteRecognitionJob
-
deleteRecognitionJob
is nowdeleteJob
createCustomization
-
createCustomization
is nowcreateLanguageModel
- new required parameter
content_type
addCorpus
- parameter
name
is nowcorpus_name
- parameter
corpus
is nowcorpus_file
getCorpus
- parameter
name
is nowcorpus_name
deleteCorpus
- parameter
name
is nowcorpus_name
getCorpora
-
getCorpora
is nowlistCorpora
addWords
- new required parameter
content_type
addWord
- parameter
word
is nowword_name
- new require parameter
content_type
getWords
-
getWords
is nowlistWords
deleteWord
- parameter
word
is nowword_name
trainCustomization
-
trainCustomization
is nowtrainLanguageModel
resetCustomization
-
resetCustomization
is nowresetLanguageModel
createSession
- parameters added
customization_id
,acoustic_customization_id
,customization_weight
retrainClassifier
-
retrainClassifier
is nowupdateClassifier
recognizeText
- method is no longer supported
Similarity Search Methods
- The similary search beta is closed. The following methods are no longer available:
createCollection
getCollection
listCollections
deleteCollection
addImage
listImages
getImage
deleteImage
setImageData
getImageData
deleteImageData
findSimilar
classify
- parameters
url
,classifier_ids
,owners
, andthreshold
are now encapsulated in a new JSON parameterparameters
detectFaces
- parameter
url
is now encapsulated in a new JSON parameterparameters