Skip to content

Commit 53737ae

Browse files
author
Cloud Shell
committed
chore: lint functionCallingStreamContent
1 parent 17f45a3 commit 53737ae

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

generative-ai/snippets/functionCallingStreamContent.js

+10-8
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@
1313
// limitations under the License.
1414

1515
// [START aiplatform_gemini_function_calling_content]
16-
const { VertexAI, FunctionDeclarationSchemaType } = require('@google-cloud/vertexai');
16+
const {
17+
VertexAI,
18+
FunctionDeclarationSchemaType,
19+
} = require('@google-cloud/vertexai');
1720

1821
const functionDeclarations = [
1922
{
@@ -24,7 +27,7 @@ const functionDeclarations = [
2427
parameters: {
2528
type: FunctionDeclarationSchemaType.OBJECT,
2629
properties: {
27-
location: { type: FunctionDeclarationSchemaType.STRING },
30+
location: {type: FunctionDeclarationSchemaType.STRING},
2831
unit: {
2932
type: FunctionDeclarationSchemaType.STRING,
3033
enum: ['celsius', 'fahrenheit'],
@@ -41,8 +44,7 @@ const functionResponseParts = [
4144
{
4245
functionResponse: {
4346
name: 'get_current_weather',
44-
response:
45-
{ name: 'get_current_weather', content: { weather: 'super nice' } },
47+
response: {name: 'get_current_weather', content: { weather: 'super nice' }},
4648
},
4749
},
4850
];
@@ -56,7 +58,7 @@ async function functionCallingStreamChat(
5658
model = 'gemini-pro'
5759
) {
5860
// Initialize Vertex with your Cloud project and location
59-
const vertexAI = new VertexAI({ project: projectId, location: location });
61+
const vertexAI = new VertexAI({project: projectId, location: location});
6062

6163
// Instantiate the model
6264
const generativeModel = vertexAI.preview.getGenerativeModel({
@@ -65,9 +67,9 @@ async function functionCallingStreamChat(
6567

6668
const request = {
6769
contents: [
68-
{ role: 'user', parts: [{ text: 'What is the weather in Boston?' }] },
69-
{ role: 'model', parts: [{ functionCall: { name: 'get_current_weather', args: { 'location': 'Boston' } } }] },
70-
{ role: 'function', parts: functionResponseParts }
70+
{role: 'user', parts: [{ text: 'What is the weather in Boston?' }]},
71+
{role: 'model', parts: [{ functionCall: { name: 'get_current_weather', args: { 'location': 'Boston' } } }]},
72+
{role: 'function', parts: functionResponseParts },
7173
],
7274
tools: functionDeclarations,
7375
};

0 commit comments

Comments
 (0)