Skip to content

Commit d8df6e6

Browse files
authored
fix: resolve small bug (repeated image), and moving region tag (#3589)
1 parent a7ed03c commit d8df6e6

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

generative-ai/snippets/sendMultiModalPromptWithImage.js

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
// [START aiplatform_gemini_single_turn_multi_image]
1516
const {VertexAI} = require('@google-cloud/vertexai');
1617
const axios = require('axios');
1718

@@ -20,28 +21,23 @@ async function getBase64(url) {
2021
return Buffer.from(image.data).toString('base64');
2122
}
2223

24+
/**
25+
* TODO(developer): Update these variables before running the sample.
26+
*/
2327
async function sendMultiModalPromptWithImage(
2428
projectId = 'PROJECT_ID',
2529
location = 'LOCATION_ID',
2630
model = 'MODEL'
2731
) {
28-
// [START aiplatform_gemini_single_turn_multi_image]
29-
/**
30-
* TODO(developer): Uncomment these variables before running the sample.
31-
*/
32-
// const projectId = 'your-project-id';
33-
// const location = 'us-central1';
34-
// const model = 'chosen-genai-model';
35-
3632
// For images, the SDK supports base64 strings
3733
const landmarkImage1 = await getBase64(
3834
'https://storage.googleapis.com/cloud-samples-data/vertex-ai/llm/prompts/landmark1.png'
3935
);
4036
const landmarkImage2 = await getBase64(
41-
'https://storage.googleapis.com/cloud-samples-data/vertex-ai/llm/prompts/landmark1.png'
37+
'https://storage.googleapis.com/cloud-samples-data/vertex-ai/llm/prompts/landmark2.png'
4238
);
4339
const landmarkImage3 = await getBase64(
44-
'https://storage.googleapis.com/cloud-samples-data/vertex-ai/llm/prompts/landmark1.png'
40+
'https://storage.googleapis.com/cloud-samples-data/vertex-ai/llm/prompts/landmark3.png'
4541
);
4642

4743
// Initialize Vertex with your Cloud project and location
@@ -96,9 +92,8 @@ async function sendMultiModalPromptWithImage(
9692
aggregatedResponse.candidates[0].content.parts[0].text;
9793

9894
console.log(fullTextResponse);
99-
100-
// [END aiplatform_gemini_single_turn_multi_image]
10195
}
96+
// [END aiplatform_gemini_single_turn_multi_image]
10297

10398
sendMultiModalPromptWithImage(...process.argv.slice(2)).catch(err => {
10499
console.error(err.message);

0 commit comments

Comments
 (0)