Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion genai/count-tokens/counttoken-resp-with-txt.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// limitations under the License.

'use strict';

// [START generativeaionvertexai_gemini_token_count]
// [START googlegenaisdk_counttoken_resp_with_txt]
const {GoogleGenAI} = require('@google/genai');

Expand Down Expand Up @@ -41,6 +41,7 @@ async function countTokens(
return response.usageMetadata;
}
// [END googlegenaisdk_counttoken_resp_with_txt]
// [END generativeaionvertexai_gemini_token_count]

module.exports = {
countTokens,
Expand Down
2 changes: 2 additions & 0 deletions genai/count-tokens/counttoken-with-txt-vid.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

'use strict';

// [START generativeaionvertexai_gemini_token_count_advanced]
// [START googlegenaisdk_counttoken_with_txt_vid]
const {GoogleGenAI} = require('@google/genai');

Expand Down Expand Up @@ -47,6 +48,7 @@ async function countTokens(
return response.totalTokens;
}
// [END googlegenaisdk_counttoken_with_txt_vid]
// [END generativeaionvertexai_gemini_token_count_advanced]

module.exports = {
countTokens,
Expand Down
4 changes: 4 additions & 0 deletions genai/text-generation/textgen-sys-instr-with-txt.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

'use strict';

// [START generativeaionvertexai_gemini_translate]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

General question, is it ok to have a double region tag reference for one code snippet?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

more than one region tag can refer to the same code snippet.

additionally, you can have start/end multiple times in the same file. You should not have the same region tag in the same repo in different files.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the clarification @iennae

// [START generativeaionvertexai_gemini_system_instruction]
// [START googlegenaisdk_textgen_sys_instr_with_txt]
const {GoogleGenAI} = require('@google/genai');

Expand Down Expand Up @@ -51,6 +53,8 @@ async function generateContent(
return response.text;
}
// [END googlegenaisdk_textgen_sys_instr_with_txt]
// [END generativeaionvertexai_gemini_system_instruction]
// [END generativeaionvertexai_gemini_translate]

module.exports = {
generateContent,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// limitations under the License.

'use strict';

// [START generativeaionvertexai_gemini_audio_transcription]
// [START googlegenaisdk_textgen_transcript_with_gcs_audio]
const {GoogleGenAI} = require('@google/genai');

Expand Down Expand Up @@ -63,6 +63,7 @@ async function generateText(
}

// [END googlegenaisdk_textgen_transcript_with_gcs_audio]
// [END generativeaionvertexai_gemini_audio_transcription]

module.exports = {
generateText,
Expand Down
3 changes: 2 additions & 1 deletion genai/text-generation/textgen-with-gcs-audio.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// limitations under the License.

'use strict';

// [START generativeaionvertexai_gemini_audio_summarization]
// [START googlegenaisdk_textgen_with_gcs_audio]
const {GoogleGenAI} = require('@google/genai');

Expand Down Expand Up @@ -55,6 +55,7 @@ async function generateText(
return response.text;
}
// [END googlegenaisdk_textgen_with_gcs_audio]
// [END generativeaionvertexai_gemini_audio_summarization]

module.exports = {
generateText,
Expand Down
3 changes: 2 additions & 1 deletion genai/text-generation/textgen-with-pdf.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// limitations under the License.

'use strict';

// [START generativeaionvertexai_gemini_pdf]
// [START googlegenaisdk_textgen_with_pdf]
const {GoogleGenAI} = require('@google/genai');

Expand Down Expand Up @@ -59,6 +59,7 @@ async function generateText(
}

// [END googlegenaisdk_textgen_with_pdf]
// [END generativeaionvertexai_gemini_pdf]

module.exports = {
generateText,
Expand Down
3 changes: 2 additions & 1 deletion genai/text-generation/textgen-with-txt-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// limitations under the License.

'use strict';

// [START generativeaionvertexai_stream_text_basic]
// [START googlegenaisdk_textgen_with_txt_stream]
const {GoogleGenAI} = require('@google/genai');

Expand Down Expand Up @@ -43,6 +43,7 @@ async function generateContent(
return response_text;
}
// [END googlegenaisdk_textgen_with_txt_stream]
// [END generativeaionvertexai_stream_text_basic]

module.exports = {
generateContent,
Expand Down
3 changes: 2 additions & 1 deletion genai/text-generation/textgen-with-txt.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// limitations under the License.

'use strict';

// [START generativeaionvertexai_gemini_generate_from_text_input]
// [START googlegenaisdk_textgen_with_txt]
const {GoogleGenAI} = require('@google/genai');

Expand All @@ -40,6 +40,7 @@ async function generateContent(
return response.text;
}
// [END googlegenaisdk_textgen_with_txt]
// [END generativeaionvertexai_gemini_generate_from_text_input]

module.exports = {
generateContent,
Expand Down
2 changes: 2 additions & 0 deletions genai/tools/tools-func-desc-with-txt.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

'use strict';

// [START generativeaionvertexai_function_calling_advanced]
// [START googlegenaisdk_tools_func_desc_with_txt]
const {GoogleGenAI, Type} = require('@google/genai');

Expand Down Expand Up @@ -99,6 +100,7 @@ async function generateFunctionDesc(
}

// [END googlegenaisdk_tools_func_desc_with_txt]
// [END generativeaionvertexai_function_calling_advanced]

module.exports = {
generateFunctionDesc,
Expand Down
59 changes: 0 additions & 59 deletions generative-ai/snippets/count-tokens/countTokens.js

This file was deleted.

71 changes: 0 additions & 71 deletions generative-ai/snippets/count-tokens/countTokensAdvanced.js

This file was deleted.

This file was deleted.

Loading
Loading