Skip to content

Commit f7f1b54

Browse files
author
Guiners
committed
fixing code from code review and adding linters
1 parent 5dd5c77 commit f7f1b54

9 files changed

+19
-19
lines changed

genai/controlled-generation/ctrlgen-with-class-schema.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ async function generateContent(
3232

3333
class Recipe {
3434
/**
35-
* @param {string} recipe_name
35+
* @param {string} recipeName
3636
* @param {string[]} ingredients
3737
*/
38-
constructor(recipe_name, ingredients) {
39-
this.recipe_name = recipe_name;
38+
constructor(recipeName, ingredients) {
39+
this.recipeName = recipeName;
4040
this.ingredients = ingredients;
4141
}
4242
}

genai/controlled-generation/ctrlgen-with-nested-class-schema.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ async function generateContent(
4141

4242
class Recipe {
4343
/**
44-
* @param {string} recipe_name
44+
* @param {string} recipeName
4545
* @param {string} rating - Must be one of Grade enum values
4646
*/
47-
constructor(recipe_name, rating) {
47+
constructor(recipeName, rating) {
4848
if (!Object.values(Grade).includes(rating)) {
4949
throw new Error(`Invalid rating: ${rating}`);
5050
}
51-
this.recipe_name = recipe_name;
51+
this.recipeName = recipeName;
5252
this.rating = rating;
5353
}
5454
}

genai/controlled-generation/ctrlgen-with-nullable-schema.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ async function generateContent(
5353
Forecast: {type: 'string', nullable: true},
5454
Temperature: {type: 'integer', nullable: true},
5555
Humidity: {type: 'string', nullable: true},
56-
'Wind Speed': {type: 'integer', nullable: true},
56+
WindSpeed: {type: 'integer', nullable: true},
5757
},
58-
required: ['Day', 'Temperature', 'Forecast', 'Wind Speed'],
58+
required: ['Day', 'Temperature', 'Forecast', 'WindSpeed'],
5959
},
6060
},
6161
},

genai/controlled-generation/ctrlgen-with-resp-schema.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ async function generateContent(
3737
items: {
3838
type: 'OBJECT',
3939
properties: {
40-
recipe_name: {type: 'STRING'},
40+
recipeName: {type: 'STRING'},
4141
ingredients: {
4242
type: 'ARRAY',
4343
items: {type: 'STRING'},
4444
},
4545
},
46-
required: ['recipe_name', 'ingredients'],
46+
required: ['recipeName', 'ingredients'],
4747
},
4848
};
4949

genai/test/ctrlgen-with-enum-class-schema.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ const {describe, it} = require('mocha');
2020
const projectId = process.env.CAIP_PROJECT_ID;
2121
const sample = require('../controlled-generation/ctrlgen-with-enum-class-schema.js');
2222

23-
describe('ctrlgen_with_enum_class_schema', () => {
24-
it('should generate text content in Json', async function () {
23+
describe('ctrlgen-with-enum-class-schema', () => {
24+
it('should generate text content matching enum schema', async function () {
2525
this.timeout(10000);
2626
const output = await sample.generateContent(projectId);
2727
assert(output.length > 0 && output.includes('String'));

genai/test/ctrlgen-with-nested-class-schema.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ const {describe, it} = require('mocha');
2020
const projectId = process.env.CAIP_PROJECT_ID;
2121
const sample = require('../controlled-generation/ctrlgen-with-nested-class-schema.js');
2222

23-
describe('ctrlgen_with_nested_class_schema', () => {
24-
it('should generate text content in Json', async function () {
23+
describe('ctrlgen-with-nested-class-schema', () => {
24+
it('should generate text content using nested schema', async function () {
2525
this.timeout(10000);
2626
const output = await sample.generateContent(projectId);
2727
assert(output.length > 0 && output.includes('B'));

genai/test/ctrlgen-with-nullable-schema.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ const {describe, it} = require('mocha');
2020
const projectId = process.env.CAIP_PROJECT_ID;
2121
const sample = require('../controlled-generation/ctrlgen-with-nullable-schema.js');
2222

23-
describe('ctrlgen_with_nullable_schema', () => {
24-
it('should generate text content in Json', async function () {
23+
describe('ctrlgen-with-nullable-schema', () => {
24+
it('should generate text content using nullable schema', async function () {
2525
this.timeout(10000);
2626
const output = await sample.generateContent(projectId);
2727
assert(output.length > 0 && output.includes('Day'));

genai/test/ctrlgen-with-resp-schema.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ const {describe, it} = require('mocha');
2020
const projectId = process.env.CAIP_PROJECT_ID;
2121
const sample = require('../controlled-generation/ctrlgen-with-resp-schema.js');
2222

23-
describe('ctrlgen_with_resp_schema', () => {
24-
it('should generate text content in Json', async function () {
23+
describe('ctrlgen-with-resp-schema', () => {
24+
it('should generate text content in given schema', async function () {
2525
this.timeout(10000);
2626
const output = await sample.generateContent(projectId);
2727
assert(output.length > 0 && output.includes('Cookies'));

genai/test/tools-code-exec-with-txt.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const {describe, it} = require('mocha');
2020
const projectId = process.env.CAIP_PROJECT_ID;
2121
const sample = require('../tools/tools-code-exec-with-txt.js');
2222

23-
describe('tools-code-exec-with-txt', async () => {
23+
describe('tools-code-exec-with-txt', () => {
2424
it('should generate code and execution result', async function () {
2525
this.timeout(100000);
2626
const output = await sample.generateContent(projectId);

0 commit comments

Comments
 (0)