-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: improved instructions for samples and tests (#41)
- Loading branch information
1 parent
030ac66
commit e45b74e
Showing
9 changed files
with
142 additions
and
1 deletion.
There are no files selected for viewing
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
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
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
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
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
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright 2020 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
'use strict'; | ||
|
||
const {assert} = require('chai'); | ||
const {describe, it} = require('mocha'); | ||
const execSync = require('child_process').execSync; | ||
const exec = cmd => execSync(cmd, {encoding: 'utf8'}); | ||
|
||
describe('detect intent with text input', () => { | ||
const cmd = 'node detect-intent-audio.js'; | ||
|
||
const projectId = process.env.GCLOUD_PROJECT; | ||
const location = 'global'; | ||
const agentId = '5d23f659-cd71-43e9-8fb2-b69cd9896370'; | ||
const audioFileName = 'resources/book_a_room.wav'; | ||
const encoding = 'AUDIO_ENCODING_LINEAR_16'; | ||
const sampleRateHertz = 16000; | ||
const languageCode = 'en'; | ||
|
||
it('should response to "book a room"', async () => { | ||
const output = exec( | ||
`${cmd} ${projectId} ${location} ${agentId} ${audioFileName} ${encoding} ${sampleRateHertz} ${languageCode}` | ||
); | ||
assert.include(output, "Sorry, I didn't get that. Can you rephrase?"); | ||
}); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright 2020 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
'use strict'; | ||
|
||
const {assert} = require('chai'); | ||
const {describe, it} = require('mocha'); | ||
const execSync = require('child_process').execSync; | ||
const exec = cmd => execSync(cmd, {encoding: 'utf8'}); | ||
|
||
describe('detect intent with text input', () => { | ||
const cmd = 'node detect-intent-text.js'; | ||
|
||
const projectId = process.env.GCLOUD_PROJECT; | ||
const location = 'global'; | ||
const agentId = '5d23f659-cd71-43e9-8fb2-b69cd9896370'; | ||
const languageCode = 'en'; | ||
|
||
it('should response to "hello"', async () => { | ||
const output = exec( | ||
`${cmd} ${projectId} ${location} ${agentId} 'hello' ${languageCode}` | ||
); | ||
assert.include(output, 'How can I assist you today?'); | ||
}); | ||
|
||
it('should response to "reserve a vent"', async () => { | ||
const output = exec( | ||
`${cmd} ${projectId} ${location} ${agentId} 'i need to reserve a van' ${languageCode}` | ||
); | ||
assert.include(output, 'Where would you like to pick it up?'); | ||
}); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright 2020 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
'use strict'; | ||
|
||
const {assert} = require('chai'); | ||
const {describe, it} = require('mocha'); | ||
const execSync = require('child_process').execSync; | ||
const exec = cmd => execSync(cmd, {encoding: 'utf8'}); | ||
|
||
describe('list intents', () => { | ||
const cmd = 'node list-intents.js'; | ||
|
||
const projectId = process.env.GCLOUD_PROJECT; | ||
const location = 'global'; | ||
const agentId = '5d23f659-cd71-43e9-8fb2-b69cd9896370'; | ||
|
||
it('should List the Intents', async () => { | ||
const output = exec(`${cmd} ${projectId} ${location} ${agentId}`); | ||
assert.include(output, 'Default Welcome Intent'); | ||
assert.include(output, 'Default Negative Intent'); | ||
}); | ||
}); |