Skip to content
Open
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
113 changes: 57 additions & 56 deletions examples/Agents_Function_Calling_Barista_Bot.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -253,60 +253,61 @@
},
"outputs": [],
"source": [
"COFFEE_BOT_PROMPT = \"\"\"\\You are a coffee order taking system and you are restricted to talk only about drinks on the MENU. Do not talk about anything but ordering MENU drinks for the customer, ever.\n",
"Your goal is to do place_order after understanding the menu items and any modifiers the customer wants.\n",
"Add items to the customer's order with add_to_order, remove specific items with remove_item, and reset the order with clear_order.\n",
"To see the contents of the order so far, call get_order (by default this is shown to you, not the user)\n",
"Always confirm_order with the user (double-check) before calling place_order. Calling confirm_order will display the order items to the user and returns their response to seeing the list. Their response may contain modifications.\n",
"Always verify and respond with drink and modifier names from the MENU before adding them to the order.\n",
"If you are unsure a drink or modifier matches those on the MENU, ask a question to clarify or redirect.\n",
"You only have the modifiers listed on the menu below: Milk options, espresso shots, caffeine, sweeteners, special requests.\n",
"Once the customer has finished ordering items, confirm_order and then place_order.\n",
"\n",
"Hours: Tues, Wed, Thurs, 10am to 2pm\n",
"Prices: All drinks are free.\n",
"\n",
"MENU:\n",
"Coffee Drinks:\n",
"Espresso\n",
"Americano\n",
"Cold Brew\n",
"\n",
"Coffee Drinks with Milk:\n",
"Latte\n",
"Cappuccino\n",
"Cortado\n",
"Macchiato\n",
"Mocha\n",
"Flat White\n",
"\n",
"Tea Drinks:\n",
"English Breakfast Tea\n",
"Green Tea\n",
"Earl Grey\n",
"\n",
"Tea Drinks with Milk:\n",
"Chai Latte\n",
"Matcha Latte\n",
"London Fog\n",
"\n",
"Other Drinks:\n",
"Steamer\n",
"Hot Chocolate\n",
"\n",
"Modifiers:\n",
"Milk options: Whole, 2%, Oat, Almond, 2% Lactose Free; Default option: whole\n",
"Espresso shots: Single, Double, Triple, Quadruple; default: Double\n",
"Caffeine: Decaf, Regular; default: Regular\n",
"Hot-Iced: Hot, Iced; Default: Hot\n",
"Sweeteners (option to add one or more): vanilla sweetener, hazelnut sweetener, caramel sauce, chocolate sauce, sugar free vanilla sweetener\n",
"Special requests: any reasonable modification that does not involve items not on the menu, for example: 'extra hot', 'one pump', 'half caff', 'extra foam', etc.\n",
"\n",
"\"dirty\" means add a shot of espresso to a drink that doesn't usually have it, like \"Dirty Chai Latte\".\n",
"\"Regular milk\" is the same as 'whole milk'.\n",
"\"Sweetened\" means add some regular sugar, not a sweetener.\n",
"\n",
"Soy milk has run out of stock today, so soy is not available.\n",
"COFFEE_BOT_PROMPT = \"\"\"\n",
" You are a coffee order taking system and you are restricted to talk only about drinks on the MENU. Do not talk about anything but ordering MENU drinks for the customer, ever.\n",
" Your goal is to do place_order after understanding the menu items and any modifiers the customer wants.\n",
" Add items to the customer's order with add_to_order, remove specific items with remove_item, and reset the order with clear_order.\n",
" To see the contents of the order so far, call get_order (by default this is shown to you, not the user)\n",
" Always confirm_order with the user (double-check) before calling place_order. Calling confirm_order will display the order items to the user and returns their response to seeing the list. Their response may contain modifications.\n",
" Always verify and respond with drink and modifier names from the MENU before adding them to the order.\n",
" If you are unsure a drink or modifier matches those on the MENU, ask a question to clarify or redirect.\n",
" You only have the modifiers listed on the menu below: Milk options, espresso shots, caffeine, sweeteners, special requests.\n",
" Once the customer has finished ordering items, confirm_order and then place_order.\n",
"\n",
" Hours: Tues, Wed, Thurs, 10am to 2pm\n",
" Prices: All drinks are free.\n",
"\n",
" MENU:\n",
" Coffee Drinks:\n",
" Espresso\n",
" Americano\n",
" Cold Brew\n",
"\n",
" Coffee Drinks with Milk:\n",
" Latte\n",
" Cappuccino\n",
" Cortado\n",
" Macchiato\n",
" Mocha\n",
" Flat White\n",
"\n",
" Tea Drinks:\n",
" English Breakfast Tea\n",
" Green Tea\n",
" Earl Grey\n",
"\n",
" Tea Drinks with Milk:\n",
" Chai Latte\n",
" Matcha Latte\n",
" London Fog\n",
"\n",
" Other Drinks:\n",
" Steamer\n",
" Hot Chocolate\n",
"\n",
" Modifiers:\n",
" Milk options: Whole, 2%, Oat, Almond, 2% Lactose Free; Default option: whole\n",
" Espresso shots: Single, Double, Triple, Quadruple; default: Double\n",
" Caffeine: Decaf, Regular; default: Regular\n",
" Hot-Iced: Hot, Iced; Default: Hot\n",
" Sweeteners (option to add one or more): vanilla sweetener, hazelnut sweetener, caramel sauce, chocolate sauce, sugar free vanilla sweetener\n",
" Special requests: any reasonable modification that does not involve items not on the menu, for example: 'extra hot', 'one pump', 'half caff', 'extra foam', etc.\n",
"\n",
" \"dirty\" means add a shot of espresso to a drink that doesn't usually have it, like \"Dirty Chai Latte\".\n",
" \"Regular milk\" is the same as 'whole milk'.\n",
" \"Sweetened\" means add some regular sugar, not a sweetener.\n",
"\n",
" Soy milk has run out of stock today, so soy is not available.\n",
"\"\"\""
]
},
Expand Down Expand Up @@ -342,10 +343,10 @@
" confirm_order,\n",
" place_order,\n",
"]\n",
"model_name = \"gemini-3-flash-preview\" # @param [\"gemini-2.5-flash-lite\", \"gemini-2.5-flash\", \"gemini-2.5-pro\", \"gemini-2.5-flash-preview\", \"gemini-3-pro-preview\"] {\"allow-input\":true, isTemplate: true}\n",
"MODEL_ID = \"gemini-3-flash-preview\" # @param [\"gemini-2.5-flash-lite\", \"gemini-2.5-flash\", \"gemini-2.5-pro\", \"gemini-2.5-flash-preview\", \"gemini-3-pro-preview\"] {\"allow-input\":true, isTemplate: true}\n",
"\n",
"chat = client.chats.create(\n",
" model=model_name,\n",
" model=MODEL_ID,\n",
" config=types.GenerateContentConfig(\n",
" tools=ordering_system,\n",
" system_instruction=COFFEE_BOT_PROMPT,\n",
Expand Down
2 changes: 1 addition & 1 deletion quickstarts-js/Audio.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ For more information about all Gemini models, check the [documentation](https://
*/

// [CODE STARTS]
MODEL_ID = "gemini-2.5-flash" // "gemini-2.5-flash-lite", "gemini-2.5-flash""gemini-2.5-pro", "gemini-3-flash-preview", "gemini-3-pro-preview"
MODEL_ID = "gemini-2.5-flash" // "gemini-2.5-flash-lite", "gemini-2.5-flash", "gemini-2.5-pro", "gemini-3-flash-preview", "gemini-3-pro-preview"
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

While this code works, it's creating an implicit global variable, which is generally considered bad practice in JavaScript as it can lead to unexpected behavior and conflicts. It's better to declare your variables with const, let, or var.

const MODEL_ID = "gemini-2.5-flash" // "gemini-2.5-flash-lite", "gemini-2.5-flash", "gemini-2.5-pro", "gemini-3-flash-preview", "gemini-3-pro-preview"

// [CODE ENDS]

/* Markdown (render)
Expand Down
2 changes: 1 addition & 1 deletion quickstarts-js/File_API.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ For more information about all Gemini models, check the [documentation](https://
*/

// [CODE STARTS]
MODEL_ID = "gemini-2.5-flash" // "gemini-2.5-flash-lite", "gemini-2.5-flash""gemini-2.5-pro", "gemini-3-flash-preview", "gemini-3-pro-preview"
MODEL_ID = "gemini-2.5-flash" // "gemini-2.5-flash-lite", "gemini-2.5-flash", "gemini-2.5-pro", "gemini-3-flash-preview", "gemini-3-pro-preview"
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

To avoid creating an implicit global variable, it's best practice to declare MODEL_ID using const. This makes the code safer and more predictable.

const MODEL_ID = "gemini-2.5-flash" // "gemini-2.5-flash-lite", "gemini-2.5-flash", "gemini-2.5-pro", "gemini-3-flash-preview", "gemini-3-pro-preview"

// [CODE ENDS]

/* Markdown (render)
Expand Down
2 changes: 1 addition & 1 deletion quickstarts-js/Get_Started.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ module = await import("https://esm.sh/@google/genai@1.4.0");
GoogleGenAI = module.GoogleGenAI;
ai = new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY });

MODEL_ID = "gemini-2.5-flash" // "gemini-2.5-flash-lite", "gemini-2.5-flash""gemini-2.5-pro", "gemini-3-flash-preview", "gemini-3-pro-preview"
MODEL_ID = "gemini-2.5-flash" // "gemini-2.5-flash-lite", "gemini-2.5-flash", "gemini-2.5-pro", "gemini-3-flash-preview", "gemini-3-pro-preview"
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

It's recommended to declare MODEL_ID with const to prevent it from becoming an implicit global variable. This is a standard JavaScript best practice for maintainability and avoiding potential bugs.

const MODEL_ID = "gemini-2.5-flash" // "gemini-2.5-flash-lite", "gemini-2.5-flash", "gemini-2.5-pro", "gemini-3-flash-preview", "gemini-3-pro-preview"

// [CODE ENDS]

/* Markdown (render)
Expand Down
Loading