|
| 1 | +// Copyright 2024 Google LLC |
| 2 | +// |
| 3 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +// you may not use this file except in compliance with the License. |
| 5 | +// You may obtain a copy of the License at |
| 6 | +// |
| 7 | +// https://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +// |
| 9 | +// Unless required by applicable law or agreed to in writing, software |
| 10 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +// See the License for the specific language governing permissions and |
| 13 | +// limitations under the License. |
| 14 | + |
| 15 | +'use strict'; |
| 16 | + |
| 17 | +const {assert} = require('chai'); |
| 18 | +const {describe, it} = require('mocha'); |
| 19 | +const cp = require('child_process'); |
| 20 | +const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); |
| 21 | + |
| 22 | +const projectId = process.env.CAIP_PROJECT_ID; |
| 23 | +const location = process.env.LOCATION; |
| 24 | +const model = 'gemini-1.5-pro-preview-0409'; |
| 25 | + |
| 26 | +describe('Generative AI Multimodal prompt', () => { |
| 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'; |
| 34 | + |
| 35 | + it('should generate text based on a prompt containing text, a video, and an image', async () => { |
| 36 | + const output = execSync( |
| 37 | + `node ./inference/nonStreamTextBasic.js ${projectId} ${location} ${model}` |
| 38 | + ); |
| 39 | + |
| 40 | + // Assert that the correct prompt was issued |
| 41 | + assert(output.length > 0); |
| 42 | + }); |
| 43 | +}); |
0 commit comments