mirror of
https://github.com/jambonz/jambonz-api-server.git
synced 2026-07-23 20:42:16 +00:00
add support for ibm speech credentials, and test for ibm tts (#82)
* add support for ibm speech credentials, and test for ibm tts * add stt testing for ibm watson
This commit is contained in:
@@ -179,6 +179,35 @@ const testWellSaidTts = async(logger, credentials) => {
|
||||
}
|
||||
};
|
||||
|
||||
const testIbmTts = async(logger, getTtsVoices, credentials) => {
|
||||
const {tts_api_key, tts_region} = credentials;
|
||||
const voices = await getTtsVoices({vendor: 'ibm', credentials: {api_key: tts_api_key, region: tts_region}});
|
||||
return voices;
|
||||
};
|
||||
|
||||
const testIbmStt = async(logger, credentials) => {
|
||||
const {stt_api_key, stt_region} = credentials;
|
||||
const SpeechToTextV1 = require('ibm-watson/speech-to-text/v1');
|
||||
const { IamAuthenticator } = require('ibm-watson/auth');
|
||||
const speechToText = new SpeechToTextV1({
|
||||
authenticator: new IamAuthenticator({
|
||||
apikey: stt_api_key
|
||||
}),
|
||||
serviceUrl: `https://api.${stt_region}.speech-to-text.watson.cloud.ibm.com`
|
||||
});
|
||||
return new Promise((resolve, reject) => {
|
||||
speechToText.listModels()
|
||||
.then((speechModels) => {
|
||||
logger.debug({speechModels}, 'got IBM speech models');
|
||||
return resolve();
|
||||
})
|
||||
.catch((err) => {
|
||||
logger.info({err}, 'failed to get speech models');
|
||||
reject(err);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
const testWellSaidStt = async(logger, credentials) => {
|
||||
//TODO
|
||||
return true;
|
||||
@@ -195,5 +224,7 @@ module.exports = {
|
||||
testWellSaidStt,
|
||||
testNuanceTts,
|
||||
testNuanceStt,
|
||||
testDeepgramStt
|
||||
testDeepgramStt,
|
||||
testIbmTts,
|
||||
testIbmStt
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user