<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Maurizio Ipsale on Medium]]></title>
        <description><![CDATA[Stories by Maurizio Ipsale on Medium]]></description>
        <link>https://medium.com/@maurizioipsale?source=rss-df9cb87d2bfe------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*vJAVqbpfz_rOkafZOPl6bQ.jpeg</url>
            <title>Stories by Maurizio Ipsale on Medium</title>
            <link>https://medium.com/@maurizioipsale?source=rss-df9cb87d2bfe------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 03:41:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@maurizioipsale/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Google ADK Training 2.0: The Definitive Guide to Mastering Production-Ready Multi-Agent Systems]]></title>
            <link>https://medium.com/google-cloud/google-adk-training-2-0-the-definitive-guide-to-mastering-production-ready-multi-agent-systems-134e2b8d14f3?source=rss-df9cb87d2bfe------2</link>
            <guid isPermaLink="false">https://medium.com/p/134e2b8d14f3</guid>
            <category><![CDATA[google-adk]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Maurizio Ipsale]]></dc:creator>
            <pubDate>Mon, 26 Oct 2026 02:15:03 GMT</pubDate>
            <atom:updated>2026-10-26T02:15:03.258Z</atom:updated>
            <content:encoded><![CDATA[<p><em>How we transformed our open-source Google Agent Development Kit curriculum into a gamified, self-evaluating learning platform with zero-trust grading and real-time cloud onboarding.</em></p><p><em>(Written by Maurizio Ipsale, Google Developer Expert in Google Cloud and Google Cloud Authorized Trainer at Datatonic, with AI assistance for editorial polishing.)</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AY_uY87CKW3Vat_7lOmqdg.png" /><figcaption><em>Figure 1: The architectural evolution of Google ADK Training 2.0. (Image generated with AI)</em></figcaption></figure><h3>The Story So Far: Building on the August Foundation</h3><p>Exactly two months ago, on August 26, 2026, I published an article here on the Google Cloud publication titled <a href="https://medium.com/google-cloud/i-built-the-google-adk-course-i-wish-had-existed-c9e825f6a150"><strong>“I Built the Google ADK Course I Wish Had Existed”</strong></a>.</p><p>In that piece, I shared my journey of building an open-source, production-grade training repository for Google’s <strong>Agent Development Kit (ADK)</strong> in Python — designing the exact curriculum I needed as an engineer: robust tool definitions, context state persistence, graph workflows, and enterprise testing.</p><p>The reception from the AI and Google Cloud engineering community was extraordinary, culminating in a career milestone: <strong>the repository was officially featured and linked directly on Google’s Official ADK Documentation as a community learning resource</strong>.</p><p>Over the last 60 days, while conducting enterprise bootcamps and training engineering teams at <strong>Datatonic</strong>, a key realization emerged: <strong>passive markdown documentation and static notebooks are only step one</strong>. To truly master multi-agent orchestration, developers need an active, gamified learning loop with zero friction, real-time validation, and verifiable progression.</p><p>Today, I’m excited to release <strong>Google ADK Training Version 2.0.0</strong> — a complete evolution into an interactive, self-evaluating learning platform.</p><h3>What’s New in Version 2.0: The 5 Core Pillars</h3><h4>1. Socratic Interactive Knowledge Checks</h4><p>Reading theoretical documentation without actively testing your mental model leads to the illusion of competence. In v2.0, every theory module embeds an in-browser <strong>Socratic quiz engine</strong>.</p><figure><img alt="Socratic Quiz Interactive Flow" src="https://cdn-images-1.medium.com/max/1024/1*04u1jPg2u0pMMMDzy5jpzA.png" /><figcaption><em>Figure 2: The browser-based Socratic quiz architecture with randomized options and pedagogical feedback. (Image generated with AI)</em></figcaption></figure><ul><li><strong>Dynamic Question Pools:</strong> Multi-choice questions with randomized option orders to prevent rote memorization.</li><li><strong>Instant Pedagogical Feedback:</strong> Selecting an incorrect option doesn’t just show an error; it explains <em>why</em> the architectural assumption failed and points back to the relevant section.</li><li><strong>Seamless Local Persistence:</strong> Quiz completion states are saved and tracked locally across your browsing sessions.</li></ul><h4>2. Zero-Bypass Completion Engine &amp; Cryptographic Anti-Cheat</h4><p>One common issue with web-based learning is passive skimming. In v2.0, we engineered a client-side gating mechanism powered by the browser’s native <strong>Web Crypto API (SubtleCrypto)</strong>.</p><ul><li>Lessons and modules cannot be marked as “Completed” through simple scrolling or DOM manipulation.</li><li>Completion tokens are cryptographically signed using a unique student payload hash.</li><li>Students get an authentic sense of earned progression, while instructors retain auditability during live workshops.</li></ul><h4>3. Real-Time Progress Tracker &amp; Verifiable Certificates</h4><p>To give learners visual momentum, the portal now features a dedicated <strong>Interactive Student Progress Dashboard</strong> and an automated <strong>Certificate Generator</strong>.</p><figure><img alt="Student Progress and Verifiable Certificate" src="https://cdn-images-1.medium.com/max/1024/1*Pwje0qlcWPfdlJzYPkLApg.png" /><figcaption><em>Figure 3: Real-time progress dashboard across all 5 core modules and the high-resolution certificate export. (Image generated with AI)</em></figcaption></figure><ul><li><strong>Progress Matrix:</strong> Live completion indicators across all 5 core modules (Foundations, Tools/MCP, State, Multi-Agent Graphs, Production &amp; Evaluation).</li><li><strong>Exportable Verification:</strong> Upon achieving 100% completion across all modules and knowledge checks, students can generate an individualized, high-resolution certificate of completion complete with timestamp and verification hashes.</li></ul><h4>4. Zero-Setup Cloud Onboarding (Cloud Shell &amp; Cloud Workstations)</h4><p>Environment setup friction is the number one momentum killer in developer training. In v2.0, we introduced single-command onboarding for <strong>Google Cloud Shell</strong> and <strong>Google Cloud Workstations (as well as Colab Enterprise)</strong>:</p><pre># Clone the repository<br>git clone https://github.com/mauripsale/doc-adk-training.git<br>cd doc-adk-training<br><br># Initialize isolated environment with zero friction<br>./setup_cloudshell.sh</pre><p>The script automatically detects the cloud runtime, configures Python 3.10+ virtual environments, isolates dependencies, and prepares local mock credentials so you can start coding in under 60 seconds.</p><h4>5. Automated Student Grader Pipeline (Zero-Trust Simulation)</h4><p>For every technical lab, we replaced passive “compare your code to the solution” with an <strong>automated grading agent</strong>.</p><figure><img alt="Cloud Onboarding and Student Grader Pipeline" src="https://cdn-images-1.medium.com/max/1024/1*JhgoCtuwI7F5fhlwgzngCw.png" /><figcaption><em>Figure 4: Automated Student Grader runtime executing zero-trust simulations against lab submissions. (Image generated with AI)</em></figcaption></figure><p>The grader runs in an isolated sandbox, executing tests against:</p><ul><li>Tool calling trajectory and parameter accuracy.</li><li>Context state mutations and session memory boundaries.</li><li>Subagent delegation and graph workflow transitions.</li><li>Response structure compliance with schema definitions.</li></ul><h3>The 5 Core Modules: What You Will Master</h3><ol><li><strong>Module 1: ADK Core Architecture &amp; Agent Lifecycle</strong><br>Node types, runners, event loops, and LLM orchestration primitives.</li><li><strong>Module 2: Tool Registry &amp; Model Context Protocol (MCP)<br></strong>Dynamic schema inference, custom function tools, and integrating external MCP servers.</li><li><strong>Module 3: State Management &amp; Long-Term Memory<br></strong>Working with session stores, global context, turn-by-turn memory, and state isolation.</li><li><strong>Module 4: Multi-Agent Systems &amp; Graph Orchestration<br></strong>Subagent delegation, peer-to-peer workflows, parallel execution, and cyclic graph patterns.</li><li><strong>Module 5: Production Deployment, Observability &amp; Evaluation<br></strong> Deploying on Google Cloud Run, tracing with Cloud Trace, and quantitative LLM-as-a-judge evaluation frameworks.</li></ol><h3>Bring ADK Training to Your Engineering Organization</h3><p>While the entire training platform and documentation are 100% open-source and free for self-paced learning, building enterprise-scale agent systems often requires tailored alignment with existing cloud architectures and security policies.</p><p>As a <strong>Google Cloud Authorized Trainer</strong> at <strong>Datatonic</strong>, I also deliver customized, instructor-led live bootcamps and intensive workshops for engineering teams looking to accelerate their Generative AI roadmap on Google Cloud. If your organization is looking to upskill its developers on ADK and multi-agent systems, feel free to reach out!</p><h3>Get Started Today</h3><ul><li>🌐 <strong>Interactive Documentation Portal:</strong> <a href="https://mauripsale.github.io/doc-adk-training/">mauripsale.github.io/doc-adk-training</a></li><li>⭐ <strong>GitHub Repository:</strong> <a href="https://github.com/mauripsale/doc-adk-training">github.com/mauripsale/doc-adk-training</a></li><li>📖 <strong>Read Part 1 (The Prequel):</strong> <a href="https://medium.com/google-cloud/i-built-the-google-adk-course-i-wish-had-existed-c9e825f6a150">I Built the Google ADK Course I Wish Had Existed</a></li><li>💬 <strong>Join the Discussion:</strong> Leave a star on GitHub, fork the repo, and share your feedback!</li></ul><p><em>And if you find this evolution to v2.0 useful, a clap (or 50! 👏) here on Medium and a ⭐ on GitHub would mean the world.</em></p><p><em>Once you earn your completion certificate, share it on LinkedIn and tag me - I’d love to celebrate what you build with Google ADK!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=134e2b8d14f3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/google-cloud/google-adk-training-2-0-the-definitive-guide-to-mastering-production-ready-multi-agent-systems-134e2b8d14f3">Google ADK Training 2.0: The Definitive Guide to Mastering Production-Ready Multi-Agent Systems</a> was originally published in <a href="https://medium.com/google-cloud">Google Cloud - Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Built the Google ADK Course I Wish Had Existed…]]></title>
            <link>https://medium.com/google-cloud/i-built-the-google-adk-course-i-wish-had-existed-c9e825f6a150?source=rss-df9cb87d2bfe------2</link>
            <guid isPermaLink="false">https://medium.com/p/c9e825f6a150</guid>
            <category><![CDATA[agents]]></category>
            <category><![CDATA[adk]]></category>
            <category><![CDATA[google-adk]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <dc:creator><![CDATA[Maurizio Ipsale]]></dc:creator>
            <pubDate>Wed, 26 Aug 2026 13:47:00 GMT</pubDate>
            <atom:updated>2026-08-26T13:47:00.179Z</atom:updated>
            <content:encoded><![CDATA[<p>… and Google’s Newsletter Just Noticed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TYAPRhBjzKv2rgWHYwxYhw.jpeg" /></figure><p>A few months ago, I started writing a new course for Google’s <strong>Agent Development Kit</strong>. Before I wrote the first line, I made myself one rule: no lab would ever hand the student working code. If a student wanted the solution, they would have to actively decide to go look for it.</p><p>I’m a <strong>Google Cloud Authorized Trainer</strong> and a <strong>Google Developer Expert</strong> in AI and Cloud. I’ve spent years in classrooms, and I’ve always believed in one thing: <strong>learning by doing</strong>, combined with the “<strong>flipped classroom</strong>” model; you do the work first, and only then I explain what you just did. Not the other way around. Most AI agent tutorials I saw, ADK included, did the opposite: here is the code, run it, watch it work. Comfortable. And not very useful the moment you hit a real problem on your own.</p><p>So I built something different: <strong>ADK: From Zero to Hero</strong>, a free, open-source, 40-module training course for ADK. Every module follows the same shape: theory, a challenge lab, and a hidden solution. And I mean literally hidden: the answer is Base64-encoded behind a link. You have to decide to click it. You’re allowed to get stuck. You’re expected to.</p><p><strong>What “from zero to hero” actually means</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nG9lA2bnN7iQf9IY4x_2pg.png" /><figcaption>ADK From Zero to Hero Homepage</figcaption></figure><p>40 modules, in 7 parts, take a student from <strong>pip install google-adk</strong> to a distributed, enterprise-grade multi-agent system with full observability. In between: custom tools, OpenAPI integration, four multi-agent orchestration patterns, MCP servers, distributed A2A graphs, evaluation, and deployment to Cloud Run and GKE. The final capstone is a full incident-response system with plugins and enterprise observability built in.</p><p>That part is not unusual for a course outline. What I did after writing it is the part I actually want to tell you about.</p><p><strong>I made an AI act like a confused student. <br>And it caught my own hallucinated code</strong></p><p>I built an evaluator that plays the role of a student meeting each lab for the first time. It only reads the theory and the instructions (never the solution) and it actually runs the code in a fresh environment. Not reviewing it on the page. Running it, for real.</p><p>It found real problems. Some parts of the labs I had, honestly, mostly vibe-coded, written fast with AI help, without checking every line carefully. The student agent found that some of that code was <strong>pure hallucination</strong>: functions and options that don’t exist, called as if they were real. It also caught a Kubernetes manifest where a small indentation mistake made half the configuration silently disappear: the file looked correct, but the result would have been wrong. It caught a missing setup step that the official evaluation command needed but that nothing in my instructions mentioned.</p><p>I re-checked modules I thought I had already fixed, and in three of them, the agent found a second bug I had missed the first time. One pass was not enough. Running the labs for real, again and again, was the only thing that actually worked.</p><p><strong>Then Google shipped ADK 2.4, 2.5, and 2.6 while I wasn’t looking</strong></p><p>Keeping a 40-module course current against a framework that changes every few weeks is its own job. I went through the official changelogs, version by version, and updated the course against real new features: reliability fixes for the A2A protocol, ManagedAgent for server-hosted agents, self-healing error-handling plugins, and using a workflow node directly as an agent’s own tool. Some new features I looked at and left out on purpose: a couple of new sandboxed code runners only work inside infrastructure a student can’t set up for a simple lab, so I pointed to alternatives that a student can actually run instead.</p><p><strong>Then, completely by surprise, this happened</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/778/1*k4iHvlVLh0A8sP289I8DzA.png" /><figcaption>Screenshot from GEAR Global Newsletter (August ‘26 Edition)</figcaption></figure><p>Yesterday I submitted the course to Google’s official ADK Community Resources page. About an hour later, Google’s own Developer newsletter, the one that goes out to developers building on Google’s platforms worldwide, landed in my inbox. And there it was: a write-up of my repo, my name on it, with no warning at all.</p><p>I want to be honest here, because the honest version is better than the flattering one: the newsletter and my submission are not connected. A newsletter like that is written and scheduled days or weeks in advance: nothing about a docs pull request opened one hour earlier could cause that. The real explanation is probably simpler: someone at Google had already been watching the repo.</p><p>I was surprised, honestly a little in disbelief, and genuinely thrilled. The first thing I did was call my team at Datatonic to tell them.</p><p><strong>Try it, break it, tell me</strong></p><p>The course is Python-only for now; a Go version is a “maybe, someday,” not a promise. It’s free, open source, and fully aligned with ADK 2.0 through 2.6.</p><p>If you’re building with ADK, I would rather hear what’s broken or unclear from you than have it sit untested. That’s the whole idea the course was built on in the first place.</p><p>Start here: <a href="https://mauripsale.github.io/doc-adk-training/"><strong>ADK: From Zero to Hero</strong></a><strong>. <br></strong>And if you like it, a clap here and a ⭐ on GitHub would mean a lot.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c9e825f6a150" width="1" height="1" alt=""><hr><p><a href="https://medium.com/google-cloud/i-built-the-google-adk-course-i-wish-had-existed-c9e825f6a150">I Built the Google ADK Course I Wish Had Existed…</a> was originally published in <a href="https://medium.com/google-cloud">Google Cloud - Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Are LLMs smart workers? Function calling  — Part 1]]></title>
            <link>https://medium.com/google-cloud/smart-workers-and-llm-function-calling-explained-part-1-f3b41dcc3110?source=rss-df9cb87d2bfe------2</link>
            <guid isPermaLink="false">https://medium.com/p/f3b41dcc3110</guid>
            <category><![CDATA[llm-function-calling]]></category>
            <category><![CDATA[gemini]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[generative-ai]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Maurizio Ipsale]]></dc:creator>
            <pubDate>Fri, 18 Oct 2024 07:32:02 GMT</pubDate>
            <atom:updated>2024-11-16T15:39:22.846Z</atom:updated>
            <content:encoded><![CDATA[<h3>Are LLMs smart workers? Function calling — Part 1</h3><h4>The Paradox of Perfection</h4><p>In the age of artificial intelligence it is common to think of LLMs (Large Language Models) as “intelligent” systems, without actually having rigorously defined what is meant by the word “intelligent”.</p><p>Imagine hiring a truly intelligent person in the company, capable of doing everything, absolutely everything. She is capable of solving complex problems with an uncommon logical capacity. However, she has a flaw: she wants to do everything independently, she refuses to use any external tool or technology.</p><p>One day she finds herself carrying out an analysis of company data. Instead of using tools like Excel, or even just a simple calculator, she decides to do everything with pen and paper. Therefore, to obtain the results she takes a very long time, and she has to double-check the calculations several times because she often made mistakes and therefore it is necessary to correct them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JR0HaG3Jlo0iD-p86OqEgw.png" /><figcaption>The Intelligent Ignorer: A Genius Limited by Independence (Source: Imagen 3)</figcaption></figure><p>In the end the results obtained were all in all correct, but with what effort! And are we sure that you would trust the results knowing that the calculations had been done in this way?</p><p>Here, relying on a bare-bones LLM is like having this super fast and capable person at your disposal, but with the reliability linked to the stubbornness of wanting to do everything by yourself.</p><p>Why reinvent the wheel?</p><p>One of the false myths that we risk pursuing with the advent of generative artificial intelligence is to think that this technology can replace all the other existing ones, specialized in some specific tasks.</p><p>We could ask ourselves at this point: who is smarter? <br>A worker who can do everything by himself, with good results, or one who does not have all the answers, but knows how to choose the right tools to carry out a task? <br>And so, can we transform an LLM from the first to the second?</p><p>The answer is: <strong>Function Calling</strong>!</p><p>With Function Calling the LLM is trained not only to answer all the questions independently, but also to understand which external tool to use to perform a particular task in an optimal way, and how to use it (this last part is trained through fine-tuning)</p><h3>Practical Application: Gemini Function Calling</h3><p><strong>Planning an International Business Trip for a Group of Travelers</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N1xgJwUYHmqxopExnHM3PQ.png" /><figcaption>Gemini is helping us to plan an International Business Trip for a Group of Travelers (Source: Imagen 3)</figcaption></figure><blockquote>Note: In this example we are using Vertex AI. To get started using Vertex AI, you must have an existing Google Cloud project and enable the Vertex AI API.</blockquote><pre>PROJECT_ID = &quot;[your-project-id]&quot;  # @param {type:&quot;string&quot;}<br>LOCATION = &quot;us-central1&quot;  # @param {type:&quot;string&quot;}<br><br>import vertexai<br><br>vertexai.init(project=PROJECT_ID, location=LOCATION)</pre><p>Suppose we need to plan an international business trip for a group of employees. The operations to be handled are as follows:</p><ol><li>Booking flights</li><li>Booking hotels near the destination by checking their reviews and availability</li><li>Scheduling meetings with international clients and partners</li><li>Convert currency to estimate travel costs</li></ol><p>The tools we will provide to our LLM will be as follows:</p><pre>{<br>  &quot;name&quot;: &quot;book_flight&quot;,<br>  &quot;description&quot;: &quot;Book a flight for the business travelers.&quot;<br>}<br>{<br>  &quot;name&quot;: &quot;book_hotel&quot;,<br>  &quot;description&quot;: &quot;Book a hotel for the travelers.&quot;<br>}<br>{<br>  &quot;name&quot;: &quot;schedule_meeting&quot;,<br>  &quot;description&quot;: &quot;Schedule a meeting with clients, taking into account time zones.&quot;<br>}<br>{<br>  &quot;name&quot;: &quot;convert_currency&quot;,<br>  &quot;description&quot;: &quot;Convert the amount from one currency to another.&quot;<br>}</pre><p>Returning to the “smart person” example, it is not enough to provide the tools, you must also provide “instruction manuals” so that you can explain how to use the external tools. This is done through <em>FunctionDeclarations</em>. Let’s see how to do this for the functions mentioned above:</p><pre>from vertexai.generative_models import FunctionDeclaration<br><br>function_name = &quot;book_flight&quot;<br>book_flight_func = FunctionDeclaration(<br>    name=function_name,<br>    description=&quot;Book a flight for the business travelers.&quot;,<br>    parameters={<br>        &quot;type&quot;: &quot;object&quot;,<br>        &quot;properties&quot;: {<br>            &quot;departure_city&quot;: {<br>                &quot;type&quot;: &quot;string&quot;,<br>                &quot;description&quot;: &quot;The participant&#39;s departure city.&quot;<br>            },<br>            &quot;arrival_city&quot;: {<br>                &quot;type&quot;: &quot;string&quot;,<br>                &quot;description&quot;: &quot;The arrival city (final destination)&quot;<br>            },<br>            &quot;departure_date&quot;: {<br>                &quot;type&quot;: &quot;string&quot;,<br>                &quot;description&quot;: &quot;The departure date of the flight&quot;<br>            },<br>            &quot;return_date&quot;: {<br>                &quot;type&quot;: &quot;string&quot;,<br>                &quot;description&quot;: &quot;The return date of the flight&quot;<br>            },<br>            &quot;travel_class&quot;: {<br>                &quot;type&quot;: &quot;string&quot;,<br>                &quot;enum&quot;: [&quot;economy&quot;, &quot;business&quot;, &quot;first&quot;],<br>                &quot;description&quot;: &quot;The class of travel&quot;<br>            }<br>        },<br>       &quot;required&quot;: [&quot;departure_city&quot;, &quot;arrival_city&quot;, &quot;departure_date&quot;, &quot;return_date&quot;]<br>    },<br>)</pre><p>We note how we are describing the function, without explicating the code, to a potential user (in our case it will be the LLM), so as to describe well how to use it.</p><blockquote>Note: We have always been accustomed to “description” fields in code as explanations for the use of developers, to make the code more readable.</blockquote><blockquote>In this case, the “description” field becomes even more critical, as it retains its purpose as an explanation, but not to the developer reading the code, but to the LLM, who will use that very field to determine which tool to use for a given task to be performed.</blockquote><p>Let’s move on to the description of the other functions:<br>Hotel booking:</p><pre>function_name = &quot;book_hotel&quot;<br>book_hotel_func = FunctionDeclaration(<br>    name=function_name,<br>    description=&quot;Book a hotel for the business travelers.&quot;,<br>    parameters={<br>        &quot;type&quot;: &quot;object&quot;,<br>        &quot;properties&quot;: {<br>            &quot;location&quot;: {<br>                &quot;type&quot;: &quot;string&quot;,<br>                &quot;description&quot;: &quot;The city or zone where the hotel should be located&quot;<br>            },<br>            &quot;check_in_date&quot;: {<br>                &quot;type&quot;: &quot;string&quot;,<br>                &quot;description&quot;: &quot;The check-in date&quot;<br>            },<br>            &quot;check_out_date&quot;: {<br>                &quot;type&quot;: &quot;string&quot;,<br>                &quot;description&quot;: &quot;The check-out date&quot;<br>            },<br>            &quot;min_rating&quot;: {<br>                &quot;type&quot;: &quot;number&quot;,<br>                &quot;description&quot;: &quot;The minimum rating of the hotel (ex. 4.0 out of 5)&quot;<br>            },<br>        },<br>       &quot;required&quot;: [&quot;location&quot;, &quot;check_in_date&quot;, &quot;check_out_date&quot;]<br>    },<br>)</pre><p>Meeting Scheduling:</p><pre>function_name = &quot;schedule_meeting&quot;<br>schedule_meeting_func = FunctionDeclaration(<br>    name=function_name,<br>    description=&quot;Schedule a meeting with clients, considering time zones.&quot;,<br>    parameters={<br>        &quot;type&quot;: &quot;object&quot;,<br>        &quot;properties&quot;: {<br>            &quot;client_timezone&quot;: {<br>                &quot;type&quot;: &quot;string&quot;,<br>                &quot;description&quot;: &quot;The time zone where the client is located&quot;<br>            },<br>            &quot;preferred_date&quot;: {<br>                &quot;type&quot;: &quot;string&quot;,<br>                &quot;description&quot;: &quot;The preferred date for the meeting&quot;<br>            },<br>            &quot;meeting_duration&quot;: {<br>                &quot;type&quot;: &quot;integer&quot;,<br>                &quot;description&quot;: &quot;The meeting duration in minutes&quot;<br>            },<br>        },<br>       &quot;required&quot;: [&quot;client_timezone&quot;, &quot;preferred_date&quot;, &quot;meeting_duration&quot;]<br>    },<br>)</pre><p>Currency conversion:</p><pre>function_name = &quot;convert_currency&quot;<br>convert_currency_func = FunctionDeclaration(<br>    name=function_name,<br>    description=&quot;Convert the amount from one currency to another.&quot;,<br>    parameters={<br>        &quot;type&quot;: &quot;object&quot;,<br>        &quot;properties&quot;: {<br>            &quot;amount&quot;: {<br>                &quot;type&quot;: &quot;number&quot;,<br>                &quot;description&quot;: &quot;The amount to convert&quot;<br>            },<br>            &quot;from_currency&quot;: {<br>                &quot;type&quot;: &quot;string&quot;,<br>                &quot;description&quot;: &quot;The source currency (e.g. &#39;USD&#39;, or &#39;EUR&#39;).&quot;<br>            },<br>             &quot;to_currency&quot;: {<br>                &quot;type&quot;: &quot;string&quot;,<br>                &quot;description&quot;: &quot;The destination currency (e.g. &#39;USD&#39;, or &#39;EUR&#39;).&quot;<br>            },        <br>     },<br>       &quot;required&quot;: [&quot;amount&quot;, &quot;from_currency&quot;, &quot;to_currency&quot;]<br>    },<br>)</pre><p>Now let’s define an example of user prompt:</p><p><em>I need to organize a business trip for 4 employees from Rome to New York. <br>Here are the details:</em></p><ol><li><em>Departing on November 1, 2024 and returning on November 7, 2024.</em></li><li><em>Everyone should travel on business class.</em></li><li><em>I’d like them to stay in a hotel in Manhattan with at least a 4.5-star rating and check in on the day of arrival and check out on the day of departure.</em></li><li><em>Arrange a transfer from JFK Airport to the hotel on the day of arrival at 3:00 PM, and from the hotel to the airport on the day of return.</em></li><li><em>Schedule a meeting with our client in New York on November 2, 2024. Our team is available from 9:00 AM to 5:00 PM, New York Time.</em></li><li><em>Please convert all travel expenses from dollars to euros to get an idea of ​​the overall costs.</em></li></ol><p>Let’s now prepare the toolbelt. We define a tool that allows the Gemini model to select from the set of the 4 functions:</p><pre>from vertexai.generative_models import Tool<br><br>trip_planner_tool = Tool(<br>    function_declarations=[<br>        book_flight_func,<br>        book_hotel_func,<br>        schedule_meeting_func,<br>        convert_currency_func,<br>    ],<br>)</pre><p>You can now engage in multi-turn conversations with the Gemini model, leveraging its Function Calling capability. We set the tools argument here, during initialization, so we can avoid to include it in every request</p><pre>from vertexai.generative_models import GenerativeModel, GenerationConfig<br><br>model = GenerativeModel(<br>    &quot;gemini-1.5-pro-002&quot;,<br>    generation_config=GenerationConfig(temperature=0),<br>    tools=[trip_planner_tool],<br>)<br>chat = model.start_chat()</pre><p>Let’s give it a shot with the first part of our prompt:</p><pre>prompt = &quot;&quot;&quot;<br>I need to organize a business trip for 4 employees from Rome to New York. <br>Here are the details:<br>Departing on November 1, 2024 and returning on November 7, 2024.<br>Everyone should travel on business class.<br>&quot;&quot;&quot;<br><br>response = chat.send_message(prompt)<br>print(response.candidates[0].content.parts[0])</pre><p>Executing the code above, the result is:</p><pre>function_call {<br>  name: &quot;book_flight&quot;<br>  args {<br>    fields {<br>      key: &quot;arrival_city&quot;<br>      value {<br>        string_value: &quot;New York&quot;<br>      }<br>    }<br>    fields {<br>      key: &quot;departure_city&quot;<br>      value {<br>        string_value: &quot;Rome&quot;<br>      }<br>    }<br>    fields {<br>      key: &quot;departure_date&quot;<br>      value {<br>        string_value: &quot;2024-11-01&quot;<br>      }<br>    }<br>    fields {<br>      key: &quot;people_number&quot;<br>      value {<br>        number_value: 4.0<br>      }<br>    }<br>    fields {<br>      key: &quot;return_date&quot;<br>      value {<br>        string_value: &quot;2024-11-07&quot;<br>      }<br>    }<br>    fields {<br>      key: &quot;travel_class&quot;<br>      value {<br>        string_value: &quot;business&quot;<br>      }<br>    }<br>  }<br>}</pre><p>Wow! Gemini was able to:</p><ol><li>recognize my intent</li><li>identify the right function needed for this task from its toolbelt</li><li>extract the values of the arguments needed to call that function and put them in a JSON.</li></ol><p>Let’s ask now to book an hotel:</p><pre>prompt = &quot;&quot;&quot;<br>I want them to stay in a hotel in Manhattan <br>with at least a 4.5-star rating <br>and check in on the day of arrival <br>and check out on the day of departure.<br>&quot;&quot;&quot;<br><br>response = chat.send_message(prompt)<br>print(response.candidates[0].content.parts[0])</pre><p>The output now is:</p><pre>function_call {<br>  name: &quot;book_hotel&quot;<br>  args {<br>    fields {<br>      key: &quot;check_in_date&quot;<br>      value {<br>        string_value: &quot;2024-11-01&quot;<br>      }<br>    }<br>    fields {<br>      key: &quot;check_out_date&quot;<br>      value {<br>        string_value: &quot;2024-11-07&quot;<br>      }<br>    }<br>    fields {<br>      key: &quot;location&quot;<br>      value {<br>        string_value: &quot;Manhattan&quot;<br>      }<br>    }<br>    fields {<br>      key: &quot;min_rating&quot;<br>      value {<br>        number_value: 4.5<br>      }<br>    }<br>  }<br>}</pre><p>Please note that Gemini is aware of the context. I am not specifying explicitely the dates, actually the LLM is able to infer “the day of arrival” and “the day of departure” from the previous conversation step.</p><p>Let’s ask now Gemini to schedule a meeting with the client:</p><pre>prompt = &quot;&quot;&quot;<br>Schedule a 2-hour meeting with our client<br>on the day after the check-in.<br>Our team is available from 9:00 AM to 5:00 PM.<br>&quot;&quot;&quot;<br><br>response = chat.send_message(prompt)<br>print(response.candidates[0].content.parts[0])</pre><p>The output:</p><pre>function_call {<br>  name: &quot;schedule_meeting&quot;<br>  args {<br>    fields {<br>      key: &quot;client_timezone&quot;<br>      value {<br>        string_value: &quot;America/New_York&quot;<br>      }<br>    }<br>    fields {<br>      key: &quot;meeting_duration&quot;<br>      value {<br>        number_value: 120.0<br>      }<br>    }<br>    fields {<br>      key: &quot;preferred_date&quot;<br>      value {<br>        string_value: &quot;November 2, 2024&quot;<br>      }<br>    }<br>    fields {<br>      key: &quot;team_availability&quot;<br>      value {<br>        string_value: &quot;9:00 AM to 5:00 PM&quot;<br>      }<br>    }<br>  }<br>}</pre><p>In this case Gemini was able to infer the current time-zone (“America/New_York”) and converted the meeting duration from hours to minutes as per the function declaration. Cool!</p><blockquote>Side note: for the “preferred_date” argument, Gemini was infering a string value such as “November 2, 2024”, which is different from the format the external function is probably expecting (2024–11–02, as we can see from the previous function). Actually there are some simple fix for that, we’ll explore it in Part 2.</blockquote><p>Finally we ask Gemini to convert all travel expenses (to keep things concise, let’s assume we had already calculated it previously, e.g. 8000 USD) from USD to EUR:</p><pre>prompt = &#39;&#39;&#39;<br>Please convert all travel expenses, 8000 USD <br>from dollars to euros <br>to get an idea of ​​the overall costs.<br>&#39;&#39;&#39;<br><br>response = chat.send_message(prompt)<br>print(response.candidates[0].content.parts[0])</pre><p>And the final output is:</p><pre>function_call {<br>  name: &quot;convert_currency&quot;<br>  args {<br>    fields {<br>      key: &quot;amount&quot;<br>      value {<br>        number_value: 8000.0<br>      }<br>    }<br>    fields {<br>      key: &quot;from_currency&quot;<br>      value {<br>        string_value: &quot;USD&quot;<br>      }<br>    }<br>    fields {<br>      key: &quot;to_currency&quot;<br>      value {<br>        string_value: &quot;EUR&quot;<br>      }<br>    }<br>  }<br>}</pre><h3>Wrap-up</h3><p>In this first part we explored the potential of Gemini Function calling and demonstrated how, given the right information (function declarations and, most importantly, natural language descriptions of the tools’ operation), Gemini was able to respond to our requests by identifying:<br>1. which function to call<br>2. the value of the parameters to populate for the function call.</p><p>To apply that in a realistic scenario, let’s delve deeper into a full interaction among the user, the app, the LLM (with function calling), and an external service that publishes some APIs:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NKbOZFrheszbxE0H4jggTQ.png" /><figcaption>Interaction among the user, an app, the LLM (with function calling), and an external service that publishes some APIs (Image by author)</figcaption></figure><p>As we can see from the figure:</p><ol><li>The user pushes a prompt to an app</li><li>The app sends the prompt to the LLM along with the Function Declaration(s)</li><li>The LLM (Gemini) replies identifying the proposed function(s) to call and the parameter values but (by default) it does not call the external functions (API) itself</li><li>The App calls the external function (API Request) to the external service and gets the Response</li><li>The App forwards the Response to the LLM, which, including this additional information to the original prompt, sends back a prompt response</li><li>The App forwards the final response back to the user.</li></ol><blockquote>Note: the default behavior of function calling is such that Gemini identifies the function and “prepares the field” by populating the parameter values ​​to be assigned during the function call, but does NOT perform the function call.</blockquote><p>This is the end of part 1.</p><p>In the next part we will see:</p><ol><li>how to overcome this lack by adding the code necessary to actually perform the function calls</li><li>how to fix the issues related to the format ambiguity of some parameters (e.g. date format)</li><li>and much more …</li></ol><h3>Thanks for reading</h3><p>I hope you enjoyed the article. <br>If so, 𝗙𝗼𝗹𝗹𝗼𝘄 𝗺𝗲, 👏 this article or leave comments. <br>Also let’s connect on <a href="https://www.linkedin.com/in/maurizioipsale/">LinkedIn</a> to share feedbacks.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f3b41dcc3110" width="1" height="1" alt=""><hr><p><a href="https://medium.com/google-cloud/smart-workers-and-llm-function-calling-explained-part-1-f3b41dcc3110">Are LLMs smart workers? Function calling  — Part 1</a> was originally published in <a href="https://medium.com/google-cloud">Google Cloud - Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>