Created
March 11, 2020 11:19
-
-
Save savelee/73af0549a2cbdc4bd945b90ea2fcfc7c to your computer and use it in GitHub Desktop.
Speech Adaptation in Dialogflow
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const uuid = require('uuid'); | |
const df = require('dialogflow').v2beta1; | |
const sessionId = uuid.v4(); | |
const sessionClient = new df.SessionsClient(); | |
const sessionPath = sessionClient.sessionPath(projectId, sessionId); | |
let request = { | |
session: sessionPath, | |
queryInput: { | |
audioConfig: { | |
sampleRateHertz: 16000, | |
encoding: 'AUDIO_ENCODING_LINEAR_16', | |
languageCode: 'en-US', | |
speechContexts: [ | |
{ | |
phrases: [ | |
'mail', | |
'email' | |
], | |
boost: 20.0 | |
} | |
] | |
}, | |
singleUtterance: singleUtterance | |
} | |
} | |
request.inputAudio = audio; | |
const responses = await sessionClient.detectIntent(request); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment