Skip to content

Commit e20d7fd

Browse files
author
Guiners
committed
adding samples, test, lints
1 parent 7cc334d commit e20d7fd

File tree

4 files changed

+42
-3
lines changed

4 files changed

+42
-3
lines changed

genai/embeddings/embeddings-docretrieval-with-txt.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ async function generateContent(projectId = GOOGLE_CLOUD_PROJECT) {
3939
});
4040

4141
console.log(response);
42-
42+
// Example response:
43+
// embeddings=[ContentEmbedding(values=[-0.06302902102470398, 0.00928034819662571, 0.014716853387653828, -0.028747491538524628, ... ],
44+
// statistics=ContentEmbeddingStatistics(truncated=False, token_count=13.0))]
45+
// metadata=EmbedContentMetadata(billable_character_count=112)
4346
return response;
4447
}
4548
// [END googlegenaisdk_embeddings_docretrieval_with_txt]

genai/express-mode/api-key-example.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ async function generateContent(apiKey = API_KEY) {
3333

3434
return response;
3535
}
36+
// Example response:
37+
// Bubble Sort is a simple sorting algorithm that repeatedly steps through the list
3638
// [END googlegenaisdk_vertexai_express_mode]
3739

3840
module.exports = {

genai/provisioned-throughput/provisionedthroughput-with-txt.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
'use strict';
1616

17-
// [START googlegenaisdk_googlegenaisdk_provisionedthroughput_with_txt]
17+
// [START googlegenaisdk_provisionedthroughput_with_txt]
1818
const {GoogleGenAI} = require('@google/genai');
1919

2020
const GOOGLE_CLOUD_PROJECT = process.env.GOOGLE_CLOUD_PROJECT;
@@ -49,7 +49,11 @@ async function generateContent(
4949

5050
return response.text;
5151
}
52-
// [END googlegenaisdk_googlegenaisdk_provisionedthroughput_with_txt]
52+
// Example response:
53+
// Okay, let's break down how AI works. It's a broad field, so I'll focus on the ...
54+
// Here's a simplified overview:
55+
// ...
56+
// [END googlegenaisdk_provisionedthroughput_with_txt]
5357

5458
module.exports = {
5559
generateContent,

genai/safety/safety-with-txt.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,36 @@ async function generateContent(
7777

7878
return response;
7979
}
80+
// Example response:
81+
//
82+
// Category: HarmCategory.HARM_CATEGORY_HATE_SPEECH
83+
// Is Blocked: False
84+
// Probability: HarmProbability.NEGLIGIBLE
85+
// Probability Score: 2.547714e-05
86+
// Severity: HarmSeverity.HARM_SEVERITY_NEGLIGIBLE
87+
// Severity Score: None
88+
//
89+
// Category: HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT
90+
// Is Blocked: False
91+
// Probability: HarmProbability.NEGLIGIBLE
92+
// Probability Score: 3.6103818e-06
93+
// Severity: HarmSeverity.HARM_SEVERITY_NEGLIGIBLE
94+
// Severity Score: None
95+
//
96+
// Category: HarmCategory.HARM_CATEGORY_HARASSMENT
97+
// Is Blocked: True
98+
// Probability: HarmProbability.MEDIUM
99+
// Probability Score: 0.71599233
100+
// Severity: HarmSeverity.HARM_SEVERITY_MEDIUM
101+
// Severity Score: 0.30782545
102+
//
103+
// Category: HarmCategory.HARM_CATEGORY_SEXUALLY_EXPLICIT
104+
// Is Blocked: False
105+
// Probability: HarmProbability.NEGLIGIBLE
106+
// Probability Score: 1.5624657e-05
107+
// Severity: HarmSeverity.HARM_SEVERITY_NEGLIGIBLE
108+
// Severity Score: None
109+
80110
// [END googlegenaisdk_safety_with_txt]
81111

82112
module.exports = {

0 commit comments

Comments
 (0)