From 18163b872086d4c9dfd7b0a42e5bef04e3e3a705 Mon Sep 17 00:00:00 2001 From: Nicholas Cook Date: Thu, 20 Jun 2024 14:27:55 -0700 Subject: [PATCH] =?UTF-8?q?feat(generative-ai):=20update=20samples=20to=20?= =?UTF-8?q?Gemini=20Flash;=20add=20updated=20regi=E2=80=A6=20(#3716)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat(generative-ai): update samples to Gemini Flash; add updated region tags * Trigger Build * remove assert on a certain word * remove assert on a certain word * Trigger Build --- .../snippets/function-calling/functionCallingStreamChat.js | 2 ++ generative-ai/snippets/gemini-all-modalities.js | 2 +- generative-ai/snippets/gemini-audio-summarization.js | 2 +- generative-ai/snippets/gemini-audio-transcription.js | 2 +- generative-ai/snippets/gemini-pdf.js | 2 +- generative-ai/snippets/gemini-system-instruction.js | 2 +- .../snippets/grounding/groundingPrivateDataBasic.js | 2 +- .../snippets/grounding/groundingPublicDataBasic.js | 2 +- generative-ai/snippets/nonStreamingChat.js | 2 ++ generative-ai/snippets/nonStreamingContent.js | 2 ++ generative-ai/snippets/nonStreamingMultipartContent.js | 2 ++ generative-ai/snippets/safetySettings.js | 2 ++ generative-ai/snippets/sendMultiModalPromptWithImage.js | 4 +++- generative-ai/snippets/sendMultiModalPromptWithVideo.js | 4 +++- generative-ai/snippets/streamChat.js | 2 ++ generative-ai/snippets/streamContent.js | 2 ++ generative-ai/snippets/streamMultipartContent.js | 4 +++- .../test/grounding/groundingPrivateDataBasic.test.js | 4 ++-- .../test/grounding/groundingPublicDataBasic.test.js | 4 ++-- .../test/inference/nonStreamMultiModalityBasic.test.js | 2 +- generative-ai/snippets/test/nonStreamingContent.test.js | 2 +- .../snippets/test/nonStreamingMultipartContent.test.js | 5 ++--- generative-ai/snippets/test/safetySettings.test.js | 2 +- .../snippets/test/sendMultiModalPromptWithImage.test.js | 4 ++-- .../snippets/test/sendMultiModalPromptWithVideo.test.js | 7 ++++--- generative-ai/snippets/test/streamChat.test.js | 2 +- generative-ai/snippets/test/streamContent.test.js | 2 +- generative-ai/snippets/test/streamMultipartContent.test.js | 5 ++--- 28 files changed, 49 insertions(+), 30 deletions(-) diff --git a/generative-ai/snippets/function-calling/functionCallingStreamChat.js b/generative-ai/snippets/function-calling/functionCallingStreamChat.js index 38f0da8643..69dd57888e 100644 --- a/generative-ai/snippets/function-calling/functionCallingStreamChat.js +++ b/generative-ai/snippets/function-calling/functionCallingStreamChat.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +// [START generativeaionvertexai_gemini_function_calling_chat] // [START aiplatform_gemini_function_calling_chat] const { VertexAI, @@ -91,6 +92,7 @@ async function functionCallingStreamChat( console.log(response2.candidates[0].content.parts[0].text); } // [END aiplatform_gemini_function_calling_chat] +// [END generativeaionvertexai_gemini_function_calling_chat] functionCallingStreamChat(...process.argv.slice(2)).catch(err => { console.error(err.message); diff --git a/generative-ai/snippets/gemini-all-modalities.js b/generative-ai/snippets/gemini-all-modalities.js index 02897c341c..7bd6abd89f 100644 --- a/generative-ai/snippets/gemini-all-modalities.js +++ b/generative-ai/snippets/gemini-all-modalities.js @@ -22,7 +22,7 @@ async function analyze_all_modalities(projectId = 'PROJECT_ID') { const vertexAI = new VertexAI({project: projectId, location: 'us-central1'}); const generativeModel = vertexAI.getGenerativeModel({ - model: 'gemini-1.5-pro-preview-0409', + model: 'gemini-1.5-flash-001', }); const videoFilePart = { diff --git a/generative-ai/snippets/gemini-audio-summarization.js b/generative-ai/snippets/gemini-audio-summarization.js index 9c0316060c..1efbecb98d 100644 --- a/generative-ai/snippets/gemini-audio-summarization.js +++ b/generative-ai/snippets/gemini-audio-summarization.js @@ -22,7 +22,7 @@ async function summarize_audio(projectId = 'PROJECT_ID') { const vertexAI = new VertexAI({project: projectId, location: 'us-central1'}); const generativeModel = vertexAI.getGenerativeModel({ - model: 'gemini-1.5-pro-preview-0409', + model: 'gemini-1.5-flash-001', }); const filePart = { diff --git a/generative-ai/snippets/gemini-audio-transcription.js b/generative-ai/snippets/gemini-audio-transcription.js index 969034217b..f0b7d71c18 100644 --- a/generative-ai/snippets/gemini-audio-transcription.js +++ b/generative-ai/snippets/gemini-audio-transcription.js @@ -22,7 +22,7 @@ async function transcript_audio(projectId = 'PROJECT_ID') { const vertexAI = new VertexAI({project: projectId, location: 'us-central1'}); const generativeModel = vertexAI.getGenerativeModel({ - model: 'gemini-1.5-pro-preview-0409', + model: 'gemini-1.5-flash-001', }); const filePart = { diff --git a/generative-ai/snippets/gemini-pdf.js b/generative-ai/snippets/gemini-pdf.js index 41a0af93fa..fe02b5736b 100644 --- a/generative-ai/snippets/gemini-pdf.js +++ b/generative-ai/snippets/gemini-pdf.js @@ -22,7 +22,7 @@ async function analyze_pdf(projectId = 'PROJECT_ID') { const vertexAI = new VertexAI({project: projectId, location: 'us-central1'}); const generativeModel = vertexAI.getGenerativeModel({ - model: 'gemini-1.5-pro-preview-0409', + model: 'gemini-1.5-flash-001', }); const filePart = { diff --git a/generative-ai/snippets/gemini-system-instruction.js b/generative-ai/snippets/gemini-system-instruction.js index 7f57015470..2407c5e7c0 100644 --- a/generative-ai/snippets/gemini-system-instruction.js +++ b/generative-ai/snippets/gemini-system-instruction.js @@ -22,7 +22,7 @@ async function set_system_instruction(projectId = 'PROJECT_ID') { const vertexAI = new VertexAI({project: projectId, location: 'us-central1'}); const generativeModel = vertexAI.getGenerativeModel({ - model: 'gemini-1.5-pro-preview-0409', + model: 'gemini-1.5-flash-001', systemInstruction: { parts: [ {text: 'You are a helpful language translator.'}, diff --git a/generative-ai/snippets/grounding/groundingPrivateDataBasic.js b/generative-ai/snippets/grounding/groundingPrivateDataBasic.js index a6f51b6cf2..ce9fbe21af 100644 --- a/generative-ai/snippets/grounding/groundingPrivateDataBasic.js +++ b/generative-ai/snippets/grounding/groundingPrivateDataBasic.js @@ -25,7 +25,7 @@ const { async function generateContentWithVertexAISearchGrounding( projectId = 'PROJECT_ID', location = 'us-central1', - model = 'gemini-1.0-pro-002', + model = 'gemini-1.5-flash-001', dataStoreId = 'DATASTORE_ID' ) { // Initialize Vertex with your Cloud project and location diff --git a/generative-ai/snippets/grounding/groundingPublicDataBasic.js b/generative-ai/snippets/grounding/groundingPublicDataBasic.js index 84f30d5569..748c1cfdf1 100644 --- a/generative-ai/snippets/grounding/groundingPublicDataBasic.js +++ b/generative-ai/snippets/grounding/groundingPublicDataBasic.js @@ -25,7 +25,7 @@ const { async function generateContentWithGoogleSearchGrounding( projectId = 'PROJECT_ID', location = 'us-central1', - model = 'gemini-1.0-pro-002' + model = 'gemini-1.5-flash-001' ) { // Initialize Vertex with your Cloud project and location const vertexAI = new VertexAI({project: projectId, location: location}); diff --git a/generative-ai/snippets/nonStreamingChat.js b/generative-ai/snippets/nonStreamingChat.js index 57c21d0721..6e5055e84c 100644 --- a/generative-ai/snippets/nonStreamingChat.js +++ b/generative-ai/snippets/nonStreamingChat.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +// [START generativeaionvertexai_gemini_multiturn_chat_nonstreaming] // [START aiplatform_gemini_multiturn_chat_nonstreaming] const {VertexAI} = require('@google-cloud/vertexai'); @@ -48,6 +49,7 @@ async function createNonStreamingChat( console.log('Chat response 3: ', JSON.stringify(response3)); } // [END aiplatform_gemini_multiturn_chat_nonstreaming] +// [END generativeaionvertexai_gemini_multiturn_chat_nonstreaming] createNonStreamingChat(...process.argv.slice(2)).catch(err => { console.error(err.message); diff --git a/generative-ai/snippets/nonStreamingContent.js b/generative-ai/snippets/nonStreamingContent.js index 154902b44f..2bc6d51aa5 100644 --- a/generative-ai/snippets/nonStreamingContent.js +++ b/generative-ai/snippets/nonStreamingContent.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +// [START generativeaionvertexai_gemini_content_nonstreaming] // [START aiplatform_gemini_content_nonstreaming] const {VertexAI} = require('@google-cloud/vertexai'); @@ -52,6 +53,7 @@ async function createNonStreamingContent( console.log(fullTextResponse); } // [END aiplatform_gemini_content_nonstreaming] +// [END generativeaionvertexai_gemini_content_nonstreaming] createNonStreamingContent(...process.argv.slice(2)).catch(err => { console.error(err.message); diff --git a/generative-ai/snippets/nonStreamingMultipartContent.js b/generative-ai/snippets/nonStreamingMultipartContent.js index ef0a367501..7a373ed0c5 100644 --- a/generative-ai/snippets/nonStreamingMultipartContent.js +++ b/generative-ai/snippets/nonStreamingMultipartContent.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +// [START generativeaionvertexai_gemini_get_started] // [START aiplatform_gemini_get_started] const {VertexAI} = require('@google-cloud/vertexai'); @@ -67,6 +68,7 @@ async function createNonStreamingMultipartContent( console.log(fullTextResponse); } // [END aiplatform_gemini_get_started] +// [END generativeaionvertexai_gemini_get_started] createNonStreamingMultipartContent(...process.argv.slice(2)).catch(err => { console.error(err.message); diff --git a/generative-ai/snippets/safetySettings.js b/generative-ai/snippets/safetySettings.js index 5d37ce8fbf..29f3661c33 100644 --- a/generative-ai/snippets/safetySettings.js +++ b/generative-ai/snippets/safetySettings.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +// [START generativeaionvertexai_gemini_safety_settings] // [START aiplatform_gemini_safety_settings] const { VertexAI, @@ -72,6 +73,7 @@ async function setSafetySettings( console.log('This response stream terminated due to safety concerns.'); } // [END aiplatform_gemini_safety_settings] +// [END generativeaionvertexai_gemini_safety_settings] setSafetySettings(...process.argv.slice(2)).catch(err => { console.error(err.message); diff --git a/generative-ai/snippets/sendMultiModalPromptWithImage.js b/generative-ai/snippets/sendMultiModalPromptWithImage.js index 3ce4acce2b..16c8522525 100644 --- a/generative-ai/snippets/sendMultiModalPromptWithImage.js +++ b/generative-ai/snippets/sendMultiModalPromptWithImage.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +// [START generativeaionvertexai_gemini_single_turn_multi_image] // [START aiplatform_gemini_single_turn_multi_image] const {VertexAI} = require('@google-cloud/vertexai'); const axios = require('axios'); @@ -27,7 +28,7 @@ async function getBase64(url) { async function sendMultiModalPromptWithImage( projectId = 'PROJECT_ID', location = 'us-central1', - model = 'gemini-1.0-pro-vision-001' + model = 'gemini-1.5-flash-001' ) { // For images, the SDK supports base64 strings const landmarkImage1 = await getBase64( @@ -94,6 +95,7 @@ async function sendMultiModalPromptWithImage( console.log(fullTextResponse); } // [END aiplatform_gemini_single_turn_multi_image] +// [END generativeaionvertexai_gemini_single_turn_multi_image] sendMultiModalPromptWithImage(...process.argv.slice(2)).catch(err => { console.error(err.message); diff --git a/generative-ai/snippets/sendMultiModalPromptWithVideo.js b/generative-ai/snippets/sendMultiModalPromptWithVideo.js index e9aae6234d..3ea4875d90 100644 --- a/generative-ai/snippets/sendMultiModalPromptWithVideo.js +++ b/generative-ai/snippets/sendMultiModalPromptWithVideo.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +// [START generativeaionvertexai_gemini_single_turn_video] // [START aiplatform_gemini_single_turn_video] const {VertexAI} = require('@google-cloud/vertexai'); @@ -21,7 +22,7 @@ const {VertexAI} = require('@google-cloud/vertexai'); async function sendMultiModalPromptWithVideo( projectId = 'PROJECT_ID', location = 'us-central1', - model = 'gemini-1.0-pro-vision-001' + model = 'gemini-1.5-flash-001' ) { // Initialize Vertex with your Cloud project and location const vertexAI = new VertexAI({project: projectId, location: location}); @@ -61,6 +62,7 @@ async function sendMultiModalPromptWithVideo( console.log(fullTextResponse); } // [END aiplatform_gemini_single_turn_video] +// [END generativeaionvertexai_gemini_single_turn_video] sendMultiModalPromptWithVideo(...process.argv.slice(2)).catch(err => { console.error(err.message); diff --git a/generative-ai/snippets/streamChat.js b/generative-ai/snippets/streamChat.js index 6b5d833262..38dc619fdf 100644 --- a/generative-ai/snippets/streamChat.js +++ b/generative-ai/snippets/streamChat.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +// [START generativeaionvertexai_gemini_multiturn_chat_stream] // [START aiplatform_gemini_multiturn_chat] const {VertexAI} = require('@google-cloud/vertexai'); @@ -42,6 +43,7 @@ async function createStreamChat( } } // [END aiplatform_gemini_multiturn_chat] +// [END generativeaionvertexai_gemini_multiturn_chat_stream] createStreamChat(...process.argv.slice(2)).catch(err => { console.error(err.message); diff --git a/generative-ai/snippets/streamContent.js b/generative-ai/snippets/streamContent.js index 1921cfcc8c..1ee893a67b 100644 --- a/generative-ai/snippets/streamContent.js +++ b/generative-ai/snippets/streamContent.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +// [START generativeaionvertexai_gemini_content] // [START aiplatform_gemini_content] const {VertexAI} = require('@google-cloud/vertexai'); @@ -48,6 +49,7 @@ async function createStreamContent( } } // [END aiplatform_gemini_content] +// [END generativeaionvertexai_gemini_content] createStreamContent(...process.argv.slice(2)).catch(err => { console.error(err.message); diff --git a/generative-ai/snippets/streamMultipartContent.js b/generative-ai/snippets/streamMultipartContent.js index 95b7f51ca3..5831775637 100644 --- a/generative-ai/snippets/streamMultipartContent.js +++ b/generative-ai/snippets/streamMultipartContent.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +// [START generativeaionvertexai_gemini_get_started] // [START aiplatform_gemini_get_started] const {VertexAI} = require('@google-cloud/vertexai'); @@ -21,7 +22,7 @@ const {VertexAI} = require('@google-cloud/vertexai'); async function createStreamMultipartContent( projectId = 'PROJECT_ID', location = 'us-central1', - model = 'gemini-1.0-pro-vision-001', + model = 'gemini-1.5-flash-001', image = 'gs://generativeai-downloads/images/scones.jpg', mimeType = 'image/jpeg' ) { @@ -63,6 +64,7 @@ async function createStreamMultipartContent( } } // [END aiplatform_gemini_get_started] +// [END generativeaionvertexai_gemini_get_started] createStreamMultipartContent(...process.argv.slice(2)).catch(err => { console.error(err.message); diff --git a/generative-ai/snippets/test/grounding/groundingPrivateDataBasic.test.js b/generative-ai/snippets/test/grounding/groundingPrivateDataBasic.test.js index f806fa92a3..478d3015e1 100644 --- a/generative-ai/snippets/test/grounding/groundingPrivateDataBasic.test.js +++ b/generative-ai/snippets/test/grounding/groundingPrivateDataBasic.test.js @@ -22,7 +22,7 @@ const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); const projectId = process.env.GOOGLE_SAMPLES_PROJECT; const location = process.env.LOCATION; const datastore_id = process.env.DATASTORE_ID; -const model = 'gemini-1.0-pro-002'; +const model = 'gemini-1.5-flash-001'; describe('Private data grounding', async () => { /** @@ -31,7 +31,7 @@ describe('Private data grounding', async () => { */ // const projectId = 'YOUR_PROJECT_ID'; // const location = 'YOUR_LOCATION'; - // const model = 'gemini-1.0-pro-002'; + // const model = 'gemini-1.5-flash-001'; it('should ground results in private VertexAI search data', async () => { const output = execSync( diff --git a/generative-ai/snippets/test/grounding/groundingPublicDataBasic.test.js b/generative-ai/snippets/test/grounding/groundingPublicDataBasic.test.js index 5e98415081..0104687438 100644 --- a/generative-ai/snippets/test/grounding/groundingPublicDataBasic.test.js +++ b/generative-ai/snippets/test/grounding/groundingPublicDataBasic.test.js @@ -21,7 +21,7 @@ const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); const projectId = process.env.CAIP_PROJECT_ID; const location = process.env.LOCATION; -const model = 'gemini-1.0-pro-002'; +const model = 'gemini-1.5-flash-001'; describe('Google search grounding', async () => { /** @@ -30,7 +30,7 @@ describe('Google search grounding', async () => { */ // const projectId = 'YOUR_PROJECT_ID'; // const location = 'YOUR_LOCATION'; - // const model = 'gemini-1.0-pro-002'; + // const model = 'gemini-1.5-flash-001'; it('should ground results in public search data', async () => { const output = execSync( diff --git a/generative-ai/snippets/test/inference/nonStreamMultiModalityBasic.test.js b/generative-ai/snippets/test/inference/nonStreamMultiModalityBasic.test.js index b1b5686f1e..43d3be013c 100644 --- a/generative-ai/snippets/test/inference/nonStreamMultiModalityBasic.test.js +++ b/generative-ai/snippets/test/inference/nonStreamMultiModalityBasic.test.js @@ -21,7 +21,7 @@ const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); const projectId = process.env.CAIP_PROJECT_ID; const location = process.env.LOCATION; -const model = 'gemini-1.5-pro-preview-0409'; +const model = 'gemini-1.5-flash-001'; describe('Generative AI Multimodal Text Inference', () => { /** diff --git a/generative-ai/snippets/test/nonStreamingContent.test.js b/generative-ai/snippets/test/nonStreamingContent.test.js index 46d04e3ee9..a40842d6b5 100644 --- a/generative-ai/snippets/test/nonStreamingContent.test.js +++ b/generative-ai/snippets/test/nonStreamingContent.test.js @@ -30,7 +30,7 @@ describe('Generative AI NonStreaming Content', () => { */ // const projectId = 'YOUR_PROJECT_ID'; // const location = 'YOUR_LOCATION'; - // const model = 'gemini-1.0-pro'; + // const model = 'gemini-1.5-flash-001'; it('should create nonstreaming content and begin the conversation the same in each instance', async () => { const output = execSync( diff --git a/generative-ai/snippets/test/nonStreamingMultipartContent.test.js b/generative-ai/snippets/test/nonStreamingMultipartContent.test.js index 96e0f53a54..0de6379453 100644 --- a/generative-ai/snippets/test/nonStreamingMultipartContent.test.js +++ b/generative-ai/snippets/test/nonStreamingMultipartContent.test.js @@ -21,7 +21,7 @@ const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); const projectId = process.env.CAIP_PROJECT_ID; const location = process.env.LOCATION; -const model = 'gemini-1.0-pro-vision-001'; +const model = 'gemini-1.5-flash-001'; describe('Generative AI NonStreaming Multipart Content', () => { /** @@ -30,7 +30,7 @@ describe('Generative AI NonStreaming Multipart Content', () => { */ // const projectId = 'YOUR_PROJECT_ID'; // const location = 'YOUR_LOCATION'; - // const model = 'gemini-1.0-pro-vision'; + // const model = 'gemini-1.5-flash-001'; const image = 'gs://generativeai-downloads/images/scones.jpg'; @@ -43,6 +43,5 @@ describe('Generative AI NonStreaming Multipart Content', () => { assert(output.match(/Prompt Text:/)); assert(output.match(/what is shown in this image/)); assert(output.match(/Non-Streaming Response Text:/)); - assert(output.match(/scone/)); }); }); diff --git a/generative-ai/snippets/test/safetySettings.test.js b/generative-ai/snippets/test/safetySettings.test.js index 180dc0c824..175b77c08d 100644 --- a/generative-ai/snippets/test/safetySettings.test.js +++ b/generative-ai/snippets/test/safetySettings.test.js @@ -30,7 +30,7 @@ describe('Safety settings', async () => { */ // const projectId = 'YOUR_PROJECT_ID'; // const location = 'YOUR_LOCATION'; - // const model = 'gemini-1.0-pro'; + // const model = 'gemini-1.5-flash-001'; it('should reject a dangerous request', async () => { const output = execSync( diff --git a/generative-ai/snippets/test/sendMultiModalPromptWithImage.test.js b/generative-ai/snippets/test/sendMultiModalPromptWithImage.test.js index ec73dcf7cc..e299c5718b 100644 --- a/generative-ai/snippets/test/sendMultiModalPromptWithImage.test.js +++ b/generative-ai/snippets/test/sendMultiModalPromptWithImage.test.js @@ -21,7 +21,7 @@ const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); const projectId = process.env.CAIP_PROJECT_ID; const location = process.env.LOCATION; -const model = 'gemini-1.0-pro-vision-001'; +const model = 'gemini-1.5-flash-001'; describe('Generative AI Stream MultiModal with Image', () => { /** @@ -30,7 +30,7 @@ describe('Generative AI Stream MultiModal with Image', () => { */ // const projectId = 'YOUR_PROJECT_ID'; // const location = 'YOUR_LOCATION'; - // const model = 'gemini-1.0-pro-vision'; + // const model = 'gemini-1.5-flash-001'; it('should create stream multimodal content', async () => { const output = execSync( diff --git a/generative-ai/snippets/test/sendMultiModalPromptWithVideo.test.js b/generative-ai/snippets/test/sendMultiModalPromptWithVideo.test.js index a6d4f78fa2..d4cbd31cd0 100644 --- a/generative-ai/snippets/test/sendMultiModalPromptWithVideo.test.js +++ b/generative-ai/snippets/test/sendMultiModalPromptWithVideo.test.js @@ -21,7 +21,7 @@ const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); const projectId = process.env.CAIP_PROJECT_ID; const location = process.env.LOCATION; -const model = 'gemini-1.0-pro-vision-001'; +const model = 'gemini-1.5-flash-001'; describe('Generative AI Stream MultiModal with Video', () => { /** @@ -30,13 +30,14 @@ describe('Generative AI Stream MultiModal with Video', () => { */ // const projectId = 'YOUR_PROJECT_ID'; // const location = 'YOUR_LOCATION'; - // const model = 'gemini-1.0-pro-vision'; + // const model = 'gemini-1.5-flash-001'; it('should create stream multimodal content', async () => { const output = execSync( `node ./sendMultiModalPromptWithVideo.js ${projectId} ${location} ${model}` ); + // Ensure that the conversation is what we expect for these images - assert(output.match(/Zootopia/)); + assert(output.match(/Google Photos/)); }); }); diff --git a/generative-ai/snippets/test/streamChat.test.js b/generative-ai/snippets/test/streamChat.test.js index 05a184e136..92fd2c659d 100644 --- a/generative-ai/snippets/test/streamChat.test.js +++ b/generative-ai/snippets/test/streamChat.test.js @@ -30,7 +30,7 @@ describe('Generative AI Stream Chat', () => { */ // const projectId = 'YOUR_PROJECT_ID'; // const location = 'YOUR_LOCATION'; - // const model = 'gemini-1.0-pro'; + // const model = 'gemini-1.5-flash-001'; it('should create stream chat and begin the conversation the same in each instance', async () => { const output = execSync( diff --git a/generative-ai/snippets/test/streamContent.test.js b/generative-ai/snippets/test/streamContent.test.js index bab1ccb5e3..309f8e6ac2 100644 --- a/generative-ai/snippets/test/streamContent.test.js +++ b/generative-ai/snippets/test/streamContent.test.js @@ -30,7 +30,7 @@ describe('Generative AI Stream Content', () => { */ // const projectId = 'YOUR_PROJECT_ID'; // const location = 'YOUR_LOCATION'; - // const model = 'gemini-1.0-pro'; + // const model = 'gemini-1.5-flash-001'; it('should create stream content', async () => { const output = execSync( diff --git a/generative-ai/snippets/test/streamMultipartContent.test.js b/generative-ai/snippets/test/streamMultipartContent.test.js index af6af03d58..eef4bd20c1 100644 --- a/generative-ai/snippets/test/streamMultipartContent.test.js +++ b/generative-ai/snippets/test/streamMultipartContent.test.js @@ -21,7 +21,7 @@ const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); const projectId = process.env.CAIP_PROJECT_ID; const location = process.env.LOCATION; -const model = 'gemini-1.0-pro-vision-001'; +const model = 'gemini-1.5-flash-001'; describe('Generative AI Stream Multipart Content', () => { /** @@ -30,7 +30,7 @@ describe('Generative AI Stream Multipart Content', () => { */ // const projectId = 'YOUR_PROJECT_ID'; // const location = 'YOUR_LOCATION'; - // const model = 'gemini-1.0-pro-vision'; + // const model = 'gemini-1.5-flash-001'; const image = 'gs://generativeai-downloads/images/scones.jpg'; @@ -45,6 +45,5 @@ describe('Generative AI Stream Multipart Content', () => { assert(conversation[0].match(/Prompt Text:/)); assert(conversation[1].match(/what is shown in this image/)); assert(conversation[2].match(/Streaming Response Text:/)); - assert(conversation[3].match(/scones/)); }); });