Skip to content

Commit

Permalink
docs(generativeai): add region tags for code samples (#3764)
Browse files Browse the repository at this point in the history
Adding `generativeaionvertexai_` region tags to replace old `aiplatform_`

In near future GenAI code samples, will only use `generativeaionvertexai_` region tag prefix.
  • Loading branch information
msampathkumar authored Aug 10, 2024
1 parent 04125a6 commit 12bf999
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 16 deletions.
2 changes: 0 additions & 2 deletions generative-ai/snippets/count-tokens/countTokens.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
// limitations under the License.

// [START generativeaionvertexai_gemini_token_count]
// [START aiplatform_gemini_token_count]
const {VertexAI} = require('@google-cloud/vertexai');

/**
Expand All @@ -39,7 +38,6 @@ async function countTokens(
const countTokensResp = await generativeModel.countTokens(req);
console.log('count tokens response: ', countTokensResp);
}
// [END aiplatform_gemini_token_count]
// [END generativeaionvertexai_gemini_token_count]

countTokens(...process.argv.slice(2)).catch(err => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
// limitations under the License.

// [START generativeaionvertexai_gemini_function_calling_chat]
// [START aiplatform_gemini_function_calling_chat]
const {
VertexAI,
FunctionDeclarationSchemaType,
Expand Down Expand Up @@ -91,7 +90,6 @@ async function functionCallingStreamChat(
const response2 = await result2.response;
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 => {
Expand Down
2 changes: 0 additions & 2 deletions generative-ai/snippets/nonStreamingMultipartContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
// limitations under the License.

// [START generativeaionvertexai_gemini_get_started]
// [START aiplatform_gemini_get_started]
const {VertexAI} = require('@google-cloud/vertexai');

/**
Expand Down Expand Up @@ -64,7 +63,6 @@ async function createNonStreamingMultipartContent(

console.log(fullTextResponse);
}
// [END aiplatform_gemini_get_started]
// [END generativeaionvertexai_gemini_get_started]

createNonStreamingMultipartContent(...process.argv.slice(2)).catch(err => {
Expand Down
2 changes: 0 additions & 2 deletions generative-ai/snippets/safetySettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
// limitations under the License.

// [START generativeaionvertexai_gemini_safety_settings]
// [START aiplatform_gemini_safety_settings]
const {
VertexAI,
HarmCategory,
Expand Down Expand Up @@ -72,7 +71,6 @@ async function setSafetySettings() {
}
console.log('This response stream terminated due to safety concerns.');
}
// [END aiplatform_gemini_safety_settings]
// [END generativeaionvertexai_gemini_safety_settings]

setSafetySettings().catch(err => {
Expand Down
2 changes: 0 additions & 2 deletions generative-ai/snippets/sendMultiModalPromptWithImage.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
// 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');

Expand Down Expand Up @@ -94,7 +93,6 @@ 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 => {
Expand Down
2 changes: 0 additions & 2 deletions generative-ai/snippets/sendMultiModalPromptWithVideo.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
// limitations under the License.

// [START generativeaionvertexai_gemini_single_turn_video]
// [START aiplatform_gemini_single_turn_video]
const {VertexAI} = require('@google-cloud/vertexai');

/**
Expand Down Expand Up @@ -61,7 +60,6 @@ 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 => {
Expand Down
5 changes: 1 addition & 4 deletions generative-ai/snippets/streamChat.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
// limitations under the License.

// [START generativeaionvertexai_gemini_multiturn_chat_stream]
// [START aiplatform_gemini_multiturn_chat]
// [START generativeaionvertexai_gemini_multiturn_chat]
const {VertexAI} = require('@google-cloud/vertexai');

/**
Expand Down Expand Up @@ -43,8 +41,7 @@ async function createStreamChat(
console.log(item.candidates[0].content.parts[0].text);
}
}
// [END aiplatform_gemini_multiturn_chat]
// [END generativeaionvertexai_gemini_multiturn_chat]

// [END generativeaionvertexai_gemini_multiturn_chat_stream]

createStreamChat(...process.argv.slice(2)).catch(err => {
Expand Down

0 comments on commit 12bf999

Please sign in to comment.