|
17 | 17 | const {assert} = require('chai');
|
18 | 18 | const {describe, it} = require('mocha');
|
19 | 19 | const cp = require('child_process');
|
20 |
| - |
21 | 20 | const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});
|
22 | 21 |
|
| 22 | +const projectId = process.env.CAIP_PROJECT_ID; |
| 23 | +const location = process.env.LOCATION; |
| 24 | +const model = 'gemini-1.0-pro'; |
| 25 | + |
23 | 26 | describe('Generative AI NonStreaming Chat', async () => {
|
24 |
| - const project = 'cloud-llm-preview1'; |
25 |
| - const location = 'us-central1'; |
26 |
| - const model = 'gemini-1.0-pro'; |
| 27 | + /** |
| 28 | + * TODO(developer): Uncomment these variables before running the sample.\ |
| 29 | + * (Not necessary if passing values as arguments) |
| 30 | + */ |
| 31 | + // const projectId = 'YOUR_PROJECT_ID'; |
| 32 | + // const location = 'YOUR_LOCATION'; |
| 33 | + // const model = 'gemini-1.0-pro'; |
27 | 34 |
|
28 |
| - it('should create nonstreaming chat and begin the conversation the same in each instance', async () => { |
29 |
| - const output = execSync( |
30 |
| - `node ./nonStreamingChat.js ${project} ${location} ${model}` |
31 |
| - ); |
| 35 | + describe('Generative AI NonStreaming Chat', async () => { |
| 36 | + it('should create nonstreaming chat and begin the conversation the same in each instance', async () => { |
| 37 | + const output = execSync( |
| 38 | + `node ./nonStreamingChat.js ${projectId} ${location} ${model}` |
| 39 | + ); |
32 | 40 |
|
33 |
| - // Ensure that the beginning of the conversation is consistent |
34 |
| - assert(output.match(/User: Hello/)); |
35 |
| - assert(output.match(/User: Can you tell me a scientific fun fact?/)); |
36 |
| - assert(output.match(/User: How can I learn more about that?/)); |
| 41 | + // Ensure that the beginning of the conversation is consistent |
| 42 | + assert(output.match(/User: Hello/)); |
| 43 | + assert(output.match(/User: Can you tell me a scientific fun fact?/)); |
| 44 | + assert(output.match(/User: How can I learn more about that?/)); |
| 45 | + }); |
37 | 46 | });
|
38 | 47 | });
|
0 commit comments