Skip to content

Commit 9577b8e

Browse files
author
Guiners
committed
adding samples, test, lints
1 parent e20d7fd commit 9577b8e

File tree

4 files changed

+40
-36
lines changed

4 files changed

+40
-36
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,12 @@ async function generateContent(projectId = GOOGLE_CLOUD_PROJECT) {
3939
});
4040

4141
console.log(response);
42+
4243
// Example response:
4344
// embeddings=[ContentEmbedding(values=[-0.06302902102470398, 0.00928034819662571, 0.014716853387653828, -0.028747491538524628, ... ],
4445
// statistics=ContentEmbeddingStatistics(truncated=False, token_count=13.0))]
4546
// metadata=EmbedContentMetadata(billable_character_count=112)
47+
4648
return response;
4749
}
4850
// [END googlegenaisdk_embeddings_docretrieval_with_txt]

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@ async function generateContent(apiKey = API_KEY) {
3131

3232
console.log(response.text);
3333

34+
// Example response:
35+
// Bubble Sort is a simple sorting algorithm that repeatedly steps through the list
36+
3437
return response;
3538
}
36-
// Example response:
37-
// Bubble Sort is a simple sorting algorithm that repeatedly steps through the list
3839
// [END googlegenaisdk_vertexai_express_mode]
3940

4041
module.exports = {

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ async function generateContent(
4646
});
4747

4848
console.log(response.text);
49-
49+
// Example response:
50+
// Okay, let's break down how AI works. It's a broad field, so I'll focus on the ...
51+
// Here's a simplified overview:
52+
// ...
5053
return response.text;
5154
}
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-
// ...
55+
5656
// [END googlegenaisdk_provisionedthroughput_with_txt]
5757

5858
module.exports = {

genai/safety/safety-with-txt.js

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -75,37 +75,38 @@ async function generateContent(
7575
console.log('Severity Score:', each.severityScore);
7676
}
7777

78+
// Example response:
79+
//
80+
// Category: HarmCategory.HARM_CATEGORY_HATE_SPEECH
81+
// Is Blocked: False
82+
// Probability: HarmProbability.NEGLIGIBLE
83+
// Probability Score: 2.547714e-05
84+
// Severity: HarmSeverity.HARM_SEVERITY_NEGLIGIBLE
85+
// Severity Score: None
86+
//
87+
// Category: HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT
88+
// Is Blocked: False
89+
// Probability: HarmProbability.NEGLIGIBLE
90+
// Probability Score: 3.6103818e-06
91+
// Severity: HarmSeverity.HARM_SEVERITY_NEGLIGIBLE
92+
// Severity Score: None
93+
//
94+
// Category: HarmCategory.HARM_CATEGORY_HARASSMENT
95+
// Is Blocked: True
96+
// Probability: HarmProbability.MEDIUM
97+
// Probability Score: 0.71599233
98+
// Severity: HarmSeverity.HARM_SEVERITY_MEDIUM
99+
// Severity Score: 0.30782545
100+
//
101+
// Category: HarmCategory.HARM_CATEGORY_SEXUALLY_EXPLICIT
102+
// Is Blocked: False
103+
// Probability: HarmProbability.NEGLIGIBLE
104+
// Probability Score: 1.5624657e-05
105+
// Severity: HarmSeverity.HARM_SEVERITY_NEGLIGIBLE
106+
// Severity Score: None
107+
78108
return response;
79109
}
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
109110

110111
// [END googlegenaisdk_safety_with_txt]
111112

0 commit comments

Comments
 (0)