From 02b6a8202267b1e9608c99e83552dc6f1623ddac Mon Sep 17 00:00:00 2001 From: "pattishin@google.com" Date: Tue, 19 Dec 2023 20:49:28 -0800 Subject: [PATCH] refactor: replace hardcoded location with environment variable --- generative-ai/snippets/test/countTokens.test.js | 2 +- generative-ai/snippets/test/nonStreamingChat.test.js | 2 +- generative-ai/snippets/test/nonStreamingContent.test.js | 2 +- .../snippets/test/nonStreamingMultipartContent.test.js | 2 +- generative-ai/snippets/test/safetySettings.test.js | 2 +- .../snippets/test/sendMultiModalPromptWithImage.test.js | 2 +- .../snippets/test/sendMultiModalPromptWithVideo.test.js | 2 +- generative-ai/snippets/test/streamChat.test.js | 2 +- generative-ai/snippets/test/streamContent.test.js | 2 +- generative-ai/snippets/test/streamMultipartContent.test.js | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/generative-ai/snippets/test/countTokens.test.js b/generative-ai/snippets/test/countTokens.test.js index 56e6002927..9069f7a018 100644 --- a/generative-ai/snippets/test/countTokens.test.js +++ b/generative-ai/snippets/test/countTokens.test.js @@ -20,7 +20,7 @@ const cp = require('child_process'); const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); const projectId = process.env.CAIP_PROJECT_ID; -const location = 'europe-west4'; +const location = process.env.LOCATION; const model = 'gemini-pro'; describe('Count tokens', async () => { diff --git a/generative-ai/snippets/test/nonStreamingChat.test.js b/generative-ai/snippets/test/nonStreamingChat.test.js index 202d8237f7..53af894b9f 100644 --- a/generative-ai/snippets/test/nonStreamingChat.test.js +++ b/generative-ai/snippets/test/nonStreamingChat.test.js @@ -20,7 +20,7 @@ const cp = require('child_process'); const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); const projectId = process.env.CAIP_PROJECT_ID; -const location = 'europe-west4'; +const location = process.env.LOCATION; const model = 'gemini-pro'; describe('Generative AI NonStreaming Chat', async () => { diff --git a/generative-ai/snippets/test/nonStreamingContent.test.js b/generative-ai/snippets/test/nonStreamingContent.test.js index 16ca584f58..21e3f5e6a1 100644 --- a/generative-ai/snippets/test/nonStreamingContent.test.js +++ b/generative-ai/snippets/test/nonStreamingContent.test.js @@ -20,7 +20,7 @@ const cp = require('child_process'); const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); const projectId = process.env.CAIP_PROJECT_ID; -const location = 'europe-west4'; +const location = process.env.LOCATION; const model = 'gemini-pro'; describe('Generative AI NonStreaming Content', () => { diff --git a/generative-ai/snippets/test/nonStreamingMultipartContent.test.js b/generative-ai/snippets/test/nonStreamingMultipartContent.test.js index 369110e81c..16625ebcf9 100644 --- a/generative-ai/snippets/test/nonStreamingMultipartContent.test.js +++ b/generative-ai/snippets/test/nonStreamingMultipartContent.test.js @@ -20,7 +20,7 @@ const cp = require('child_process'); const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); const projectId = process.env.CAIP_PROJECT_ID; -const location = 'europe-west4'; +const location = process.env.LOCATION; const model = 'gemini-pro-vision'; describe('Generative AI NonStreaming Multipart Content', () => { diff --git a/generative-ai/snippets/test/safetySettings.test.js b/generative-ai/snippets/test/safetySettings.test.js index ab364577a7..3c58262022 100644 --- a/generative-ai/snippets/test/safetySettings.test.js +++ b/generative-ai/snippets/test/safetySettings.test.js @@ -20,7 +20,7 @@ const cp = require('child_process'); const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); const projectId = process.env.CAIP_PROJECT_ID; -const location = 'europe-west4'; +const location = process.env.LOCATION; const model = 'gemini-pro'; describe('Safety settings', async () => { diff --git a/generative-ai/snippets/test/sendMultiModalPromptWithImage.test.js b/generative-ai/snippets/test/sendMultiModalPromptWithImage.test.js index 3ca33dd30e..d4016f9f45 100644 --- a/generative-ai/snippets/test/sendMultiModalPromptWithImage.test.js +++ b/generative-ai/snippets/test/sendMultiModalPromptWithImage.test.js @@ -20,7 +20,7 @@ const cp = require('child_process'); const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); const projectId = process.env.CAIP_PROJECT_ID; -const location = 'europe-west4'; +const location = process.env.LOCATION; const model = 'gemini-pro-vision'; describe('Generative AI Stream MultiModal with Image', () => { diff --git a/generative-ai/snippets/test/sendMultiModalPromptWithVideo.test.js b/generative-ai/snippets/test/sendMultiModalPromptWithVideo.test.js index da34548a93..00d5186ede 100644 --- a/generative-ai/snippets/test/sendMultiModalPromptWithVideo.test.js +++ b/generative-ai/snippets/test/sendMultiModalPromptWithVideo.test.js @@ -20,7 +20,7 @@ const cp = require('child_process'); const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); const projectId = process.env.CAIP_PROJECT_ID; -const location = 'europe-west4'; +const location = process.env.LOCATION; const model = 'gemini-pro-vision'; describe('Generative AI Stream MultiModal with Video', () => { diff --git a/generative-ai/snippets/test/streamChat.test.js b/generative-ai/snippets/test/streamChat.test.js index 7c8f3eb215..bf0317e14e 100644 --- a/generative-ai/snippets/test/streamChat.test.js +++ b/generative-ai/snippets/test/streamChat.test.js @@ -20,7 +20,7 @@ const cp = require('child_process'); const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); const projectId = process.env.CAIP_PROJECT_ID; -const location = 'europe-west4'; +const location = process.env.LOCATION; const model = 'gemini-pro'; describe('Generative AI Stream Chat', () => { diff --git a/generative-ai/snippets/test/streamContent.test.js b/generative-ai/snippets/test/streamContent.test.js index a2fa00da48..2422efe30d 100644 --- a/generative-ai/snippets/test/streamContent.test.js +++ b/generative-ai/snippets/test/streamContent.test.js @@ -20,7 +20,7 @@ const cp = require('child_process'); const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); const projectId = process.env.CAIP_PROJECT_ID; -const location = 'europe-west4'; +const location = process.env.LOCATION; const model = 'gemini-pro'; describe('Generative AI Stream Content', () => { diff --git a/generative-ai/snippets/test/streamMultipartContent.test.js b/generative-ai/snippets/test/streamMultipartContent.test.js index 7920e49ad2..2b3062baa9 100644 --- a/generative-ai/snippets/test/streamMultipartContent.test.js +++ b/generative-ai/snippets/test/streamMultipartContent.test.js @@ -20,7 +20,7 @@ const cp = require('child_process'); const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); const projectId = process.env.CAIP_PROJECT_ID; -const location = 'europe-west4'; +const location = process.env.LOCATION; const model = 'gemini-pro-vision'; describe('Generative AI Stream Multipart Content', () => {