CINXE.COM

Introduction to function calling  |  Generative AI on Vertex AI  |  Google Cloud

<!doctype html> <html lang="en" dir="ltr"> <head> <meta name="google-signin-client-id" content="721724668570-nbkv1cfusk7kk4eni4pjvepaus73b13t.apps.googleusercontent.com"> <meta name="google-signin-scope" content="profile email https://www.googleapis.com/auth/developerprofiles https://www.googleapis.com/auth/developerprofiles.award https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/webhistory"> <meta property="og:site_name" content="Google Cloud"> <meta property="og:type" content="website"><meta name="theme-color" content="#039be5"><meta charset="utf-8"> <meta content="IE=Edge" http-equiv="X-UA-Compatible"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="manifest" href="/_pwa/cloud/manifest.json" crossorigin="use-credentials"> <link rel="preconnect" href="//www.gstatic.com" crossorigin> <link rel="preconnect" href="//fonts.gstatic.com" crossorigin> <link rel="preconnect" href="//fonts.googleapis.com" crossorigin> <link rel="preconnect" href="//apis.google.com" crossorigin> <link rel="preconnect" href="//www.google-analytics.com" crossorigin><link rel="stylesheet" href="//fonts.googleapis.com/css?family=Google+Sans:400,500,700|Google+Sans+Text:400,400italic,500,500italic,700,700italic|Roboto:400,400italic,500,500italic,700,700italic|Roboto+Mono:400,500,700&display=swap"> <link rel="stylesheet" href="//fonts.googleapis.com/css2?family=Material+Icons&family=Material+Symbols+Outlined&display=block"><link rel="stylesheet" href="https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/cloud/css/app.css"> <link rel="shortcut icon" href="https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/cloud/images/favicons/onecloud/favicon.ico"> <link rel="apple-touch-icon" href="https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/cloud/images/favicons/onecloud/super_cloud.png"><link rel="canonical" href="https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/function-calling"><link rel="search" type="application/opensearchdescription+xml" title="Google Cloud" href="https://cloud.google.com/s/opensearch.xml"> <link rel="alternate" hreflang="en" href="https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/function-calling" /><link rel="alternate" hreflang="x-default" href="https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/function-calling" /><link rel="alternate" hreflang="zh-Hans" href="https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/function-calling?hl=zh-cn" /><link rel="alternate" hreflang="fr" href="https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/function-calling?hl=fr" /><link rel="alternate" hreflang="de" href="https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/function-calling?hl=de" /><link rel="alternate" hreflang="id" href="https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/function-calling?hl=id" /><link rel="alternate" hreflang="it" href="https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/function-calling?hl=it" /><link rel="alternate" hreflang="ja" href="https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/function-calling?hl=ja" /><link rel="alternate" hreflang="ko" href="https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/function-calling?hl=ko" /><link rel="alternate" hreflang="pt-BR" href="https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/function-calling?hl=pt-br" /><link rel="alternate" hreflang="es-419" href="https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/function-calling?hl=es-419" /><title>Introduction to function calling &nbsp;|&nbsp; Generative AI on Vertex AI &nbsp;|&nbsp; Google Cloud</title> <meta property="og:title" content="Introduction to function calling &nbsp;|&nbsp; Generative AI on Vertex AI &nbsp;|&nbsp; Google Cloud"><meta name="description" content="This is a master guide to function calling with best practices for generating efficient and readable code on Vertex AI."> <meta property="og:description" content="This is a master guide to function calling with best practices for generating efficient and readable code on Vertex AI."><meta property="og:url" content="https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/function-calling"><meta property="og:image" content="https://cloud.google.com/_static/cloud/images/social-icon-google-cloud-1200-630.png"> <meta property="og:image:width" content="1200"> <meta property="og:image:height" content="630"><meta property="og:locale" content="en"><meta name="twitter:card" content="summary_large_image"><script type="application/ld+json"> { "@context": "https://schema.org", "@type": "Article", "headline": "Introduction to function calling" } </script><script type="application/ld+json"> { "@context": "https://schema.org", "@type": "BreadcrumbList", "itemListElement": [{ "@type": "ListItem", "position": 1, "name": "Generative AI on Vertex AI", "item": "https://cloud.google.com/vertex-ai/generative-ai/docs/overview" },{ "@type": "ListItem", "position": 2, "name": "Documentation", "item": "https://cloud.google.com/vertex-ai/generative-ai/docs/learn/overview" },{ "@type": "ListItem", "position": 3, "name": "Introduction to function calling", "item": "https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/function-calling" }] } </script> <link rel="stylesheet" href="/extras.css"></head> <body class="" template="page" theme="cloud-theme" type="article" layout="docs" free-trial display-toc pending> <devsite-progress type="indeterminate" id="app-progress"></devsite-progress> <section class="devsite-wrapper"> <devsite-cookie-notification-bar></devsite-cookie-notification-bar><cloudx-track userCountry="SG"></cloudx-track> <cloudx-utils-init></cloudx-utils-init> <devsite-header keep-tabs-visible> <div class="devsite-header--inner nocontent"> <div class="devsite-top-logo-row-wrapper-wrapper"> <div class="devsite-top-logo-row-wrapper"> <div class="devsite-top-logo-row"> <button type="button" id="devsite-hamburger-menu" class="devsite-header-icon-button button-flat material-icons gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Navigation menu button" visually-hidden aria-label="Open menu"> </button> <div class="devsite-product-name-wrapper"> <a href="/" class="devsite-site-logo-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Site logo" track-type="globalNav" track-name="googleCloud" track-metadata-position="nav" track-metadata-eventDetail="nav"> <picture> <img src="https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/cloud/images/cloud-logo.svg" class="devsite-site-logo" alt="Google Cloud"> </picture> </a> <span class="devsite-product-name"> <ul class="devsite-breadcrumb-list" > <li class="devsite-breadcrumb-item devsite-has-google-wordmark"> </li> </ul> </span> </div> <div class="devsite-top-logo-row-middle"> <div class="devsite-header-upper-tabs"> <cloudx-tabs-nav class="upper-tabs"> <nav class="devsite-tabs-wrapper" aria-label="Upper tabs"> <tab class="devsite-active"> <a href="https://cloud.google.com/docs" track-metadata-eventdetail="https://cloud.google.com/docs" class="devsite-tabs-content gc-analytics-event " track-type="nav" track-metadata-position="nav - docs-home" track-metadata-module="primary nav" aria-label="Documentation, selected" data-category="Site-Wide Custom Events" data-label="Tab: Documentation" track-name="docs-home" track-link-column-type="single-column" > Documentation </a> </tab> <tab class="devsite-dropdown devsite-clickable "> <a href="https://cloud.google.com/docs/tech-area-overviews" track-metadata-eventdetail="https://cloud.google.com/docs/tech-area-overviews" class="devsite-tabs-content gc-analytics-event " track-type="nav" track-metadata-position="nav - technology-areas" track-metadata-module="primary nav" data-category="Site-Wide Custom Events" data-label="Tab: Technology areas" track-name="technology-areas" track-link-column-type="single-column" > Technology areas </a> <a href="#" role="button" aria-haspopup="true" aria-expanded="false" aria-label="Dropdown menu for Technology areas" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/tech-area-overviews" track-metadata-position="nav - technology-areas" track-metadata-module="primary nav" data-category="Site-Wide Custom Events" data-label="Tab: Technology areas" track-name="technology-areas" track-link-column-type="single-column" class="devsite-tabs-dropdown-toggle devsite-icon devsite-icon-arrow-drop-down"></a> <div class="devsite-tabs-dropdown" aria-label="submenu" hidden> <button class="devsite-tabs-close-button material-icons button-flat gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Close dropdown menu" aria-label="Close dropdown menu" track-type="nav" track-name="close" track-metadata-eventdetail="#" track-metadata-position="nav - technology-areas" track-metadata-module="tertiary nav">close</button> <div class="devsite-tabs-dropdown-content"> <div class="devsite-tabs-dropdown-column "> <ul class="devsite-tabs-dropdown-section "> <li class="devsite-nav-item"> <a href="https://cloud.google.com/docs/ai-ml" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/ai-ml" track-metadata-position="nav - technology-areas" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> AI and ML </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/docs/application-development" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/application-development" track-metadata-position="nav - technology-areas" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Application development </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/docs/application-hosting" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/application-hosting" track-metadata-position="nav - technology-areas" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Application hosting </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/docs/compute-area" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/compute-area" track-metadata-position="nav - technology-areas" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Compute </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/docs/data" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/data" track-metadata-position="nav - technology-areas" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Data analytics and pipelines </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/docs/databases" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/databases" track-metadata-position="nav - technology-areas" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Databases </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/docs/dhm-cloud" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/dhm-cloud" track-metadata-position="nav - technology-areas" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Distributed, hybrid, and multicloud </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/docs/generative-ai" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/generative-ai" track-metadata-position="nav - technology-areas" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Generative AI </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/docs/industry" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/industry" track-metadata-position="nav - technology-areas" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Industry solutions </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/docs/networking" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/networking" track-metadata-position="nav - technology-areas" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Networking </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/docs/observability" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/observability" track-metadata-position="nav - technology-areas" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Observability and monitoring </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/docs/security" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/security" track-metadata-position="nav - technology-areas" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Security </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/docs/storage" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/storage" track-metadata-position="nav - technology-areas" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Storage </div> </a> </li> </ul> </div> </div> </div> </tab> <tab class="devsite-dropdown devsite-clickable "> <a href="https://cloud.google.com/docs/cross-product-overviews" track-metadata-eventdetail="https://cloud.google.com/docs/cross-product-overviews" class="devsite-tabs-content gc-analytics-event " track-type="nav" track-metadata-position="nav - crossproduct" track-metadata-module="primary nav" data-category="Site-Wide Custom Events" data-label="Tab: Cross-product tools" track-name="crossproduct" track-link-column-type="single-column" > Cross-product tools </a> <a href="#" role="button" aria-haspopup="true" aria-expanded="false" aria-label="Dropdown menu for Cross-product tools" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/cross-product-overviews" track-metadata-position="nav - crossproduct" track-metadata-module="primary nav" data-category="Site-Wide Custom Events" data-label="Tab: Cross-product tools" track-name="crossproduct" track-link-column-type="single-column" class="devsite-tabs-dropdown-toggle devsite-icon devsite-icon-arrow-drop-down"></a> <div class="devsite-tabs-dropdown" aria-label="submenu" hidden> <button class="devsite-tabs-close-button material-icons button-flat gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Close dropdown menu" aria-label="Close dropdown menu" track-type="nav" track-name="close" track-metadata-eventdetail="#" track-metadata-position="nav - crossproduct" track-metadata-module="tertiary nav">close</button> <div class="devsite-tabs-dropdown-content"> <div class="devsite-tabs-dropdown-column "> <ul class="devsite-tabs-dropdown-section "> <li class="devsite-nav-item"> <a href="https://cloud.google.com/docs/access-resources" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/access-resources" track-metadata-position="nav - crossproduct" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Access and resources management </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/docs/costs-usage" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/costs-usage" track-metadata-position="nav - crossproduct" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Costs and usage management </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/docs/devtools" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/devtools" track-metadata-position="nav - crossproduct" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Google Cloud SDK, languages, frameworks, and tools </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/docs/iac" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/iac" track-metadata-position="nav - crossproduct" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Infrastructure as code </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/docs/migration" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/migration" track-metadata-position="nav - crossproduct" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Migration </div> </a> </li> </ul> </div> </div> </div> </tab> <tab class="devsite-dropdown devsite-clickable "> <a href="https://cloud.google.com/" track-metadata-eventdetail="https://cloud.google.com/" class="devsite-tabs-content gc-analytics-event " track-type="nav" track-metadata-position="nav - related-sites" track-metadata-module="primary nav" data-category="Site-Wide Custom Events" data-label="Tab: Related sites" track-name="related-sites" track-link-column-type="single-column" > Related sites </a> <a href="#" role="button" aria-haspopup="true" aria-expanded="false" aria-label="Dropdown menu for Related sites" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/" track-metadata-position="nav - related-sites" track-metadata-module="primary nav" data-category="Site-Wide Custom Events" data-label="Tab: Related sites" track-name="related-sites" track-link-column-type="single-column" class="devsite-tabs-dropdown-toggle devsite-icon devsite-icon-arrow-drop-down"></a> <div class="devsite-tabs-dropdown" aria-label="submenu" hidden> <button class="devsite-tabs-close-button material-icons button-flat gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Close dropdown menu" aria-label="Close dropdown menu" track-type="nav" track-name="close" track-metadata-eventdetail="#" track-metadata-position="nav - related-sites" track-metadata-module="tertiary nav">close</button> <div class="devsite-tabs-dropdown-content"> <div class="devsite-tabs-dropdown-column "> <ul class="devsite-tabs-dropdown-section "> <li class="devsite-nav-item"> <a href="https://cloud.google.com/" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/" track-metadata-position="nav - related-sites" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Google Cloud Home </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/free" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/free" track-metadata-position="nav - related-sites" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Free Trial and Free Tier </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/architecture" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/architecture" track-metadata-position="nav - related-sites" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Architecture Center </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/blog" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/blog" track-metadata-position="nav - related-sites" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Blog </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/contact" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/contact" track-metadata-position="nav - related-sites" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Contact Sales </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/developers" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/developers" track-metadata-position="nav - related-sites" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Google Cloud Developer Center </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developers.google.com/" track-type="nav" track-metadata-eventdetail="https://developers.google.com/" track-metadata-position="nav - related-sites" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Google Developer Center </div> </a> </li> <li class="devsite-nav-item"> <a href="https://console.cloud.google.com/marketplace" track-type="nav" track-metadata-eventdetail="https://console.cloud.google.com/marketplace" track-metadata-position="nav - related-sites" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Google Cloud Marketplace </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/marketplace/docs" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/marketplace/docs" track-metadata-position="nav - related-sites" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Google Cloud Marketplace Documentation </div> </a> </li> <li class="devsite-nav-item"> <a href="https://www.cloudskillsboost.google/paths" track-type="nav" track-metadata-eventdetail="https://www.cloudskillsboost.google/paths" track-metadata-position="nav - related-sites" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Google Cloud Skills Boost </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/solutions" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/solutions" track-metadata-position="nav - related-sites" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Google Cloud Solution Center </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/support-hub" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/support-hub" track-metadata-position="nav - related-sites" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Google Cloud Support </div> </a> </li> <li class="devsite-nav-item"> <a href="https://www.youtube.com/@googlecloudtech" track-type="nav" track-metadata-eventdetail="https://www.youtube.com/@googlecloudtech" track-metadata-position="nav - related-sites" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Google Cloud Tech Youtube Channel </div> </a> </li> </ul> </div> </div> </div> </tab> </nav> </cloudx-tabs-nav> </div> <devsite-search enable-signin enable-search enable-suggestions project-name="Generative AI on Vertex AI" tenant-name="Google Cloud" project-scope="/vertex-ai/generative-ai/docs/learn/overview" url-scoped="https://cloud.google.com/s/results/vertex-ai/generative-ai/docs/learn/overview" > <form class="devsite-search-form" action="https://cloud.google.com/s/results" method="GET"> <div class="devsite-search-container"> <button type="button" search-open class="devsite-search-button devsite-header-icon-button button-flat material-icons" aria-label="Open search"></button> <div class="devsite-searchbox"> <input aria-activedescendant="" aria-autocomplete="list" aria-label="Search" aria-expanded="false" aria-haspopup="listbox" autocomplete="off" class="devsite-search-field devsite-search-query" name="q" placeholder="Search" role="combobox" type="text" value="" > <div class="devsite-search-image material-icons" aria-hidden="true"> </div> <div class="devsite-search-shortcut-icon-container" aria-hidden="true"> <kbd class="devsite-search-shortcut-icon">/</kbd> </div> </div> </div> </form> <button type="button" search-close class="devsite-search-button devsite-header-icon-button button-flat material-icons" aria-label="Close search"></button> </devsite-search> </div> <devsite-language-selector> <ul role="presentation"> <li role="presentation"> <a role="menuitem" lang="en" >English</a> </li> <li role="presentation"> <a role="menuitem" lang="de" >Deutsch</a> </li> <li role="presentation"> <a role="menuitem" lang="es_419" >Español – América Latina</a> </li> <li role="presentation"> <a role="menuitem" lang="fr" >Français</a> </li> <li role="presentation"> <a role="menuitem" lang="id" >Indonesia</a> </li> <li role="presentation"> <a role="menuitem" lang="it" >Italiano</a> </li> <li role="presentation"> <a role="menuitem" lang="pt_br" >Português – Brasil</a> </li> <li role="presentation"> <a role="menuitem" lang="zh_cn" >中文 – 简体</a> </li> <li role="presentation"> <a role="menuitem" lang="ja" >日本語</a> </li> <li role="presentation"> <a role="menuitem" lang="ko" >한국어</a> </li> </ul> </devsite-language-selector> <devsite-user enable-profiles fp-auth id="devsite-user"> <span class="button devsite-top-button" aria-hidden="true" visually-hidden>Sign in</span> </devsite-user> </div> </div> </div> <div class="devsite-collapsible-section "> <div class="devsite-header-background"> <div class="devsite-product-id-row" hidden> <div class="devsite-product-description-row"> </div> </div> <div class="devsite-doc-set-nav-row"> <ul class="devsite-breadcrumb-list" > <li class="devsite-breadcrumb-item "> <a href="https://cloud.google.com/vertex-ai/generative-ai/docs/overview" class="devsite-breadcrumb-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Lower Header" data-value="1" track-type="globalNav" track-name="breadcrumb" track-metadata-position="1" track-metadata-eventdetail="Generative AI on Vertex AI" > Generative AI on Vertex AI </a> </li> </ul> <cloudx-tabs-nav class="lower-tabs"> <nav class="devsite-tabs-wrapper" aria-label="Lower tabs"> <tab class="devsite-active"> <a href="https://cloud.google.com/vertex-ai/generative-ai/docs/overview" track-metadata-eventdetail="https://cloud.google.com/vertex-ai/generative-ai/docs/overview" class="devsite-tabs-content gc-analytics-event " track-type="nav" track-metadata-position="nav - guides" track-metadata-module="primary nav" aria-label="Guides, selected" data-category="Site-Wide Custom Events" data-label="Tab: Guides" track-name="guides" > Guides </a> </tab> <tab > <a href="https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/inference" track-metadata-eventdetail="https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/inference" class="devsite-tabs-content gc-analytics-event " track-type="nav" track-metadata-position="nav - api reference" track-metadata-module="primary nav" data-category="Site-Wide Custom Events" data-label="Tab: API reference" track-name="api reference" > API reference </a> </tab> <tab > <a href="https://cloud.google.com/vertex-ai/generative-ai/docs/samples?text=Gemini" track-metadata-eventdetail="https://cloud.google.com/vertex-ai/generative-ai/docs/samples?text=Gemini" class="devsite-tabs-content gc-analytics-event " track-type="nav" track-metadata-position="nav - samples and notebooks" track-metadata-module="primary nav" data-category="Site-Wide Custom Events" data-label="Tab: Samples and notebooks" track-name="samples and notebooks" > Samples and notebooks </a> </tab> <tab > <a href="https://cloud.google.com/vertex-ai/generative-ai/docs/prompt-gallery" track-metadata-eventdetail="https://cloud.google.com/vertex-ai/generative-ai/docs/prompt-gallery" class="devsite-tabs-content gc-analytics-event " track-type="nav" track-metadata-position="nav - prompt gallery" track-metadata-module="primary nav" data-category="Site-Wide Custom Events" data-label="Tab: Prompt gallery" track-name="prompt gallery" > Prompt gallery </a> </tab> </nav> </cloudx-tabs-nav> <div class="devsite-product-button-row"> <a href="https://cloud.google.com/contact" class="cta-button-secondary button " track-metadata-position="nav" data-overflow-container="left" track-type="contact" data-overflow-wrapper="tab" track-name="sales" track-metadata-eventDetail="nav" data-overflow="devsite-tabs-wrapper" >Contact Us</a> <a href="//console.cloud.google.com/freetrial" class="cloud-free-trial-button cta-button-primary button-primary button cloud-button cloud-button--primary " data-overflow-class="devsite-header-link devsite-top-button button cloud-free-trial-button cloud-free-trial-enabled cloud-button cloud-button--primary" track-type="freeTrial" data-overflow-container="right" track-metadata-eventDetail="nav" data-overflow="devsite-top-logo-row" track-name="gcpCta" track-metadata-position="nav" referrerpolicy="no-referrer-when-downgrade" >Start free</a> </div> </div> </div> </div> </div> </devsite-header> <devsite-book-nav scrollbars > <div class="devsite-book-nav-filter" hidden> <span class="filter-list-icon material-icons" aria-hidden="true"></span> <input type="text" placeholder="Filter" aria-label="Type to filter" role="searchbox"> <span class="filter-clear-button hidden" data-title="Clear filter" aria-label="Clear filter" role="button" tabindex="0"></span> </div> <nav class="devsite-book-nav devsite-nav nocontent" aria-label="Side menu"> <div class="devsite-mobile-header"> <button type="button" id="devsite-close-nav" class="devsite-header-icon-button button-flat material-icons gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Close navigation" aria-label="Close navigation"> </button> <div class="devsite-product-name-wrapper"> <a href="/" class="devsite-site-logo-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Site logo" track-type="globalNav" track-name="googleCloud" track-metadata-position="nav" track-metadata-eventDetail="nav"> <picture> <img src="https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/cloud/images/cloud-logo.svg" class="devsite-site-logo" alt="Google Cloud"> </picture> </a> <span class="devsite-product-name"> <ul class="devsite-breadcrumb-list" > <li class="devsite-breadcrumb-item devsite-has-google-wordmark"> </li> </ul> </span> </div> </div> <div class="devsite-book-nav-wrapper"> <div class="devsite-mobile-nav-top"> <ul class="devsite-nav-list"> <li class="devsite-nav-item"> <a href="/docs" class="devsite-nav-title gc-analytics-event devsite-nav-active" data-category="Site-Wide Custom Events" data-label="Tab: Documentation" track-name="docs-home" track-link-column-type="single-column" data-category="Site-Wide Custom Events" data-label="Responsive Tab: Documentation" track-type="globalNav" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Documentation </span> </a> <ul class="devsite-nav-responsive-tabs"> <li class="devsite-nav-item"> <a href="/vertex-ai/generative-ai/docs/overview" class="devsite-nav-title gc-analytics-event devsite-nav-has-children devsite-nav-active" data-category="Site-Wide Custom Events" data-label="Tab: Guides" track-name="guides" data-category="Site-Wide Custom Events" data-label="Responsive Tab: Guides" track-type="globalNav" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip menu="_book"> Guides </span> <span class="devsite-nav-icon material-icons" data-icon="forward" menu="_book"> </span> </a> </li> <li class="devsite-nav-item"> <a href="/vertex-ai/generative-ai/docs/model-reference/inference" class="devsite-nav-title gc-analytics-event devsite-nav-has-children " data-category="Site-Wide Custom Events" data-label="Tab: API reference" track-name="api reference" data-category="Site-Wide Custom Events" data-label="Responsive Tab: API reference" track-type="globalNav" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > API reference </span> <span class="devsite-nav-icon material-icons" data-icon="forward" > </span> </a> </li> <li class="devsite-nav-item"> <a href="/vertex-ai/generative-ai/docs/samples?text=Gemini" class="devsite-nav-title gc-analytics-event devsite-nav-has-children " data-category="Site-Wide Custom Events" data-label="Tab: Samples and notebooks" track-name="samples and notebooks" data-category="Site-Wide Custom Events" data-label="Responsive Tab: Samples and notebooks" track-type="globalNav" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Samples and notebooks </span> <span class="devsite-nav-icon material-icons" data-icon="forward" > </span> </a> </li> <li class="devsite-nav-item"> <a href="/vertex-ai/generative-ai/docs/prompt-gallery" class="devsite-nav-title gc-analytics-event devsite-nav-has-children " data-category="Site-Wide Custom Events" data-label="Tab: Prompt gallery" track-name="prompt gallery" data-category="Site-Wide Custom Events" data-label="Responsive Tab: Prompt gallery" track-type="globalNav" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Prompt gallery </span> <span class="devsite-nav-icon material-icons" data-icon="forward" > </span> </a> </li> </ul> </li> <li class="devsite-nav-item"> <a href="/docs/tech-area-overviews" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Tab: Technology areas" track-name="technology-areas" track-link-column-type="single-column" data-category="Site-Wide Custom Events" data-label="Responsive Tab: Technology areas" track-type="globalNav" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Technology areas </span> </a> <ul class="devsite-nav-responsive-tabs devsite-nav-has-menu "> <li class="devsite-nav-item"> <span class="devsite-nav-title" tooltip data-category="Site-Wide Custom Events" data-label="Tab: Technology areas" track-name="technology-areas" track-link-column-type="single-column" > <span class="devsite-nav-text" tooltip menu="Technology areas"> More </span> <span class="devsite-nav-icon material-icons" data-icon="forward" menu="Technology areas"> </span> </span> </li> </ul> </li> <li class="devsite-nav-item"> <a href="/docs/cross-product-overviews" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Tab: Cross-product tools" track-name="crossproduct" track-link-column-type="single-column" data-category="Site-Wide Custom Events" data-label="Responsive Tab: Cross-product tools" track-type="globalNav" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Cross-product tools </span> </a> <ul class="devsite-nav-responsive-tabs devsite-nav-has-menu "> <li class="devsite-nav-item"> <span class="devsite-nav-title" tooltip data-category="Site-Wide Custom Events" data-label="Tab: Cross-product tools" track-name="crossproduct" track-link-column-type="single-column" > <span class="devsite-nav-text" tooltip menu="Cross-product tools"> More </span> <span class="devsite-nav-icon material-icons" data-icon="forward" menu="Cross-product tools"> </span> </span> </li> </ul> </li> <li class="devsite-nav-item"> <a href="/" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Tab: Related sites" track-name="related-sites" track-link-column-type="single-column" data-category="Site-Wide Custom Events" data-label="Responsive Tab: Related sites" track-type="globalNav" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Related sites </span> </a> <ul class="devsite-nav-responsive-tabs devsite-nav-has-menu "> <li class="devsite-nav-item"> <span class="devsite-nav-title" tooltip data-category="Site-Wide Custom Events" data-label="Tab: Related sites" track-name="related-sites" track-link-column-type="single-column" > <span class="devsite-nav-text" tooltip menu="Related sites"> More </span> <span class="devsite-nav-icon material-icons" data-icon="forward" menu="Related sites"> </span> </span> </li> </ul> </li> <li class="devsite-nav-item"> <a href="//console.cloud.google.com/" class="devsite-nav-title gc-analytics-event " track-metadata-eventDetail="nav" track-type="globalNav" referrerpolicy="no-referrer-when-downgrade" track-metadata-position="nav" track-name="console" data-category="Site-Wide Custom Events" data-label="Responsive Tab: Console" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Console </span> </a> </li> <li class="devsite-nav-item"> <a href="/contact" class="cta-button-secondary button" track-metadata-position="nav" data-overflow-container="left" track-type="contact" data-overflow-wrapper="tab" track-name="sales" track-metadata-eventDetail="nav" data-overflow="devsite-tabs-wrapper" data-category="Site-Wide Custom Events" data-label="Responsive Tab: Contact Us" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Contact Us </span> </a> </li> <li class="devsite-nav-item"> <a href="//console.cloud.google.com/freetrial" class="cloud-free-trial-button cta-button-primary button-primary button cloud-button cloud-button--primary" data-overflow-class="devsite-header-link devsite-top-button button cloud-free-trial-button cloud-free-trial-enabled cloud-button cloud-button--primary" track-type="freeTrial" data-overflow-container="right" track-metadata-eventDetail="nav" data-overflow="devsite-top-logo-row" track-name="gcpCta" track-metadata-position="nav" referrerpolicy="no-referrer-when-downgrade" data-category="Site-Wide Custom Events" data-label="Responsive Tab: Start free" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Start free </span> </a> </li> </ul> </div> <div class="devsite-mobile-nav-bottom"> <ul class="devsite-nav-list" menu="_book"> <li class="devsite-nav-item devsite-nav-heading"><div class="devsite-nav-title devsite-nav-title-no-path"> <span class="devsite-nav-text" tooltip>Discover</span> </div></li> <li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/overview" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/overview" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/overview" ><span class="devsite-nav-text" tooltip>Overview of Generative AI on Vertex AI</span></a></li> <li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/learn/overview" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/learn/overview" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/learn/overview" ><span class="devsite-nav-text" tooltip>Generative AI beginner&#39;s guide</span></a></li> <li class="devsite-nav-item devsite-nav-heading"><div class="devsite-nav-title devsite-nav-title-no-path"> <span class="devsite-nav-text" tooltip>Get started</span> </div></li> <li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/start/quickstarts/try-gen-ai" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/start/quickstarts/try-gen-ai" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/start/quickstarts/try-gen-ai" ><span class="devsite-nav-text" tooltip>Try it: Send a text prompt to the Gemini API without an account</span></a></li> <li class="devsite-nav-item devsite-nav-limited"><a href="/vertex-ai/generative-ai/docs/image/quickstart-image-generate-console" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/image/quickstart-image-generate-console" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/image/quickstart-image-generate-console" ><span class="devsite-nav-text" tooltip>Try it: Generate an image and verify its watermark using Imagen</span><span class="devsite-nav-icon material-icons" data-icon="limited" data-title="Limited Access" aria-hidden="true"></span></a></li> <li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/start/quickstarts/quickstart-multimodal" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/start/quickstarts/quickstart-multimodal" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/start/quickstarts/quickstart-multimodal" ><span class="devsite-nav-text" tooltip>Quickstart: Generate text using the Gemini API</span></a></li> <li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/start/quickstarts/quickstart" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/start/quickstarts/quickstart" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/start/quickstarts/quickstart" ><span class="devsite-nav-text" tooltip>Quickstart: Send text prompts to Gemini using Vertex AI Studio</span></a></li> <li class="devsite-nav-item devsite-nav-heading"><div class="devsite-nav-title devsite-nav-title-no-path"> <span class="devsite-nav-text" tooltip>Explore and use models in Model Garden</span> </div></li> <li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/model-garden/quickstart" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/model-garden/quickstart" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/model-garden/quickstart" ><span class="devsite-nav-text" tooltip>Try it: Test model capabilities using Playspaces</span></a></li> <li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/model-garden/explore-models" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/model-garden/explore-models" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/model-garden/explore-models" ><span class="devsite-nav-text" tooltip>Overview of Model Garden</span></a></li> <li class="devsite-nav-item devsite-nav-heading"><div class="devsite-nav-title devsite-nav-title-no-path"> <span class="devsite-nav-text" tooltip>Available models</span> </div></li> <li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/learn/models" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/learn/models" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/learn/models" ><span class="devsite-nav-text" tooltip>Google models</span></a></li> <li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/multimodal/gemini-experimental" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/multimodal/gemini-experimental" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/multimodal/gemini-experimental" ><span class="devsite-nav-text" tooltip>Experimental models</span></a></li> <li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/learn/model-versions" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/learn/model-versions" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/learn/model-versions" ><span class="devsite-nav-text" tooltip>Model versions</span></a></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Open models</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/open-models/use-open-models" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/open-models/use-open-models" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/open-models/use-open-models" ><span class="devsite-nav-text" tooltip>Use open models</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/open-models/use-gemma" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/open-models/use-gemma" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/open-models/use-gemma" ><span class="devsite-nav-text" tooltip>Google Gemma</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/model-garden/deploy-and-inference-tutorial" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/model-garden/deploy-and-inference-tutorial" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/model-garden/deploy-and-inference-tutorial" ><span class="devsite-nav-text" tooltip>Tutorial: Deploy and inference Gemma (GPU)</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/model-garden/deploy-and-inference-tutorial-tpu" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/model-garden/deploy-and-inference-tutorial-tpu" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/model-garden/deploy-and-inference-tutorial-tpu" ><span class="devsite-nav-text" tooltip>Tutorial: Deploy and inference Gemma (TPU)</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/open-models/use-llama" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/open-models/use-llama" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/open-models/use-llama" ><span class="devsite-nav-text" tooltip>Open LLaMa</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/open-models/use-hugging-face-models" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/open-models/use-hugging-face-models" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/open-models/use-hugging-face-models" ><span class="devsite-nav-text" tooltip>Hugging Face text generation models</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/open-models/use-hex-llm" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/open-models/use-hex-llm" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/open-models/use-hex-llm" ><span class="devsite-nav-text" tooltip>Hex-LLM</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Partner models</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/partner-models/use-partner-models" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/partner-models/use-partner-models" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/partner-models/use-partner-models" ><span class="devsite-nav-text" tooltip>Model as a Service (MaaS) overview</span></a></li><li class="devsite-nav-item devsite-nav-preview"><a href="/vertex-ai/generative-ai/docs/partner-models/ai21" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/partner-models/ai21" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/partner-models/ai21" ><span class="devsite-nav-text" tooltip>AI21 Labs</span><span class="devsite-nav-icon material-icons" data-icon="preview" data-title="Preview" aria-hidden="true"></span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/partner-models/use-claude" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/partner-models/use-claude" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/partner-models/use-claude" ><span class="devsite-nav-text" tooltip>Anthropic&#39;s Claude</span></a></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Llama</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/partner-models/llama" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/partner-models/llama" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/partner-models/llama" ><span class="devsite-nav-text" tooltip>Llama models</span></a></li><li class="devsite-nav-item devsite-nav-preview"><a href="/vertex-ai/generative-ai/docs/partner-models/llama-batch" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/partner-models/llama-batch" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/partner-models/llama-batch" ><span class="devsite-nav-text" tooltip>Batch predictions</span><span class="devsite-nav-icon material-icons" data-icon="preview" data-title="Preview" aria-hidden="true"></span></a></li></ul></div></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/partner-models/mistral" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/partner-models/mistral" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/partner-models/mistral" ><span class="devsite-nav-text" tooltip>Mistral AI</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-heading"><div class="devsite-nav-title devsite-nav-title-no-path"> <span class="devsite-nav-text" tooltip>Capabilities</span> </div></li> <li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/multimodal/send-chat-prompts-gemini" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/multimodal/send-chat-prompts-gemini" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/multimodal/send-chat-prompts-gemini" ><span class="devsite-nav-text" tooltip>Text generation</span></a></li> <li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/multimodal/batch-prediction-gemini" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/multimodal/batch-prediction-gemini" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/multimodal/batch-prediction-gemini" ><span class="devsite-nav-text" tooltip>Batch prediction</span></a></li> <li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/multimodal/image-understanding" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/multimodal/image-understanding" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/multimodal/image-understanding" ><span class="devsite-nav-text" tooltip>Image understanding</span></a></li> <li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/multimodal/video-understanding" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/multimodal/video-understanding" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/multimodal/video-understanding" ><span class="devsite-nav-text" tooltip>Video understanding</span></a></li> <li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/multimodal/audio-understanding" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/multimodal/audio-understanding" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/multimodal/audio-understanding" ><span class="devsite-nav-text" tooltip>Audio understanding</span></a></li> <li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/multimodal/document-understanding" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/multimodal/document-understanding" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/multimodal/document-understanding" ><span class="devsite-nav-text" tooltip>Document understanding</span></a></li> <li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/learn/prompts/system-instruction-introduction" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/learn/prompts/system-instruction-introduction" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/learn/prompts/system-instruction-introduction" ><span class="devsite-nav-text" tooltip>System instructions</span></a></li> <li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/multimodal/function-calling" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/multimodal/function-calling" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/multimodal/function-calling" ><span class="devsite-nav-text" tooltip>Function calling</span></a></li> <li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/multimodal/control-generated-output" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/multimodal/control-generated-output" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/multimodal/control-generated-output" ><span class="devsite-nav-text" tooltip>Controlled generation</span></a></li> <li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/multimodal/content-generation-parameters" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/multimodal/content-generation-parameters" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/multimodal/content-generation-parameters" ><span class="devsite-nav-text" tooltip>Content generation parameters</span></a></li> <li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/long-context" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/long-context" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/long-context" ><span class="devsite-nav-text" tooltip>Long context</span></a></li> <li class="devsite-nav-item devsite-nav-expandable devsite-nav-preview"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Context caching</span><span class="devsite-nav-icon material-icons" data-icon="preview" data-title="Preview" aria-hidden="true"></span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/context-cache/context-cache-overview" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/context-cache/context-cache-overview" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/context-cache/context-cache-overview" ><span class="devsite-nav-text" tooltip>Overview</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/context-cache/context-cache-create" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/context-cache/context-cache-create" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/context-cache/context-cache-create" ><span class="devsite-nav-text" tooltip>Create a context cache</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/context-cache/context-cache-use" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/context-cache/context-cache-use" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/context-cache/context-cache-use" ><span class="devsite-nav-text" tooltip>Use a context cache</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/context-cache/context-cache-getinfo" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/context-cache/context-cache-getinfo" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/context-cache/context-cache-getinfo" ><span class="devsite-nav-text" tooltip>Get context cache information</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/context-cache/context-cache-update" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/context-cache/context-cache-update" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/context-cache/context-cache-update" ><span class="devsite-nav-text" tooltip>Update a context cache</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/context-cache/context-cache-delete" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/context-cache/context-cache-delete" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/context-cache/context-cache-delete" ><span class="devsite-nav-text" tooltip>Delete a context cache</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Fine-tuning</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/models/tune-models" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/models/tune-models" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/models/tune-models" ><span class="devsite-nav-text" tooltip>Introduction to tuning</span></a></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Gemini models</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Supervised fine-tuning</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/models/gemini-supervised-tuning" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/models/gemini-supervised-tuning" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/models/gemini-supervised-tuning" ><span class="devsite-nav-text" tooltip>About supervised fine-tuning</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/models/gemini-supervised-tuning-prepare" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/models/gemini-supervised-tuning-prepare" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/models/gemini-supervised-tuning-prepare" ><span class="devsite-nav-text" tooltip>Prepare your data</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/models/gemini-use-supervised-tuning" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/models/gemini-use-supervised-tuning" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/models/gemini-use-supervised-tuning" ><span class="devsite-nav-text" tooltip>Use supervised fine-tuning</span></a></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Supported modalities</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/models/tune_gemini/text_tune" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/models/tune_gemini/text_tune" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/models/tune_gemini/text_tune" ><span class="devsite-nav-text" tooltip>Text tuning</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/models/tune_gemini/doc_tune" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/models/tune_gemini/doc_tune" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/models/tune_gemini/doc_tune" ><span class="devsite-nav-text" tooltip>Document tuning</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/models/tune_gemini/image_tune" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/models/tune_gemini/image_tune" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/models/tune_gemini/image_tune" ><span class="devsite-nav-text" tooltip>Image tuning</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/models/tune_gemini/audio_tune" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/models/tune_gemini/audio_tune" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/models/tune_gemini/audio_tune" ><span class="devsite-nav-text" tooltip>Audio tuning</span></a></li></ul></div></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/models/tune_gemini/tune-gemini-learn" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/models/tune_gemini/tune-gemini-learn" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/models/tune_gemini/tune-gemini-learn" ><span class="devsite-nav-text" tooltip>Examples for tuning Gemini text models</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/models/gemini-tuning-migrate-from-palm-api" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/models/gemini-tuning-migrate-from-palm-api" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/models/gemini-tuning-migrate-from-palm-api" ><span class="devsite-nav-text" tooltip>Migrate tuning from PaLM to Gemini</span></a></li></ul></div></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Embeddings models</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/models/tune-embeddings" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/models/tune-embeddings" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/models/tune-embeddings" ><span class="devsite-nav-text" tooltip>Tune text embeddings models</span></a></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable devsite-nav-limited"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Imagen models</span><span class="devsite-nav-icon material-icons" data-icon="limited" data-title="Limited Access" aria-hidden="true"></span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item devsite-nav-limited"><a href="/vertex-ai/generative-ai/docs/image/fine-tune-model" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/image/fine-tune-model" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/image/fine-tune-model" ><span class="devsite-nav-text" tooltip>Tune a subject model</span><span class="devsite-nav-icon material-icons" data-icon="limited" data-title="Limited Access" aria-hidden="true"></span></a></li><li class="devsite-nav-item devsite-nav-limited"><a href="/vertex-ai/generative-ai/docs/image/fine-tune-style" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/image/fine-tune-style" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/image/fine-tune-style" ><span class="devsite-nav-text" tooltip>Create a custom style model</span><span class="devsite-nav-icon material-icons" data-icon="limited" data-title="Limited Access" aria-hidden="true"></span></a></li></ul></div></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/model-garden/lora-qlora" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/model-garden/lora-qlora" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/model-garden/lora-qlora" ><span class="devsite-nav-text" tooltip>Tuning recommendations with LoRA and QLoRA</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Evaluation</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/models/evaluation-overview" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/models/evaluation-overview" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/models/evaluation-overview" ><span class="devsite-nav-text" tooltip>Overview</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/models/evaluation-quickstart" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/models/evaluation-quickstart" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/models/evaluation-quickstart" ><span class="devsite-nav-text" tooltip>Quickstart: Gen AI evaluation workflow</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/models/determine-eval" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/models/determine-eval" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/models/determine-eval" ><span class="devsite-nav-text" tooltip>Define your evaluation metrics</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/models/evaluation-dataset" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/models/evaluation-dataset" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/models/evaluation-dataset" ><span class="devsite-nav-text" tooltip>Prepare your evaluation dataset</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/models/run-evaluation" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/models/run-evaluation" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/models/run-evaluation" ><span class="devsite-nav-text" tooltip>Run an evaluation</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/models/view-evaluation" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/models/view-evaluation" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/models/view-evaluation" ><span class="devsite-nav-text" tooltip>View and interpret your evaluation results</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/models/metrics-templates" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/models/metrics-templates" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/models/metrics-templates" ><span class="devsite-nav-text" tooltip>Reference: Model-based metrics templates</span></a></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Other evaluation documentation</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/models/side-by-side-eval" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/models/side-by-side-eval" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/models/side-by-side-eval" ><span class="devsite-nav-text" tooltip>Run AutoSxS pipeline</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/models/computation-based-eval-pipeline" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/models/computation-based-eval-pipeline" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/models/computation-based-eval-pipeline" ><span class="devsite-nav-text" tooltip>Run a computation-based evaluation pipeline</span></a></li></ul></div></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Grounding</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/grounding/overview" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/grounding/overview" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/grounding/overview" ><span class="devsite-nav-text" tooltip>Overview</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/multimodal/ground-gemini" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/multimodal/ground-gemini" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/multimodal/ground-gemini" ><span class="devsite-nav-text" tooltip>Ground Gemini responses</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/multimodal/grounding-search-suggestions" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/multimodal/grounding-search-suggestions" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/multimodal/grounding-search-suggestions" ><span class="devsite-nav-text" tooltip>Use Google Search Suggestions</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/ground-responses-using-rag" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/ground-responses-using-rag" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/ground-responses-using-rag" ><span class="devsite-nav-text" tooltip>Ground responses using RAG</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Safety</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/learn/responsible-ai" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/learn/responsible-ai" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/learn/responsible-ai" ><span class="devsite-nav-text" tooltip>Responsible AI</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/multimodal/safety-system-instructions" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/multimodal/safety-system-instructions" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/multimodal/safety-system-instructions" ><span class="devsite-nav-text" tooltip>System instructions for safety</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/multimodal/configure-safety-filters" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/multimodal/configure-safety-filters" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/multimodal/configure-safety-filters" ><span class="devsite-nav-text" tooltip>Configure safety filters</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/learn/responsible-ai" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/learn/responsible-ai" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/learn/responsible-ai" ><span class="devsite-nav-text" tooltip>Responsible AI</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/learn/abuse-monitoring" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/learn/abuse-monitoring" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/learn/abuse-monitoring" ><span class="devsite-nav-text" tooltip>Abuse monitoring</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable devsite-nav-preview"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Extensions</span><span class="devsite-nav-icon material-icons" data-icon="preview" data-title="Preview" aria-hidden="true"></span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/extensions/overview" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/extensions/overview" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/extensions/overview" ><span class="devsite-nav-text" tooltip>Overview</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/extensions/create-extension" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/extensions/create-extension" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/extensions/create-extension" ><span class="devsite-nav-text" tooltip>Create and run extension </span></a></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Extensions by Google</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/extensions/code-interpreter" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/extensions/code-interpreter" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/extensions/code-interpreter" ><span class="devsite-nav-text" tooltip>Code Interpreter extension</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/extensions/vertex-ai-search" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/extensions/vertex-ai-search" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/extensions/vertex-ai-search" ><span class="devsite-nav-text" tooltip>Vertex AI Search extension</span></a></li></ul></div></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Image generation</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/image/overview" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/image/overview" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/image/overview" ><span class="devsite-nav-text" tooltip>Imagen on Vertex AI overview</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/image/responsible-ai-imagen" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/image/responsible-ai-imagen" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/image/responsible-ai-imagen" ><span class="devsite-nav-text" tooltip>Responsible AI and usage guidelines for Imagen</span></a></li><li class="devsite-nav-item devsite-nav-limited"><a href="/vertex-ai/generative-ai/docs/image/model-versioning" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/image/model-versioning" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/image/model-versioning" ><span class="devsite-nav-text" tooltip>Imagen model versions and lifecycle</span><span class="devsite-nav-icon material-icons" data-icon="limited" data-title="Limited Access" aria-hidden="true"></span></a></li><li class="devsite-nav-item devsite-nav-limited"><a href="/vertex-ai/generative-ai/docs/image/img-gen-prompt-guide" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/image/img-gen-prompt-guide" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/image/img-gen-prompt-guide" ><span class="devsite-nav-text" tooltip>Prompt and image attribute guide</span><span class="devsite-nav-icon material-icons" data-icon="limited" data-title="Limited Access" aria-hidden="true"></span></a></li><li class="devsite-nav-item devsite-nav-expandable devsite-nav-limited"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Create images</span><span class="devsite-nav-icon material-icons" data-icon="limited" data-title="Limited Access" aria-hidden="true"></span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item devsite-nav-limited"><a href="/vertex-ai/generative-ai/docs/image/generate-images" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/image/generate-images" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/image/generate-images" ><span class="devsite-nav-text" tooltip>Generate images using text prompts</span><span class="devsite-nav-icon material-icons" data-icon="limited" data-title="Limited Access" aria-hidden="true"></span></a></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable devsite-nav-limited"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Edit images</span><span class="devsite-nav-icon material-icons" data-icon="limited" data-title="Limited Access" aria-hidden="true"></span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item devsite-nav-limited"><a href="/vertex-ai/generative-ai/docs/image/edit-inpainting" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/image/edit-inpainting" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/image/edit-inpainting" ><span class="devsite-nav-text" tooltip>Edit using inpainting (insert or remove objects)</span><span class="devsite-nav-icon material-icons" data-icon="limited" data-title="Limited Access" aria-hidden="true"></span></a></li><li class="devsite-nav-item devsite-nav-limited"><a href="/vertex-ai/generative-ai/docs/image/edit-outpainting" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/image/edit-outpainting" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/image/edit-outpainting" ><span class="devsite-nav-text" tooltip>Edit using outpainting</span><span class="devsite-nav-icon material-icons" data-icon="limited" data-title="Limited Access" aria-hidden="true"></span></a></li><li class="devsite-nav-item devsite-nav-limited"><a href="/vertex-ai/generative-ai/docs/image/edit-product-image" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/image/edit-product-image" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/image/edit-product-image" ><span class="devsite-nav-text" tooltip>Use product image editing</span><span class="devsite-nav-icon material-icons" data-icon="limited" data-title="Limited Access" aria-hidden="true"></span></a></li><li class="devsite-nav-item devsite-nav-preview"><a href="/vertex-ai/generative-ai/docs/image/edit-controlled" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/image/edit-controlled" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/image/edit-controlled" ><span class="devsite-nav-text" tooltip>Edit using Controlled Editing</span><span class="devsite-nav-icon material-icons" data-icon="preview" data-title="Preview" aria-hidden="true"></span></a></li><li class="devsite-nav-item devsite-nav-preview"><a href="/vertex-ai/generative-ai/docs/image/edit-personalization" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/image/edit-personalization" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/image/edit-personalization" ><span class="devsite-nav-text" tooltip>Edit using Personalization</span><span class="devsite-nav-icon material-icons" data-icon="preview" data-title="Preview" aria-hidden="true"></span></a></li><li class="devsite-nav-item devsite-nav-limited"><a href="/vertex-ai/generative-ai/docs/image/edit-images" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/image/edit-images" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/image/edit-images" ><span class="devsite-nav-text" tooltip>Edit images (mask-free)</span><span class="devsite-nav-icon material-icons" data-icon="limited" data-title="Limited Access" aria-hidden="true"></span></a></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Get image information</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/image/image-captioning" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/image/image-captioning" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/image/image-captioning" ><span class="devsite-nav-text" tooltip>Get image descriptions using visual captioning</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/image/visual-question-answering" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/image/visual-question-answering" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/image/visual-question-answering" ><span class="devsite-nav-text" tooltip>Use Visual Question Answering</span></a></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable devsite-nav-preview"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Text-to-live images</span><span class="devsite-nav-icon material-icons" data-icon="preview" data-title="Preview" aria-hidden="true"></span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item devsite-nav-preview"><a href="/vertex-ai/generative-ai/docs/image/ttli-prompt-guide" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/image/ttli-prompt-guide" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/image/ttli-prompt-guide" ><span class="devsite-nav-text" tooltip>Text-to-Live images prompt guide</span><span class="devsite-nav-icon material-icons" data-icon="preview" data-title="Preview" aria-hidden="true"></span></a></li><li class="devsite-nav-item devsite-nav-preview"><a href="/vertex-ai/generative-ai/docs/image/text-to-live-images" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/image/text-to-live-images" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/image/text-to-live-images" ><span class="devsite-nav-text" tooltip>Create live images from text</span><span class="devsite-nav-icon material-icons" data-icon="preview" data-title="Preview" aria-hidden="true"></span></a></li></ul></div></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/image/upscale-image" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/image/upscale-image" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/image/upscale-image" ><span class="devsite-nav-text" tooltip>Upscale an image</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/image/base64-encode" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/image/base64-encode" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/image/base64-encode" ><span class="devsite-nav-text" tooltip>Base64 encode and decode files</span></a></li><li class="devsite-nav-item devsite-nav-expandable devsite-nav-preview"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Use video models</span><span class="devsite-nav-icon material-icons" data-icon="preview" data-title="Preview" aria-hidden="true"></span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item devsite-nav-preview"><a href="/vertex-ai/generative-ai/docs/video/video-descriptions" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/video/video-descriptions" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/video/video-descriptions" ><span class="devsite-nav-text" tooltip>Get video descriptions</span><span class="devsite-nav-icon material-icons" data-icon="preview" data-title="Preview" aria-hidden="true"></span></a></li></ul></div></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Embeddings</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/embeddings" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/embeddings" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/embeddings" ><span class="devsite-nav-text" tooltip>Overview</span></a></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Text embeddings</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/embeddings/task-types" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/embeddings/task-types" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/embeddings/task-types" ><span class="devsite-nav-text" tooltip>Choose an embeddings task type</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/embeddings/get-text-embeddings" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/embeddings/get-text-embeddings" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/embeddings/get-text-embeddings" ><span class="devsite-nav-text" tooltip>Get text embeddings</span></a></li></ul></div></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/embeddings/get-multimodal-embeddings" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/embeddings/get-multimodal-embeddings" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/embeddings/get-multimodal-embeddings" ><span class="devsite-nav-text" tooltip>Get multimodal embeddings</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/embeddings/batch-prediction-genai-embeddings" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/embeddings/batch-prediction-genai-embeddings" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/embeddings/batch-prediction-genai-embeddings" ><span class="devsite-nav-text" tooltip>Get batch embeddings predictions</span></a></li></ul></div></li> <li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/code/test-code-completion-prompts" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/code/test-code-completion-prompts" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/code/test-code-completion-prompts" ><span class="devsite-nav-text" tooltip>Code completion</span></a></li> <li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/translate/translate-text" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/translate/translate-text" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/translate/translate-text" ><span class="devsite-nav-text" tooltip>Translation</span></a></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Prompting tools</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/learn/prompts/ai-powered-prompt-writing" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/learn/prompts/ai-powered-prompt-writing" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/learn/prompts/ai-powered-prompt-writing" ><span class="devsite-nav-text" tooltip>Use AI-powered prompt writing tools</span></a></li><li class="devsite-nav-item devsite-nav-preview"><a href="/vertex-ai/generative-ai/docs/learn/prompts/prompt-optimizer" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/learn/prompts/prompt-optimizer" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/learn/prompts/prompt-optimizer" ><span class="devsite-nav-text" tooltip>Optimize prompts</span><span class="devsite-nav-icon material-icons" data-icon="preview" data-title="Preview" aria-hidden="true"></span></a></li><li class="devsite-nav-item devsite-nav-preview"><a href="/vertex-ai/generative-ai/docs/learn/prompts/prompt-templates" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/learn/prompts/prompt-templates" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/learn/prompts/prompt-templates" ><span class="devsite-nav-text" tooltip>Use prompt templates</span><span class="devsite-nav-icon material-icons" data-icon="preview" data-title="Preview" aria-hidden="true"></span></a></li></ul></div></li> <li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/medlm/overview" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/medlm/overview" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/medlm/overview" ><span class="devsite-nav-text" tooltip>Medical text</span></a></li> <li class="devsite-nav-item devsite-nav-heading"><div class="devsite-nav-title devsite-nav-title-no-path"> <span class="devsite-nav-text" tooltip>Guides</span> </div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Tokens</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item devsite-nav-preview"><a href="/vertex-ai/generative-ai/docs/multimodal/list-token" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/multimodal/list-token" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/multimodal/list-token" ><span class="devsite-nav-text" tooltip>List and count tokens</span><span class="devsite-nav-icon material-icons" data-icon="preview" data-title="Preview" aria-hidden="true"></span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/multimodal/get-token-count" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/multimodal/get-token-count" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/multimodal/get-token-count" ><span class="devsite-nav-text" tooltip>Use the countTokens API</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Deployment best practices</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/deploy/overview" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/deploy/overview" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/deploy/overview" ><span class="devsite-nav-text" tooltip>Overview</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/learn/prompt-best-practices" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/learn/prompt-best-practices" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/learn/prompt-best-practices" ><span class="devsite-nav-text" tooltip>Best practices</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Prompting</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/learn/prompts/introduction-prompt-design" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/learn/prompts/introduction-prompt-design" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/learn/prompts/introduction-prompt-design" ><span class="devsite-nav-text" tooltip>Introduction to prompting</span></a></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Prompting strategies</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/learn/prompts/prompt-design-strategies" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/learn/prompts/prompt-design-strategies" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/learn/prompts/prompt-design-strategies" ><span class="devsite-nav-text" tooltip>Overview</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/learn/prompts/clear-instructions" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/learn/prompts/clear-instructions" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/learn/prompts/clear-instructions" ><span class="devsite-nav-text" tooltip>Give clear and specific instructions</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/learn/prompts/system-instructions" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/learn/prompts/system-instructions" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/learn/prompts/system-instructions" ><span class="devsite-nav-text" tooltip>Use system instructions</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/learn/prompts/assign-role" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/learn/prompts/assign-role" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/learn/prompts/assign-role" ><span class="devsite-nav-text" tooltip>Assign a role</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/learn/prompts/few-shot-examples" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/learn/prompts/few-shot-examples" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/learn/prompts/few-shot-examples" ><span class="devsite-nav-text" tooltip>Include few-shot examples</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/learn/prompts/contextual-information" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/learn/prompts/contextual-information" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/learn/prompts/contextual-information" ><span class="devsite-nav-text" tooltip>Add contextual information</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/learn/prompts/structure-prompts" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/learn/prompts/structure-prompts" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/learn/prompts/structure-prompts" ><span class="devsite-nav-text" tooltip>Structure prompts</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/learn/prompts/explain-reasoning" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/learn/prompts/explain-reasoning" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/learn/prompts/explain-reasoning" ><span class="devsite-nav-text" tooltip>Instruct the model to explain its reasoning</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/learn/prompts/break-down-prompts" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/learn/prompts/break-down-prompts" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/learn/prompts/break-down-prompts" ><span class="devsite-nav-text" tooltip>Break down complex tasks</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/learn/prompts/adjust-parameter-values" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/learn/prompts/adjust-parameter-values" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/learn/prompts/adjust-parameter-values" ><span class="devsite-nav-text" tooltip>Experiment with parameter values</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/learn/prompts/prompt-iteration" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/learn/prompts/prompt-iteration" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/learn/prompts/prompt-iteration" ><span class="devsite-nav-text" tooltip>Prompt iteration strategies</span></a></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Task-specific prompt guidance</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/multimodal/design-multimodal-prompts" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/multimodal/design-multimodal-prompts" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/multimodal/design-multimodal-prompts" ><span class="devsite-nav-text" tooltip>Design multimodal prompts</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/text/text-prompts" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/text/text-prompts" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/text/text-prompts" ><span class="devsite-nav-text" tooltip>Design text prompts</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/chat/chat-prompts" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/chat/chat-prompts" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/chat/chat-prompts" ><span class="devsite-nav-text" tooltip>Design chat prompts</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/code/code-chat-prompts" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/code/code-chat-prompts" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/code/code-chat-prompts" ><span class="devsite-nav-text" tooltip>Design code chat prompts</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/code/code-completion-prompts" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/code/code-completion-prompts" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/code/code-completion-prompts" ><span class="devsite-nav-text" tooltip>Design code completion prompts</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/code/code-generation-prompts" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/code/code-generation-prompts" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/code/code-generation-prompts" ><span class="devsite-nav-text" tooltip>Design code generation prompts</span></a></li><li class="devsite-nav-item devsite-nav-limited"><a href="/vertex-ai/generative-ai/docs/image/img-gen-prompt-guide" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/image/img-gen-prompt-guide" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/image/img-gen-prompt-guide" ><span class="devsite-nav-text" tooltip>Design image generation prompts</span><span class="devsite-nav-icon material-icons" data-icon="limited" data-title="Limited Access" aria-hidden="true"></span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/medlm/medlm-prompts" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/medlm/medlm-prompts" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/medlm/medlm-prompts" ><span class="devsite-nav-text" tooltip>Design medical text prompts</span></a></li></ul></div></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Migration</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item devsite-nav-preview"><a href="/vertex-ai/generative-ai/docs/multimodal/call-vertex-using-openai-library" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/multimodal/call-vertex-using-openai-library" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/multimodal/call-vertex-using-openai-library" ><span class="devsite-nav-text" tooltip>Call Vertex AI models by using the OpenAI library</span><span class="devsite-nav-icon material-icons" data-icon="preview" data-title="Preview" aria-hidden="true"></span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/migrate/migrate-from-azure-to-gemini" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/migrate/migrate-from-azure-to-gemini" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/migrate/migrate-from-azure-to-gemini" ><span class="devsite-nav-text" tooltip>Migrate from Azure OpenAI to Gemini</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/migrate/migrate-google-ai" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/migrate/migrate-google-ai" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/migrate/migrate-google-ai" ><span class="devsite-nav-text" tooltip>Migrate from Google AI to Vertex AI</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/migrate/migrate-palm-to-gemini" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/migrate/migrate-palm-to-gemini" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/migrate/migrate-palm-to-gemini" ><span class="devsite-nav-text" tooltip>Migrate from PaLM 2 to Gemini</span></a></li></ul></div></li> <li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/multimodal/add-labels-to-api-calls" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/multimodal/add-labels-to-api-calls" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/multimodal/add-labels-to-api-calls" ><span class="devsite-nav-text" tooltip>Custom metadata labels</span></a></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Troubleshoot</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item devsite-nav-expandable devsite-nav-preview"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Troubleshoot LangChain on Vertex AI</span><span class="devsite-nav-icon material-icons" data-icon="preview" data-title="Preview" aria-hidden="true"></span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/reasoning-engine/troubleshooting/set-up" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/reasoning-engine/troubleshooting/set-up" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/reasoning-engine/troubleshooting/set-up" ><span class="devsite-nav-text" tooltip>Troubleshoot setting up the environment</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/reasoning-engine/troubleshooting/develop" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/reasoning-engine/troubleshooting/develop" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/reasoning-engine/troubleshooting/develop" ><span class="devsite-nav-text" tooltip>Troubleshoot developing an application</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/reasoning-engine/troubleshooting/deploy" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/reasoning-engine/troubleshooting/deploy" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/reasoning-engine/troubleshooting/deploy" ><span class="devsite-nav-text" tooltip>Troubleshoot deploying an application</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/reasoning-engine/troubleshooting/use" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/reasoning-engine/troubleshooting/use" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/reasoning-engine/troubleshooting/use" ><span class="devsite-nav-text" tooltip>Troubleshoot using an application</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/reasoning-engine/troubleshooting/manage" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/reasoning-engine/troubleshooting/manage" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/reasoning-engine/troubleshooting/manage" ><span class="devsite-nav-text" tooltip>Troubleshoot managing deployed applications</span></a></li></ul></div></li></ul></div></li> <li class="devsite-nav-item devsite-nav-heading"><div class="devsite-nav-title devsite-nav-title-no-path"> <span class="devsite-nav-text" tooltip>Tools/integrations</span> </div></li> <li class="devsite-nav-item devsite-nav-expandable devsite-nav-preview"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>RAG Engine</span><span class="devsite-nav-icon material-icons" data-icon="preview" data-title="Preview" aria-hidden="true"></span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/rag-overview" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/rag-overview" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/rag-overview" ><span class="devsite-nav-text" tooltip>RAG Overview</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/rag-quickstart" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/rag-quickstart" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/rag-quickstart" ><span class="devsite-nav-text" tooltip>RAG quickstart for Python</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/use-data-connectors" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/use-data-connectors" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/use-data-connectors" ><span class="devsite-nav-text" tooltip>Data connectors</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/use-advanced-pdf-parsing" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/use-advanced-pdf-parsing" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/use-advanced-pdf-parsing" ><span class="devsite-nav-text" tooltip>Advanced PDF parsing</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/use-embedding-models" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/use-embedding-models" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/use-embedding-models" ><span class="devsite-nav-text" tooltip>Embedding models</span></a></li><li class="devsite-nav-item devsite-nav-expandable devsite-nav-preview"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Vector database choices in RAG</span><span class="devsite-nav-icon material-icons" data-icon="preview" data-title="Preview" aria-hidden="true"></span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/vector-db-choices" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/vector-db-choices" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/vector-db-choices" ><span class="devsite-nav-text" tooltip>Overview of vector database choices</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/use-feature-store-with-rag" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/use-feature-store-with-rag" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/use-feature-store-with-rag" ><span class="devsite-nav-text" tooltip>Use Feature Store with RAG</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/use-weaviate-db" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/use-weaviate-db" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/use-weaviate-db" ><span class="devsite-nav-text" tooltip>Use Weaviate with RAG</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/use-pinecone" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/use-pinecone" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/use-pinecone" ><span class="devsite-nav-text" tooltip>Use Pinecone with RAG</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/use-vertexai-vector-search" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/use-vertexai-vector-search" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/use-vertexai-vector-search" ><span class="devsite-nav-text" tooltip>Use Vertex AI Vector Search with RAG</span></a></li></ul></div></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable devsite-nav-preview"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>LangChain on Vertex AI</span><span class="devsite-nav-icon material-icons" data-icon="preview" data-title="Preview" aria-hidden="true"></span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/reasoning-engine/overview" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/reasoning-engine/overview" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/reasoning-engine/overview" ><span class="devsite-nav-text" tooltip>Overview</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/reasoning-engine/set-up" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/reasoning-engine/set-up" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/reasoning-engine/set-up" ><span class="devsite-nav-text" tooltip>Set up the environment</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/reasoning-engine/develop" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/reasoning-engine/develop" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/reasoning-engine/develop" ><span class="devsite-nav-text" tooltip>Develop an application</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/reasoning-engine/deploy" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/reasoning-engine/deploy" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/reasoning-engine/deploy" ><span class="devsite-nav-text" tooltip>Deploy the application</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/reasoning-engine/use" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/reasoning-engine/use" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/reasoning-engine/use" ><span class="devsite-nav-text" tooltip>Use the application</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/reasoning-engine/manage" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/reasoning-engine/manage" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/reasoning-engine/manage" ><span class="devsite-nav-text" tooltip>Manage the deployed application</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/reasoning-engine/customize" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/reasoning-engine/customize" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/reasoning-engine/customize" ><span class="devsite-nav-text" tooltip>Customize an application template</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-heading"><div class="devsite-nav-title devsite-nav-title-no-path"> <span class="devsite-nav-text" tooltip>Tutorials and code samples</span> </div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Generative AI on Vertex AI code samples</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/samples" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/samples" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/samples" ><span class="devsite-nav-text" tooltip>Sample browser</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-token-count-multimodal" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-token-count-multimodal" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-token-count-multimodal" ><span class="devsite-nav-text" tooltip> Count tokens for Gemini</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-generate-from-text-input" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-generate-from-text-input" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-generate-from-text-input" ><span class="devsite-nav-text" tooltip> Generate text using Generative AI Model</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-imagen-edit-image-inpainting-insert-mask-mode" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/samples/generativeaionvertexai-imagen-edit-image-inpainting-insert-mask-mode" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-imagen-edit-image-inpainting-insert-mask-mode" ><span class="devsite-nav-text" tooltip>Add image content using automatic mask detection and inpainting with Imagen</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-imagen-edit-image-inpainting-insert-mask" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/samples/generativeaionvertexai-imagen-edit-image-inpainting-insert-mask" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-imagen-edit-image-inpainting-insert-mask" ><span class="devsite-nav-text" tooltip>Add image content using mask-based inpainting with Imagen</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-pro-config-example" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-pro-config-example" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-pro-config-example" ><span class="devsite-nav-text" tooltip>Configure Gemini model parameters</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-token-count" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-token-count" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-token-count" ><span class="devsite-nav-text" tooltip>Count tokens in a prompt</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-sdk-embedding" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/samples/generativeaionvertexai-sdk-embedding" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-sdk-embedding" ><span class="devsite-nav-text" tooltip>Create an embedding using Generative AI on Vertex AI</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-rag-create-corpus" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/samples/generativeaionvertexai-rag-create-corpus" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-rag-create-corpus" ><span class="devsite-nav-text" tooltip>Create an index</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-rag-delete-file" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/samples/generativeaionvertexai-rag-delete-file" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-rag-delete-file" ><span class="devsite-nav-text" tooltip>Delete a RAG file from an index</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-rag-delete-corpus" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/samples/generativeaionvertexai-rag-delete-corpus" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-rag-delete-corpus" ><span class="devsite-nav-text" tooltip>Delete an index</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-imagen-edit-image-mask" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/samples/generativeaionvertexai-imagen-edit-image-mask" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-imagen-edit-image-mask" ><span class="devsite-nav-text" tooltip>Edit image content using a mask with Imagen v.002</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-imagen-edit-image-mask-free" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/samples/generativeaionvertexai-imagen-edit-image-mask-free" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-imagen-edit-image-mask-free" ><span class="devsite-nav-text" tooltip>Edit image content using mask-free editing with Imagen v.002</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-imagen-edit-image-product-image" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/samples/generativeaionvertexai-imagen-edit-image-product-image" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-imagen-edit-image-product-image" ><span class="devsite-nav-text" tooltip>Enhance a product image by modifying the background content with Imagen</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-imagen-edit-image-outpainting-mask" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/samples/generativeaionvertexai-imagen-edit-image-outpainting-mask" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-imagen-edit-image-outpainting-mask" ><span class="devsite-nav-text" tooltip>Expand image content using mask-based outpainting with Imagen</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-function-calling-advanced" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/samples/generativeaionvertexai-function-calling-advanced" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-function-calling-advanced" ><span class="devsite-nav-text" tooltip>Function calling with Gemini AI Model</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-function-calling-advanced" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-function-calling-advanced" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-function-calling-advanced" ><span class="devsite-nav-text" tooltip>Function calling with Gemini AI Model</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-imagen-generate-image" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/samples/generativeaionvertexai-imagen-generate-image" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-imagen-generate-image" ><span class="devsite-nav-text" tooltip>Generate an image from text</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-non-stream-multimodality-basic" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/samples/generativeaionvertexai-non-stream-multimodality-basic" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-non-stream-multimodality-basic" ><span class="devsite-nav-text" tooltip>Generate content from multimodal data using Generative AI</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-stream-multimodality-basic" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/samples/generativeaionvertexai-stream-multimodality-basic" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-stream-multimodality-basic" ><span class="devsite-nav-text" tooltip>Generate content stream with Multimodal AI Model</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-function-calling" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-function-calling" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-function-calling" ><span class="devsite-nav-text" tooltip>Generate content with function calls</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-rag-generate-content" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/samples/generativeaionvertexai-rag-generate-content" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-rag-generate-content" ><span class="devsite-nav-text" tooltip>Generate responses using the RAG file</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-stream-text-basic" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/samples/generativeaionvertexai-stream-text-basic" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-stream-text-basic" ><span class="devsite-nav-text" tooltip>Generate steaming text content with Generative Model</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-single-turn-video" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-single-turn-video" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-single-turn-video" ><span class="devsite-nav-text" tooltip>Generate text from a video</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-get-started" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-get-started" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-get-started" ><span class="devsite-nav-text" tooltip>Generate text from an image</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-pro-example" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-pro-example" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-pro-example" ><span class="devsite-nav-text" tooltip>Generate text from an image</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-safety-settings" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-safety-settings" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-safety-settings" ><span class="devsite-nav-text" tooltip>Generate text from an image with safety settings</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-single-turn-multi-image" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-single-turn-multi-image" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-single-turn-multi-image" ><span class="devsite-nav-text" tooltip>Generate text from multimodal prompt</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-function-calling-chat" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-function-calling-chat" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-function-calling-chat" ><span class="devsite-nav-text" tooltip>Generate text responses using Gemini API with external function calls in a chat scenario</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-non-stream-text-basic" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/samples/generativeaionvertexai-non-stream-text-basic" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-non-stream-text-basic" ><span class="devsite-nav-text" tooltip>Generate Text With a Generative Model</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-rag-get-file" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/samples/generativeaionvertexai-rag-get-file" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-rag-get-file" ><span class="devsite-nav-text" tooltip>Get a RAG file</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-rag-get-corpus" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/samples/generativeaionvertexai-rag-get-corpus" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-rag-get-corpus" ><span class="devsite-nav-text" tooltip>Get information about an index</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-imagen-get-short-form-image-captions" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/samples/generativeaionvertexai-imagen-get-short-form-image-captions" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-imagen-get-short-form-image-captions" ><span class="devsite-nav-text" tooltip>Get short-form image captions</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-imagen-get-short-form-image-responses" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/samples/generativeaionvertexai-imagen-get-short-form-image-responses" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-imagen-get-short-form-image-responses" ><span class="devsite-nav-text" tooltip>Get short-form image responses</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-grounding-with-web" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-grounding-with-web" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-grounding-with-web" ><span class="devsite-nav-text" tooltip>Ground Gemini model responses to Google Search</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-grounding-with-vais" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-grounding-with-vais" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-grounding-with-vais" ><span class="devsite-nav-text" tooltip>Ground Gemini to a Vertex AI Search data store</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-rag-import-files" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/samples/generativeaionvertexai-rag-import-files" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-rag-import-files" ><span class="devsite-nav-text" tooltip>Import a set of RAG files</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-rag-import-files-async" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/samples/generativeaionvertexai-rag-import-files-async" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-rag-import-files-async" ><span class="devsite-nav-text" tooltip>Import RAG files from Google Drive or Cloud Storage</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-multiturn-chat" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-multiturn-chat" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-multiturn-chat" ><span class="devsite-nav-text" tooltip>Interactive text generation with a chatbot</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-multiturn-chat-stream" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-multiturn-chat-stream" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-multiturn-chat-stream" ><span class="devsite-nav-text" tooltip>Interactive text stream generation with a chatbot</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-rag-list-corpora" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/samples/generativeaionvertexai-rag-list-corpora" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-rag-list-corpora" ><span class="devsite-nav-text" tooltip>List indexes in a project</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-rag-list-files" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/samples/generativeaionvertexai-rag-list-files" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-rag-list-files" ><span class="devsite-nav-text" tooltip>List RAG files in an index</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-pdf" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-pdf" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-pdf" ><span class="devsite-nav-text" tooltip>Process a PDF file with Gemini</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-all-modalities" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-all-modalities" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-all-modalities" ><span class="devsite-nav-text" tooltip>Process images, video, audio, and text with Gemini 1.5 Pro</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-imagen-edit-image-inpainting-remove-mask-mode" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/samples/generativeaionvertexai-imagen-edit-image-inpainting-remove-mask-mode" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-imagen-edit-image-inpainting-remove-mask-mode" ><span class="devsite-nav-text" tooltip>Remove image content using automatic mask detection and inpainting with Imagen</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-imagen-edit-image-inpainting-remove-mask" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/samples/generativeaionvertexai-imagen-edit-image-inpainting-remove-mask" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-imagen-edit-image-inpainting-remove-mask" ><span class="devsite-nav-text" tooltip>Remove image content using mask-based inpainting with Imagen</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-rag-retrieval-query" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/samples/generativeaionvertexai-rag-retrieval-query" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-rag-retrieval-query" ><span class="devsite-nav-text" tooltip>Return the response from the LLM</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-system-instruction" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-system-instruction" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-system-instruction" ><span class="devsite-nav-text" tooltip>Set system instructions to Gemini 1.5 Pro</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-controlled-generation-response-schema" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-controlled-generation-response-schema" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-controlled-generation-response-schema" ><span class="devsite-nav-text" tooltip>Specify a MIME response type for the Gemini API</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-video-with-audio" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-video-with-audio" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-video-with-audio" ><span class="devsite-nav-text" tooltip>Summarize a video file with audio with Gemini 1.5 Pro</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-audio-summarization" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-audio-summarization" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-audio-summarization" ><span class="devsite-nav-text" tooltip>Summarize an audio file with Gemini 1.5 Pro</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-audio-transcription" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-audio-transcription" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-gemini-audio-transcription" ><span class="devsite-nav-text" tooltip>Transcript an audio file with Gemini 1.5 Pro</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-rag-upload-file" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/samples/generativeaionvertexai-rag-upload-file" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-rag-upload-file" ><span class="devsite-nav-text" tooltip>Upload a RAG file</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-rag-quickstart" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/samples/generativeaionvertexai-rag-quickstart" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-rag-quickstart" ><span class="devsite-nav-text" tooltip>Use the quickstart to get familiar with RAG</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-imagen-verify-image-watermark" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/samples/generativeaionvertexai-imagen-verify-image-watermark" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/samples/generativeaionvertexai-imagen-verify-image-watermark" ><span class="devsite-nav-text" tooltip>Verify an image&#39;s digital watermark</span></a></li></ul></div></li> <li class="devsite-nav-item"><a href="/docs/samples" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /docs/samples" track-type="bookNav" track-name="click" track-metadata-eventdetail="/docs/samples" ><span class="devsite-nav-text" tooltip>Code samples for all products</span></a></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Jump Start Solutions</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item devsite-nav-external"><a href="/architecture/ai-ml/generative-ai-document-summarization" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /architecture/ai-ml/generative-ai-document-summarization" track-type="bookNav" track-name="click" track-metadata-eventdetail="/architecture/ai-ml/generative-ai-document-summarization" ><span class="devsite-nav-text" tooltip>Generative AI Document Summarization</span><span class="devsite-nav-icon material-icons" data-icon="external" data-title="External" aria-hidden="true"></span></a></li><li class="devsite-nav-item devsite-nav-external"><a href="/architecture/ai-ml/generative-ai-rag" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /architecture/ai-ml/generative-ai-rag" track-type="bookNav" track-name="click" track-metadata-eventdetail="/architecture/ai-ml/generative-ai-rag" ><span class="devsite-nav-text" tooltip>Generative AI RAG with Cloud SQL</span><span class="devsite-nav-icon material-icons" data-icon="external" data-title="External" aria-hidden="true"></span></a></li><li class="devsite-nav-item devsite-nav-external"><a href="/architecture/ai-ml/generative-ai-knowledge-base" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /architecture/ai-ml/generative-ai-knowledge-base" track-type="bookNav" track-name="click" track-metadata-eventdetail="/architecture/ai-ml/generative-ai-knowledge-base" ><span class="devsite-nav-text" tooltip>Generative AI Knowledge Base</span><span class="devsite-nav-icon material-icons" data-icon="external" data-title="External" aria-hidden="true"></span></a></li></ul></div></li> <li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/tutorials" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/tutorials" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/tutorials" ><span class="devsite-nav-text" tooltip>GenAI notebook tutorials</span></a></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Secure a generative AI app by using IAP</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/streamlit/streamlit-genai-iap" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/streamlit/streamlit-genai-iap" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/streamlit/streamlit-genai-iap" ><span class="devsite-nav-text" tooltip>Overview</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/streamlit/setup-environment" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/streamlit/setup-environment" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/streamlit/setup-environment" ><span class="devsite-nav-text" tooltip>Set up your project and source repository</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/streamlit/create-cloudrun-service" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/streamlit/create-cloudrun-service" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/streamlit/create-cloudrun-service" ><span class="devsite-nav-text" tooltip>Create a Cloud Run service</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/streamlit/create-loadbalancer" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/streamlit/create-loadbalancer" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/streamlit/create-loadbalancer" ><span class="devsite-nav-text" tooltip>Create a load balancer</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/streamlit/configure-iap" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/streamlit/configure-iap" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/streamlit/configure-iap" ><span class="devsite-nav-text" tooltip>Configure IAP</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/streamlit/view-app" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/streamlit/view-app" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/streamlit/view-app" ><span class="devsite-nav-text" tooltip>Test your IAP-secured app</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/streamlit/clean-up" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/streamlit/clean-up" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/streamlit/clean-up" ><span class="devsite-nav-text" tooltip>Clean up your project</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-heading"><div class="devsite-nav-title devsite-nav-title-no-path"> <span class="devsite-nav-text" tooltip>Resources</span> </div></li> <li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/pricing" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/pricing" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/pricing" ><span class="devsite-nav-text" tooltip>Pricing</span></a></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Release notes</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/release-notes" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/release-notes" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/release-notes" ><span class="devsite-nav-text" tooltip>Current</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/release-notes-archive" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/release-notes-archive" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/release-notes-archive" ><span class="devsite-nav-text" tooltip>Archive</span></a></li></ul></div></li> <li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/learn/locations" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/learn/locations" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/learn/locations" ><span class="devsite-nav-text" tooltip>Locations</span></a></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Quotas and limits</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/quotas" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/quotas" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/quotas" ><span class="devsite-nav-text" tooltip>Rate limits</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/dsq" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/dsq" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/dsq" ><span class="devsite-nav-text" tooltip>Dynamic shared quota</span></a></li><li class="devsite-nav-item devsite-nav-preview"><a href="/vertex-ai/generative-ai/docs/provisioned-throughput" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/provisioned-throughput" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/provisioned-throughput" ><span class="devsite-nav-text" tooltip>Provisioned Throughput</span><span class="devsite-nav-icon material-icons" data-icon="preview" data-title="Preview" aria-hidden="true"></span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/error-code-429" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/error-code-429" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/error-code-429" ><span class="devsite-nav-text" tooltip>Error code 429</span></a></li></ul></div></li> <li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/compliance" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/compliance" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/compliance" ><span class="devsite-nav-text" tooltip>Certifications</span></a></li> <li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/data-governance" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/data-governance" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/data-governance" ><span class="devsite-nav-text" tooltip>Data governance</span></a></li> <li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/getting-help" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/getting-help" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/getting-help" ><span class="devsite-nav-text" tooltip>Getting help</span></a></li> <li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/sla" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/sla" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/sla" ><span class="devsite-nav-text" tooltip>Service Level Agreement</span></a></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Deprecations</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/deprecations" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/deprecations" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/deprecations" ><span class="devsite-nav-text" tooltip>Deprecations</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/deprecations/gemini-1.0-pro" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/deprecations/gemini-1.0-pro" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/deprecations/gemini-1.0-pro" ><span class="devsite-nav-text" tooltip>Gemini 1.0 Pro and Gemini 1.0 Pro Vision</span></a></li><li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/deprecations/palm" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/deprecations/palm" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/deprecations/palm" ><span class="devsite-nav-text" tooltip>Pathways Language Model (PaLM)</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-heading"><div class="devsite-nav-title devsite-nav-title-no-path"> <span class="devsite-nav-text" tooltip>Administer</span> </div></li> <li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/access-control" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/access-control" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/access-control" ><span class="devsite-nav-text" tooltip>Access control</span></a></li> <li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/security-controls" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/security-controls" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/security-controls" ><span class="devsite-nav-text" tooltip>Security controls</span></a></li> <li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/control-model-access" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/control-model-access" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/control-model-access" ><span class="devsite-nav-text" tooltip>Control access to Model Garden models</span></a></li> <li class="devsite-nav-item"><a href="/vertex-ai/generative-ai/docs/enable-audit-logs" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/enable-audit-logs" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/enable-audit-logs" ><span class="devsite-nav-text" tooltip>Enable Data Access audit logs</span></a></li> <li class="devsite-nav-item devsite-nav-heading"><div class="devsite-nav-title devsite-nav-title-no-path"> <span class="devsite-nav-text" tooltip>Legacy</span> </div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Legacy docs</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item devsite-nav-deprecated"><a href="/vertex-ai/generative-ai/docs/legacy/legacy-models" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/legacy/legacy-models" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/legacy/legacy-models" ><span class="devsite-nav-text" tooltip>About legacy models</span><span class="devsite-nav-icon material-icons" data-icon="deprecated" data-title="Deprecated" aria-hidden="true"></span></a></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>PaLM 2 API (text/chat)</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item devsite-nav-deprecated"><a href="/vertex-ai/generative-ai/docs/language-model-overview" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/language-model-overview" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/language-model-overview" ><span class="devsite-nav-text" tooltip>Overview</span><span class="devsite-nav-icon material-icons" data-icon="deprecated" data-title="Deprecated" aria-hidden="true"></span></a></li><li class="devsite-nav-item devsite-nav-deprecated"><a href="/vertex-ai/generative-ai/docs/text/test-text-prompts" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/text/test-text-prompts" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/text/test-text-prompts" ><span class="devsite-nav-text" tooltip>Send text prompt requests</span><span class="devsite-nav-icon material-icons" data-icon="deprecated" data-title="Deprecated" aria-hidden="true"></span></a></li><li class="devsite-nav-item devsite-nav-deprecated"><a href="/vertex-ai/generative-ai/docs/text/batch-prediction-genai" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/text/batch-prediction-genai" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/text/batch-prediction-genai" ><span class="devsite-nav-text" tooltip>Get batch responses for text</span><span class="devsite-nav-icon material-icons" data-icon="deprecated" data-title="Deprecated" aria-hidden="true"></span></a></li><li class="devsite-nav-item devsite-nav-deprecated"><a href="/vertex-ai/generative-ai/docs/grounding/ground-language-models" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/grounding/ground-language-models" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/grounding/ground-language-models" ><span class="devsite-nav-text" tooltip>Ground responses</span><span class="devsite-nav-icon material-icons" data-icon="deprecated" data-title="Deprecated" aria-hidden="true"></span></a></li><li class="devsite-nav-item devsite-nav-deprecated"><a href="/vertex-ai/generative-ai/docs/chat/test-chat-prompts" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/chat/test-chat-prompts" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/chat/test-chat-prompts" ><span class="devsite-nav-text" tooltip>Send chat prompt requests</span><span class="devsite-nav-icon material-icons" data-icon="deprecated" data-title="Deprecated" aria-hidden="true"></span></a></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Tune PaLM 2 models</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item devsite-nav-deprecated"><a href="/vertex-ai/generative-ai/docs/models/tune-text-models" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/models/tune-text-models" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/models/tune-text-models" ><span class="devsite-nav-text" tooltip>Tune and distill PaLM models</span><span class="devsite-nav-icon material-icons" data-icon="deprecated" data-title="Deprecated" aria-hidden="true"></span></a></li><li class="devsite-nav-item devsite-nav-deprecated"><a href="/vertex-ai/generative-ai/docs/models/tune-text-models-supervised" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/models/tune-text-models-supervised" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/models/tune-text-models-supervised" ><span class="devsite-nav-text" tooltip>Use supervised tuning</span><span class="devsite-nav-icon material-icons" data-icon="deprecated" data-title="Deprecated" aria-hidden="true"></span></a></li><li class="devsite-nav-item devsite-nav-deprecated"><a href="/vertex-ai/generative-ai/docs/models/tune-text-models-rlhf" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/models/tune-text-models-rlhf" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/models/tune-text-models-rlhf" ><span class="devsite-nav-text" tooltip>Use RLHF tuning</span><span class="devsite-nav-icon material-icons" data-icon="deprecated" data-title="Deprecated" aria-hidden="true"></span></a></li><li class="devsite-nav-item devsite-nav-deprecated"><a href="/vertex-ai/generative-ai/docs/models/distill-text-models" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/models/distill-text-models" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/models/distill-text-models" ><span class="devsite-nav-text" tooltip>Distill text models</span><span class="devsite-nav-icon material-icons" data-icon="deprecated" data-title="Deprecated" aria-hidden="true"></span></a></li></ul></div></li><li class="devsite-nav-item devsite-nav-deprecated"><a href="/vertex-ai/generative-ai/docs/compute-token" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/compute-token" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/compute-token" ><span class="devsite-nav-text" tooltip>Get a list of tokens</span><span class="devsite-nav-icon material-icons" data-icon="deprecated" data-title="Deprecated" aria-hidden="true"></span></a></li><li class="devsite-nav-item devsite-nav-deprecated"><a href="/vertex-ai/generative-ai/docs/get-token-count" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/get-token-count" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/get-token-count" ><span class="devsite-nav-text" tooltip>Get token count</span><span class="devsite-nav-icon material-icons" data-icon="deprecated" data-title="Deprecated" aria-hidden="true"></span></a></li><li class="devsite-nav-item devsite-nav-deprecated"><a href="/vertex-ai/generative-ai/docs/learn/streaming" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/learn/streaming" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/learn/streaming" ><span class="devsite-nav-text" tooltip>Stream responses</span><span class="devsite-nav-icon material-icons" data-icon="deprecated" data-title="Deprecated" aria-hidden="true"></span></a></li><li class="devsite-nav-item devsite-nav-deprecated"><a href="/vertex-ai/generative-ai/docs/configure-safety-attributes-palm" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/configure-safety-attributes-palm" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/configure-safety-attributes-palm" ><span class="devsite-nav-text" tooltip>Configure safety attributes</span><span class="devsite-nav-icon material-icons" data-icon="deprecated" data-title="Deprecated" aria-hidden="true"></span></a></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Codey API (code)</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item devsite-nav-deprecated"><a href="/vertex-ai/generative-ai/docs/code/code-models-overview" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/code/code-models-overview" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/code/code-models-overview" ><span class="devsite-nav-text" tooltip>Overview of code models</span><span class="devsite-nav-icon material-icons" data-icon="deprecated" data-title="Deprecated" aria-hidden="true"></span></a></li><li class="devsite-nav-item devsite-nav-deprecated"><a href="/vertex-ai/generative-ai/docs/code/test-code-chat-prompts" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/code/test-code-chat-prompts" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/code/test-code-chat-prompts" ><span class="devsite-nav-text" tooltip>Send code chat requests</span><span class="devsite-nav-icon material-icons" data-icon="deprecated" data-title="Deprecated" aria-hidden="true"></span></a></li><li class="devsite-nav-item devsite-nav-deprecated"><a href="/vertex-ai/generative-ai/docs/code/test-code-generation-prompts" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/code/test-code-generation-prompts" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/code/test-code-generation-prompts" ><span class="devsite-nav-text" tooltip>Send code generation requests</span><span class="devsite-nav-icon material-icons" data-icon="deprecated" data-title="Deprecated" aria-hidden="true"></span></a></li><li class="devsite-nav-item devsite-nav-deprecated"><a href="/vertex-ai/generative-ai/docs/models/tune-code-models" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/models/tune-code-models" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/models/tune-code-models" ><span class="devsite-nav-text" tooltip>Tune Codey models</span><span class="devsite-nav-icon material-icons" data-icon="deprecated" data-title="Deprecated" aria-hidden="true"></span></a></li><li class="devsite-nav-item devsite-nav-deprecated"><a href="/vertex-ai/generative-ai/docs/code/batch-prediction-genai-code" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/code/batch-prediction-genai-code" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/code/batch-prediction-genai-code" ><span class="devsite-nav-text" tooltip>Get batch code predictions</span><span class="devsite-nav-icon material-icons" data-icon="deprecated" data-title="Deprecated" aria-hidden="true"></span></a></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Reference</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item devsite-nav-deprecated"><a href="/vertex-ai/generative-ai/docs/model-reference/code-generation" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/model-reference/code-generation" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/model-reference/code-generation" ><span class="devsite-nav-text" tooltip>Codey for code generation</span><span class="devsite-nav-icon material-icons" data-icon="deprecated" data-title="Deprecated" aria-hidden="true"></span></a></li><li class="devsite-nav-item devsite-nav-deprecated"><a href="/vertex-ai/generative-ai/docs/model-reference/code-chat" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/model-reference/code-chat" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/model-reference/code-chat" ><span class="devsite-nav-text" tooltip>Codey for code chat</span><span class="devsite-nav-icon material-icons" data-icon="deprecated" data-title="Deprecated" aria-hidden="true"></span></a></li><li class="devsite-nav-item devsite-nav-deprecated"><a href="/vertex-ai/generative-ai/docs/model-reference/text" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/model-reference/text" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/model-reference/text" ><span class="devsite-nav-text" tooltip>PaLM 2 for text</span><span class="devsite-nav-icon material-icons" data-icon="deprecated" data-title="Deprecated" aria-hidden="true"></span></a></li><li class="devsite-nav-item devsite-nav-deprecated"><a href="/vertex-ai/generative-ai/docs/model-reference/text-chat" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/model-reference/text-chat" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/model-reference/text-chat" ><span class="devsite-nav-text" tooltip>PaLM 2 for chat</span><span class="devsite-nav-icon material-icons" data-icon="deprecated" data-title="Deprecated" aria-hidden="true"></span></a></li></ul></div></li><li class="devsite-nav-item devsite-nav-deprecated"><a href="/vertex-ai/generative-ai/docs/legacy/legacy-quotas" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/legacy/legacy-quotas" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/legacy/legacy-quotas" ><span class="devsite-nav-text" tooltip>Quotas and limits</span><span class="devsite-nav-icon material-icons" data-icon="deprecated" data-title="Deprecated" aria-hidden="true"></span></a></li><li class="devsite-nav-item devsite-nav-deprecated"><a href="/vertex-ai/generative-ai/docs/legacy/legacy-security" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/legacy/legacy-security" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/legacy/legacy-security" ><span class="devsite-nav-text" tooltip>Security controls</span><span class="devsite-nav-icon material-icons" data-icon="deprecated" data-title="Deprecated" aria-hidden="true"></span></a></li><li class="devsite-nav-item devsite-nav-deprecated"><a href="/vertex-ai/generative-ai/docs/legacy/legacy-pricing" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /vertex-ai/generative-ai/docs/legacy/legacy-pricing" track-type="bookNav" track-name="click" track-metadata-eventdetail="/vertex-ai/generative-ai/docs/legacy/legacy-pricing" ><span class="devsite-nav-text" tooltip>Pricing</span><span class="devsite-nav-icon material-icons" data-icon="deprecated" data-title="Deprecated" aria-hidden="true"></span></a></li></ul></div></li> </ul> <ul class="devsite-nav-list" menu="Technology areas" aria-label="Side menu" hidden> <li class="devsite-nav-item"> <a href="/docs/ai-ml" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: AI and ML" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > AI and ML </span> </a> </li> <li class="devsite-nav-item"> <a href="/docs/application-development" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Application development" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Application development </span> </a> </li> <li class="devsite-nav-item"> <a href="/docs/application-hosting" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Application hosting" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Application hosting </span> </a> </li> <li class="devsite-nav-item"> <a href="/docs/compute-area" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Compute" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Compute </span> </a> </li> <li class="devsite-nav-item"> <a href="/docs/data" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Data analytics and pipelines" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Data analytics and pipelines </span> </a> </li> <li class="devsite-nav-item"> <a href="/docs/databases" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Databases" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Databases </span> </a> </li> <li class="devsite-nav-item"> <a href="/docs/dhm-cloud" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Distributed, hybrid, and multicloud" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Distributed, hybrid, and multicloud </span> </a> </li> <li class="devsite-nav-item"> <a href="/docs/generative-ai" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Generative AI" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Generative AI </span> </a> </li> <li class="devsite-nav-item"> <a href="/docs/industry" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Industry solutions" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Industry solutions </span> </a> </li> <li class="devsite-nav-item"> <a href="/docs/networking" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Networking" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Networking </span> </a> </li> <li class="devsite-nav-item"> <a href="/docs/observability" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Observability and monitoring" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Observability and monitoring </span> </a> </li> <li class="devsite-nav-item"> <a href="/docs/security" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Security" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Security </span> </a> </li> <li class="devsite-nav-item"> <a href="/docs/storage" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Storage" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Storage </span> </a> </li> </ul> <ul class="devsite-nav-list" menu="Cross-product tools" aria-label="Side menu" hidden> <li class="devsite-nav-item"> <a href="/docs/access-resources" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Access and resources management" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Access and resources management </span> </a> </li> <li class="devsite-nav-item"> <a href="/docs/costs-usage" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Costs and usage management" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Costs and usage management </span> </a> </li> <li class="devsite-nav-item"> <a href="/docs/devtools" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Google Cloud SDK, languages, frameworks, and tools" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Google Cloud SDK, languages, frameworks, and tools </span> </a> </li> <li class="devsite-nav-item"> <a href="/docs/iac" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Infrastructure as code" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Infrastructure as code </span> </a> </li> <li class="devsite-nav-item"> <a href="/docs/migration" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Migration" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Migration </span> </a> </li> </ul> <ul class="devsite-nav-list" menu="Related sites" aria-label="Side menu" hidden> <li class="devsite-nav-item"> <a href="/" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Google Cloud Home" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Google Cloud Home </span> </a> </li> <li class="devsite-nav-item"> <a href="/free" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Free Trial and Free Tier" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Free Trial and Free Tier </span> </a> </li> <li class="devsite-nav-item"> <a href="/architecture" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Architecture Center" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Architecture Center </span> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/blog" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Blog" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Blog </span> </a> </li> <li class="devsite-nav-item"> <a href="/contact" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Contact Sales" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Contact Sales </span> </a> </li> <li class="devsite-nav-item"> <a href="/developers" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Google Cloud Developer Center" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Google Cloud Developer Center </span> </a> </li> <li class="devsite-nav-item"> <a href="https://developers.google.com/" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Google Developer Center" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Google Developer Center </span> </a> </li> <li class="devsite-nav-item"> <a href="https://console.cloud.google.com/marketplace" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Google Cloud Marketplace" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Google Cloud Marketplace </span> </a> </li> <li class="devsite-nav-item"> <a href="/marketplace/docs" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Google Cloud Marketplace Documentation" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Google Cloud Marketplace Documentation </span> </a> </li> <li class="devsite-nav-item"> <a href="https://www.cloudskillsboost.google/paths" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Google Cloud Skills Boost" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Google Cloud Skills Boost </span> </a> </li> <li class="devsite-nav-item"> <a href="/solutions" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Google Cloud Solution Center" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Google Cloud Solution Center </span> </a> </li> <li class="devsite-nav-item"> <a href="/support-hub" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Google Cloud Support" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Google Cloud Support </span> </a> </li> <li class="devsite-nav-item"> <a href="https://www.youtube.com/@googlecloudtech" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Google Cloud Tech Youtube Channel" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Google Cloud Tech Youtube Channel </span> </a> </li> </ul> </div> </div> </nav> </devsite-book-nav> <section id="gc-wrapper"> <main role="main" class="devsite-main-content" has-book-nav has-sidebar > <div class="devsite-sidebar"> <div class="devsite-sidebar-content"> <devsite-toc class="devsite-nav" role="navigation" aria-label="On this page" depth="2" scrollbars ></devsite-toc> <devsite-recommendations-sidebar class="nocontent devsite-nav"> </devsite-recommendations-sidebar> </div> </div> <devsite-content> <article class="devsite-article"> <div class="devsite-article-meta nocontent" role="navigation"> <ul class="devsite-breadcrumb-list" aria-label="Breadcrumb"> <li class="devsite-breadcrumb-item "> <a href="https://cloud.google.com/" class="devsite-breadcrumb-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Breadcrumbs" data-value="1" track-type="globalNav" track-name="breadcrumb" track-metadata-position="1" track-metadata-eventdetail="Google Cloud" > Home </a> </li> <li class="devsite-breadcrumb-item "> <div class="devsite-breadcrumb-guillemet material-icons" aria-hidden="true"></div> <a href="https://cloud.google.com/vertex-ai/generative-ai/docs/overview" class="devsite-breadcrumb-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Breadcrumbs" data-value="2" track-type="globalNav" track-name="breadcrumb" track-metadata-position="2" track-metadata-eventdetail="Generative AI on Vertex AI" > Generative AI on Vertex AI </a> </li> <li class="devsite-breadcrumb-item "> <div class="devsite-breadcrumb-guillemet material-icons" aria-hidden="true"></div> <a href="https://cloud.google.com/vertex-ai/generative-ai/docs/learn/overview" class="devsite-breadcrumb-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Breadcrumbs" data-value="3" track-type="globalNav" track-name="breadcrumb" track-metadata-position="3" track-metadata-eventdetail="Generative AI on Vertex AI" > Documentation </a> </li> </ul> <devsite-thumb-rating position="header"> </devsite-thumb-rating> </div> <devsite-feedback position="header" project-name="Generative AI on Vertex AI" product-id="5164350" bucket="Documentation" context="" version="t-devsite-webserver-20241114-r00-rc02.464922260396498922" data-label="Send Feedback Button" track-type="feedback" track-name="sendFeedbackLink" track-metadata-position="header" class="nocontent" project-feedback-url="https://issuetracker.google.com/issues/new?component=1130925" project-icon="https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/cloud/images/favicons/onecloud/super_cloud.png" project-support-url="https://cloud.google.com/support-hub" > <button> Send feedback </button> </devsite-feedback> <h1 class="devsite-page-title" tabindex="-1"> Introduction to function calling </h1> <devsite-feature-tooltip ack-key="AckCollectionsBookmarkTooltipDismiss" analytics-category="Site-Wide Custom Events" analytics-action-show="Callout Profile displayed" analytics-action-close="Callout Profile dismissed" analytics-label="Create Collection Callout" class="devsite-page-bookmark-tooltip nocontent" dismiss-button="true" id="devsite-collections-dropdown" dismiss-button-text="Dismiss" close-button-text="Got it"> <devsite-bookmark></devsite-bookmark> <span slot="popout-heading"> Stay organized with collections </span> <span slot="popout-contents"> Save and categorize content based on your preferences. </span> </devsite-feature-tooltip> <div class="devsite-page-title-meta"><devsite-view-release-notes></devsite-view-release-notes></div> <devsite-toc class="devsite-nav" depth="2" devsite-toc-embedded > </devsite-toc> <div class="devsite-article-body clearfix "> <div class="video-wrapper"> <iframe class="devsite-embedded-youtube-video" data-video-id="gyOTxdULtIw" data-autohide="1" data-showinfo="0" allowfullscreen> </iframe> </div> <p>Large Language Models (LLMs) are powerful at solving many types of problems. However, they are constrained by the following limitations:</p> <ul> <li>They are frozen after training, leading to stale knowledge.</li> <li>They can&#39;t query or modify external data.</li> </ul> <p>Function calling can address these shortcomings. Function calling is sometimes referred to as <em>tool use</em> because it allows the model to use external tools such as APIs and functions.</p> <p>When submitting a prompt to the LLM, you also provide the model with a set of tools that it can use to respond to the user&#39;s prompt. For example, you could provide a function <code translate="no" dir="ltr">get_weather</code> that takes a location parameter and returns information about the weather conditions at that location.</p> <p>While processing a prompt, the model can choose to delegate certain data processing tasks to the functions that you identify. The model does not call the functions directly. Instead, the model provides structured data output that includes the function to call and parameter values to use. For example, for a prompt <code translate="no" dir="ltr">What is the weather like in Boston?</code>, the model can delegate processing to the <code translate="no" dir="ltr">get_weather</code> function and provide the location parameter value <code translate="no" dir="ltr">Boston, MA</code>.</p> <p>You can use the structured output from the model to invoke external APIs. For example, you could connect to a weather service API, provide the location <code translate="no" dir="ltr">Boston, MA</code>, and receive information about temperature, cloud cover, and wind conditions.</p> <p>You can then provide the API output back to the model, allowing it to complete its response to the prompt. For the weather example, the model may provide the following response: <code translate="no" dir="ltr">It is currently 38 degrees Fahrenheit in Boston, MA with partly cloudy skies.</code></p> <p><img src="/static/vertex-ai/generative-ai/docs/multimodal/images/function-calling.png" alt="Function Calling Interaction" style="float: center; height: 428px; margin: 0px 18px 4px">&nbsp;<br></p> <h2 id="supported_models" data-text="Supported models" tabindex="-1">Supported models</h2> <p>The following models provide support for function calling:</p> <table> <thead> <tr> <th>Model</th> <th>Version</th> <th>Function calling launch stage</th> <th>Support for <a href="#how_to_submit_the_prompt_and_the_function_declarations">parallel function calling</a></th> <th>Support for <a href="#tool-config">forced function calling</a></th> </tr> </thead> <tbody> <tr> <td>Gemini&nbsp;1.0&nbsp;Pro</td> <td><code translate="no" dir="ltr">all versions</code></td> <td><a href="/products#product-launch-stages">General Availability</a></td> <td>No</td> <td>No</td> </tr> <tr> <td>Gemini&nbsp;1.5&nbsp;Flash</td> <td><code translate="no" dir="ltr">all versions</code></td> <td><a href="/products#product-launch-stages">General Availability</a></td> <td>Yes</td> <td>Yes</td> </tr> <tr> <td>Gemini&nbsp;1.5&nbsp;Pro</td> <td><code translate="no" dir="ltr">all versions</code></td> <td><a href="/products#product-launch-stages">General Availability</a></td> <td>Yes</td> <td>Yes</td> </tr> </tbody> </table> <h2 id="use-cases" data-text="Use cases of function calling" tabindex="-1">Use cases of function calling</h2> <p>You can use function calling for the following tasks:</p> <table> <thead> <tr> <th>Use Case</th> <th>Example description</th> <th>Example link</th> </tr> </thead> <tbody> <tr> <td rowspan="3">Integrate with external APIs</td> <td>Get weather information using a meteorological API</td> <td><a href="https://github.com/GoogleCloudPlatform/generative-ai/blob/main/gemini/function-calling/intro_function_calling.ipynb">Notebook tutorial</a></td> </tr> <tr> <td>Convert addresses to latitude/longitude coordinates</td> <td><a href="https://github.com/GoogleCloudPlatform/generative-ai/blob/main/gemini/function-calling/intro_function_calling.ipynb">Notebook tutorial</a></td> </tr> <tr> <td>Convert currencies using a currency exchange API</td> <td><a href="https://codelabs.developers.google.com/codelabs/gemini-function-calling">Codelab</a></td> </tr> <tr> <td rowspan="2">Build advanced chatbots</td> <td>Answer customer questions about products and services</td> <td><a href="https://github.com/GoogleCloudPlatform/generative-ai/blob/main/gemini/function-calling/intro_function_calling.ipynb">Notebook tutorial</a></td> </tr> <tr> <td>Create an assistant to answer financial and news questions about companies</td> <td><a href="https://github.com/GoogleCloudPlatform/generative-ai/blob/main/gemini/function-calling/use_case_company_news_and_insights.ipynb">Notebook tutorial</a></td> </tr> <tr> <td rowspan="3">Structure and control function calls</td> <td>Extract structured entities from raw log data</td> <td><a href="https://github.com/GoogleCloudPlatform/generative-ai/blob/main/gemini/function-calling/intro_function_calling.ipynb">Notebook tutorial</a></td> </tr> <tr> <td>Extract single or multiple parameters from user input</td> <td><a href="https://github.com/GoogleCloudPlatform/generative-ai/blob/main/gemini/function-calling/function_calling_data_structures.ipynb">Notebook tutorial</a></td> </tr> <tr> <td>Handle lists and nested data structures in function calls</td> <td><a href="https://github.com/GoogleCloudPlatform/generative-ai/blob/main/gemini/function-calling/function_calling_data_structures.ipynb">Notebook tutorial</a></td> </tr> <tr> <td rowspan="2">Handle function calling behavior</td> <td>Handle parallel function calls and responses</td> <td><a href="https://github.com/GoogleCloudPlatform/generative-ai/blob/main/gemini/function-calling/parallel_function_calling.ipynb">Notebook tutorial</a></td> </tr> <tr> <td>Manage when and which functions the model can call</td> <td><a href="https://github.com/GoogleCloudPlatform/generative-ai/blob/main/gemini/function-calling/forced_function_calling.ipynb">Notebook tutorial</a></td> </tr> <tr> <td>Query databases with natural language</td> <td>Convert natural language questions into SQL queries for BigQuery</td> <td><a href="https://github.com/GoogleCloudPlatform/generative-ai/tree/main/gemini/function-calling/sql-talk-app">Sample app</a></td> </tr> <tr> <td>Multimodal function calling</td> <td>Use images, videos, audio, and PDFs as input to trigger function calls</td> <td><a href="https://github.com/GoogleCloudPlatform/generative-ai/blob/main/gemini/function-calling/multimodal_function_calling.ipynb">Notebook tutorial</a></td> </tr> </tbody> </table> <p>Here are some more use cases:</p> <ul> <li><p><strong>Interpret voice commands</strong>: Create functions that correspond with in-vehicle tasks. For example, you can create functions that turn on the radio or activate the air conditioning. Send audio files of the user&#39;s voice commands to the model, and ask the model to convert the audio into text and identify the function that the user wants to call.</p></li> <li><p><strong>Automate workflows based on environmental triggers</strong>: Create functions to represent processes that can be automated. Provide the model with data from environmental sensors and ask it to parse and process the data to determine whether one or more of the workflows should be activated. For example, a model could process temperature data in a warehouse and choose to activate a sprinkler function.</p></li> <li><p><strong>Automate the assignment of support tickets</strong>: Provide the model with support tickets, logs, and context-aware rules. Ask the model to process all of this information to determine who the ticket should be assigned to. Call a function to assign the ticket to the person suggested by the model.</p></li> <li><p><strong>Retrieve information from a knowledge base</strong>: Create functions that retrieve academic articles on a given subject and summarize them. Enable the model to answer questions about academic subjects and provide citations for its answers.</p></li> </ul> <h2 id="how-works" data-text="How to create a function calling application" tabindex="-1">How to create a function calling application</h2> <p>To enable a user to interface with the model and use function calling, you must create code that performs the following tasks:</p> <ol> <li><a href="#initialize-model">Set up your environment</a>.</li> <li><a href="#function-declarations">Define and describe a set of available functions</a> using <em>function declarations</em>.</li> <li><a href="#submit-prompt">Submit a user&#39;s prompt and the function declarations to the model</a>.</li> <li><a href="#invoke-api">Invoke a function</a> using the structured data output from the model.</li> <li><a href="#submit-api-output">Provide the function output to the model</a>.</li> </ol> <p>You can create an application that manages all of these tasks. This application can be a text chatbot, a voice agent, an automated workflow, or any other program.</p> <p>You can use function calling to generate a single text response or to support a chat session. Ad hoc text responses are useful for specific business tasks, including code generation. Chat sessions are useful in freeform, conversational scenarios, where a user is likely to ask follow-up questions.</p> <p>If you use function calling to generate a single response, you must provide the model with the full context of the interaction. On the other hand, if you use function calling in the context of a chat session, the session stores the context for you and includes it in every model request. In both cases, Vertex AI stores the history of the interaction on the client side.</p> <p>This guide demonstrates how you can use function calling to generate a single text response. For an end-to-end sample, see <a href="#text-samples">Text examples</a>. To learn how to use function calling to support a chat session, see <a href="#chat-samples">Chat examples</a>.</p> <h3 id="initialize-model" data-text="Step 1: Set up your environment" tabindex="-1">Step 1: Set up your environment</h3> <p>Import the required modules and initialize the model:</p> <div class="ds-selector-tabs" data-ds-scope="code-sample"> <section><h3 id="python" data-text=" Python " tabindex="-1"> Python </h3><div></div><devsite-code><pre class="devsite-click-to-copy" translate="no" dir="ltr" is-upgraded syntax="Python"><code translate="no" dir="ltr"><span class="devsite-syntax-kn">import</span> <span class="devsite-syntax-nn">vertexai</span> <span class="devsite-syntax-kn">from</span> <span class="devsite-syntax-nn">vertexai.generative_models</span> <span class="devsite-syntax-kn">import</span> <span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">Content</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">FunctionDeclaration</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">GenerationConfig</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">GenerativeModel</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">Part</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">Tool</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-c1"># Initialize Vertex AI</span> <span class="devsite-syntax-c1"># TODO(developer): Update and un-comment below lines</span> <span class="devsite-syntax-c1"># PROJECT_ID = 'your-project-id'</span> <span class="devsite-syntax-n">vertexai</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">init</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">project</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">PROJECT_ID</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">location</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-s2">"us-central1"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-c1"># Initialize Gemini model</span> <span class="devsite-syntax-n">model</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">GenerativeModel</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">model_name</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-s2">"gemini-1.5-flash-002"</span><span class="devsite-syntax-p">)</span> </code></pre></devsite-code></section> </div> <h3 id="function-declarations" data-text="Step 2: Declare a set of functions" tabindex="-1">Step 2: Declare a set of functions</h3> <p>The application must declare a set of functions that the model can use to process the prompt.</p> <p>The maximum number of function declarations that can be provided with the request is 128.</p> <p>You must provide function declarations in a schema format that&#39;s compatible with the <a href="https://spec.openapis.org/oas/v3.0.3#schema">OpenAPI schema</a>. Vertex AI offers limited support of the OpenAPI schema. The following attributes are supported: <code translate="no" dir="ltr">type</code>, <code translate="no" dir="ltr">nullable</code>, <code translate="no" dir="ltr">required</code>, <code translate="no" dir="ltr">format</code>, <code translate="no" dir="ltr">description</code>, <code translate="no" dir="ltr">properties</code>, <code translate="no" dir="ltr">items</code>, <code translate="no" dir="ltr">enum</code>. The following attributes are not supported: <code translate="no" dir="ltr">default</code>, <code translate="no" dir="ltr">optional</code>, <code translate="no" dir="ltr">maximum</code>, <code translate="no" dir="ltr">oneOf</code>. For best practices related to the function declarations, including tips for names and descriptions, see <a href="#best-practices">Best practices</a>.</p> <p>If you use the REST API, specify the schema using JSON. If you use the Vertex AI SDK for Python, you can specify the schema either manually using a Python dictionary or automatically with the <code translate="no" dir="ltr">from_func</code> helper function.</p> <div class="ds-selector-tabs" data-ds-scope="code-sample"> <section><h3 id="json" data-text=" JSON " tabindex="-1"> JSON </h3><div></div><devsite-code><pre class="devsite-click-to-copy" translate="no" dir="ltr" is-upgraded syntax="JSON"><code translate="no" dir="ltr"><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nt">"contents"</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-err">...</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nt">"tools"</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nt">"function_declarations"</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nt">"name"</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s2">"find_movies"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nt">"description"</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s2">"find movie titles currently playing in theaters based on any description, genre, title words, etc."</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nt">"parameters"</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nt">"type"</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s2">"object"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nt">"properties"</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nt">"location"</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nt">"type"</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s2">"string"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nt">"description"</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s2">"The city and state, e.g. San Francisco, CA or a zip code e.g. 95616"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nt">"description"</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nt">"type"</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s2">"string"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nt">"description"</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s2">"Any kind of description including category or genre, title words, attributes, etc."</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nt">"required"</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-s2">"description"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">]</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nt">"name"</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s2">"find_theaters"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nt">"description"</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s2">"find theaters based on location and optionally movie title which are is currently playing in theaters"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nt">"parameters"</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nt">"type"</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s2">"object"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nt">"properties"</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nt">"location"</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nt">"type"</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s2">"string"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nt">"description"</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s2">"The city and state, e.g. San Francisco, CA or a zip code e.g. 95616"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nt">"movie"</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nt">"type"</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s2">"string"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nt">"description"</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s2">"Any movie title"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nt">"required"</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-s2">"location"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">]</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nt">"name"</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s2">"get_showtimes"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nt">"description"</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s2">"Find the start times for movies playing in a specific theater"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nt">"parameters"</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nt">"type"</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s2">"object"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nt">"properties"</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nt">"location"</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nt">"type"</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s2">"string"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nt">"description"</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s2">"The city and state, e.g. San Francisco, CA or a zip code e.g. 95616"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nt">"movie"</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nt">"type"</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s2">"string"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nt">"description"</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s2">"Any movie title"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nt">"theater"</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nt">"type"</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s2">"string"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nt">"description"</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s2">"Name of the theater"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nt">"date"</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nt">"type"</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s2">"string"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nt">"description"</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s2">"Date for requested showtime"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nt">"required"</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-s2">"location"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-s2">"movie"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-s2">"theater"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-s2">"date"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">]</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">]</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">]</span> <span class="devsite-syntax-p">}</span> </code></pre></devsite-code></section> <section><h3 id="python-dictionary" data-text=" Python dictionary " tabindex="-1"> Python dictionary </h3><p>The following function declaration takes a single <code translate="no" dir="ltr">string</code> parameter:</p> <div></div><devsite-code><pre class="devsite-click-to-copy" translate="no" dir="ltr" is-upgraded syntax="Python"><code translate="no" dir="ltr"><span class="devsite-syntax-n">function_name</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-s2">"get_current_weather"</span> <span class="devsite-syntax-n">get_current_weather_func</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">FunctionDeclaration</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">name</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">function_name</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">description</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-s2">"Get the current weather in a given location"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-c1"># Function parameters are specified in JSON schema format</span> <span class="devsite-syntax-n">parameters</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-s2">"type"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-s2">"object"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-s2">"properties"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-p">{</span> <span class="devsite-syntax-s2">"location"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-p">{</span><span class="devsite-syntax-s2">"type"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-s2">"string"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-s2">"description"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-s2">"The city name of the location for which to get the weather."</span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-p">},</span> <span class="devsite-syntax-p">},</span> <span class="devsite-syntax-p">)</span> </code></pre></devsite-code> <p>The following function declaration takes both object and array parameters:</p> <div></div><devsite-code><pre class="devsite-click-to-copy" translate="no" dir="ltr" is-upgraded syntax="Python"><code translate="no" dir="ltr"><span class="devsite-syntax-n">extract_sale_records_func</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">FunctionDeclaration</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">name</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-s2">"extract_sale_records"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">description</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-s2">"Extract sale records from a document."</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">parameters</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-s2">"type"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-s2">"object"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-s2">"properties"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-p">{</span> <span class="devsite-syntax-s2">"records"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-p">{</span> <span class="devsite-syntax-s2">"type"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-s2">"array"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-s2">"description"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-s2">"A list of sale records"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-s2">"items"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-p">{</span> <span class="devsite-syntax-s2">"description"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-s2">"Data for a sale record"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-s2">"type"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-s2">"object"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-s2">"properties"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-p">{</span> <span class="devsite-syntax-s2">"id"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-p">{</span><span class="devsite-syntax-s2">"type"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-s2">"integer"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-s2">"description"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-s2">"The unique id of the sale."</span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-s2">"date"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-p">{</span><span class="devsite-syntax-s2">"type"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-s2">"string"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-s2">"description"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-s2">"Date of the sale, in the format of MMDDYY, e.g., 031023"</span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-s2">"total_amount"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-p">{</span><span class="devsite-syntax-s2">"type"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-s2">"number"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-s2">"description"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-s2">"The total amount of the sale."</span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-s2">"customer_name"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-p">{</span><span class="devsite-syntax-s2">"type"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-s2">"string"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-s2">"description"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-s2">"The name of the customer, including first name and last name."</span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-s2">"customer_contact"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-p">{</span><span class="devsite-syntax-s2">"type"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-s2">"string"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-s2">"description"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-s2">"The phone number of the customer, e.g., 650-123-4567."</span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-p">},</span> <span class="devsite-syntax-s2">"required"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-p">[</span><span class="devsite-syntax-s2">"id"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-s2">"date"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-s2">"total_amount"</span><span class="devsite-syntax-p">],</span> <span class="devsite-syntax-p">},</span> <span class="devsite-syntax-p">},</span> <span class="devsite-syntax-p">},</span> <span class="devsite-syntax-s2">"required"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-p">[</span><span class="devsite-syntax-s2">"records"</span><span class="devsite-syntax-p">],</span> <span class="devsite-syntax-p">},</span> <span class="devsite-syntax-p">)</span> </code></pre></devsite-code></section> <section><h3 id="python-from-function" data-text=" Python from function " tabindex="-1"> Python from function </h3><p>The following code sample declares a function that multiplies an array of numbers and uses <code translate="no" dir="ltr">from_func</code> to generate the <code translate="no" dir="ltr">FunctionDeclaration</code> schema.</p> <div></div><devsite-code><pre class="devsite-click-to-copy" translate="no" dir="ltr" is-upgraded syntax="Python"><code translate="no" dir="ltr"><span class="devsite-syntax-c1"># Define a function. Could be a local function or you can import the requests library to call an API</span> <span class="devsite-syntax-k">def</span> <span class="devsite-syntax-nf">multiply_numbers</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">numbers</span><span class="devsite-syntax-p">):</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-sd">"""</span> <span class="devsite-syntax-sd"> Calculates the product of all numbers in an array.</span> <span class="devsite-syntax-sd"> Args:</span> <span class="devsite-syntax-sd"> numbers: An array of numbers to be multiplied.</span> <span class="devsite-syntax-sd"> Returns:</span> <span class="devsite-syntax-sd"> The product of all the numbers. If the array is empty, returns 1.</span> <span class="devsite-syntax-sd"> """</span> <span class="devsite-syntax-k">if</span> <span class="devsite-syntax-ow">not</span> <span class="devsite-syntax-n">numbers</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-c1"># Handle empty array</span> <span class="devsite-syntax-k">return</span> <span class="devsite-syntax-mi">1</span> <span class="devsite-syntax-n">product</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-mi">1</span> <span class="devsite-syntax-k">for</span> <span class="devsite-syntax-n">num</span> <span class="devsite-syntax-ow">in</span> <span class="devsite-syntax-n">numbers</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-n">product</span> <span class="devsite-syntax-o">*=</span> <span class="devsite-syntax-n">num</span> <span class="devsite-syntax-k">return</span> <span class="devsite-syntax-n">product</span> <span class="devsite-syntax-n">multiply_number_func</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">FunctionDeclaration</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">from_func</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">multiply_numbers</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-sd">'''</span> <span class="devsite-syntax-sd">multiply_number_func contains the following schema:</span> <span class="devsite-syntax-sd">name: "multiply_numbers"</span> <span class="devsite-syntax-sd">description: "Calculates the product of all numbers in an array."</span> <span class="devsite-syntax-sd">parameters {</span> <span class="devsite-syntax-sd"> type_: OBJECT</span> <span class="devsite-syntax-sd"> properties {</span> <span class="devsite-syntax-sd"> key: "numbers"</span> <span class="devsite-syntax-sd"> value {</span> <span class="devsite-syntax-sd"> description: "An array of numbers to be multiplied."</span> <span class="devsite-syntax-sd"> title: "Numbers"</span> <span class="devsite-syntax-sd"> }</span> <span class="devsite-syntax-sd"> }</span> <span class="devsite-syntax-sd"> required: "numbers"</span> <span class="devsite-syntax-sd"> description: "Calculates the product of all numbers in an array."</span> <span class="devsite-syntax-sd"> title: "multiply_numbers"</span> <span class="devsite-syntax-sd">}</span> <span class="devsite-syntax-sd">'''</span> </code></pre></devsite-code></section> </div> <h3 id="submit-prompt" data-text="Step 3: Submit the prompt and function declarations to the model" tabindex="-1">Step 3: Submit the prompt and function declarations to the model</h3> <p>When the user provides a prompt, the application must provide the model with the user prompt and the <em>function declarations</em>. To configure how the model generates results, the application can provide the model with a <em>generation configuration</em>. To configure how the model uses the function declarations, the application can provide the model with a <em>tool configuration</em>.</p> <aside class="note"><strong>Note:</strong><span> Support for multimodal input is in <a href="/products#product-launch-stages">preview</a>.</span></aside> <h4 id="define-prompt" data-text="Define the user prompt" tabindex="-1">Define the user prompt</h4> <p>The following is an example of a user prompt: &quot;What is the weather like in Boston?&quot;</p> <p>The following is an example of how you can define the user prompt:</p> <div class="ds-selector-tabs" data-ds-scope="code-sample"> <section><h3 id="python_1" data-text=" Python " tabindex="-1"> Python </h3><div></div><devsite-code><pre class="devsite-click-to-copy" translate="no" dir="ltr" is-upgraded syntax="Python"><code translate="no" dir="ltr"><span class="devsite-syntax-c1"># Define the user's prompt in a Content object that we can reuse in model calls</span> <span class="devsite-syntax-n">user_prompt_content</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">Content</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">role</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-s2">"user"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">parts</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-p">[</span> <span class="devsite-syntax-n">Part</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">from_text</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s2">"What is the weather like in Boston?"</span><span class="devsite-syntax-p">),</span> <span class="devsite-syntax-p">],</span> <span class="devsite-syntax-p">)</span> </code></pre></devsite-code></section> </div> <p>For best practices related to the user prompt, see <a href="#prompt-bp">Best practices - User prompt</a>.</p> <h4 id="generation-config" data-text="Generation configuration" tabindex="-1">Generation configuration</h4> <p>The model can generate different results for different parameter values. The temperature parameter controls the degree of randomness in this generation. Lower temperatures are good for functions that require deterministic parameter values, while higher temperatures are good for functions with parameters that accept more diverse or creative parameter values. A temperature of <code translate="no" dir="ltr">0</code> is deterministic. In this case, responses for a given prompt are mostly deterministic, but a small amount of variation is still possible. To learn more, see <a href="/vertex-ai/generative-ai/docs/model-reference/gemini">Gemini API</a>.</p> <p>To set this parameter, submit a generation configuration (<code translate="no" dir="ltr">generation_config</code>) along with the prompt and the function declarations. You can update the <code translate="no" dir="ltr">temperature</code> parameter during a chat conversation using the Vertex AI API and an updated <code translate="no" dir="ltr">generation_config</code>. For an example of setting the <code translate="no" dir="ltr">temperature</code> parameter, see <a href="#how_to_submit_the_prompt_and_the_function_declarations">How to submit the prompt and the function declarations</a>.</p> <p>For best practices related to the generation configuration, see <a href="#generation-config-bp">Best practices - Generation configuration</a>.</p> <h4 id="tool-config" data-text="Tool configuration" tabindex="-1">Tool configuration</h4> <p>You can place some constraints on how the model should use the function declarations that you provide it with. For example, instead of allowing the model to choose between a natural language response and a function call, you can force it to only predict function calls (&quot;forced function calling&quot; or &quot;function calling with controlled generation&quot;). You can also choose to provide the model with a full set of function declarations, but restrict its responses to a subset of these functions.</p> <p>To place these constraints, submit a tool configuration (<code translate="no" dir="ltr">tool_config</code>) along with the prompt and the function declarations. In the configuration, you can specify one of the following modes:</p> <table> <thead> <tr> <th>Mode</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><code translate="no" dir="ltr">AUTO</code></td> <td>The default model behavior. The model decides whether to predict function calls or a natural language response.</td> </tr> <tr> <td><code translate="no" dir="ltr">ANY</code></td> <td>The model is constrained to always predict a function call. If <code translate="no" dir="ltr">allowed_function_names</code> is not provided, the model picks from all of the available function declarations. If <code translate="no" dir="ltr">allowed_function_names</code> is provided, the model picks from the set of allowed functions.</td> </tr> <tr> <td><code translate="no" dir="ltr">NONE</code></td> <td>The model must not predict function calls. This behaviour is equivalent to a model request without any associated function declarations.</td> </tr> </tbody> </table> <p>For a list of models that support the <code translate="no" dir="ltr">ANY</code> mode (&quot;forced function calling&quot;), see <a href="#supported_models">supported models</a>.</p> <p>To learn more, see <a href="/vertex-ai/generative-ai/docs/model-reference/function-calling">Function Calling API</a>.</p> <h4 id="how_to_submit_the_prompt_and_the_function_declarations" data-text="How to submit the prompt and the function declarations" tabindex="-1">How to submit the prompt and the function declarations</h4> <p>The following is an example of how can you submit the prompt and the function declarations to the model, and constrain the model to predict only <code translate="no" dir="ltr">get_current_weather</code> function calls.</p> <div class="ds-selector-tabs" data-ds-scope="code-sample"> <section><h3 id="python_2" data-text=" Python " tabindex="-1"> Python </h3><div></div><devsite-code><pre class="devsite-click-to-copy" translate="no" dir="ltr" is-upgraded syntax="Python"><code translate="no" dir="ltr"><span class="devsite-syntax-c1"># Define a tool that includes some of the functions that we declared earlier</span> <span class="devsite-syntax-n">tool</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">Tool</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">function_declarations</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-n">get_current_weather_func</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">extract_sale_records_func</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">multiply_number_func</span><span class="devsite-syntax-p">],</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-c1"># Send the prompt and instruct the model to generate content using the Tool object that you just created</span> <span class="devsite-syntax-n">response</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">model</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">generate_content</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">user_prompt_content</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">generation_config</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">GenerationConfig</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">temperature</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-mi">0</span><span class="devsite-syntax-p">),</span> <span class="devsite-syntax-n">tools</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-n">tool</span><span class="devsite-syntax-p">],</span> <span class="devsite-syntax-n">tool_config</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">ToolConfig</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">function_calling_config</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">ToolConfig</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">FunctionCallingConfig</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-c1"># ANY mode forces the model to predict only function calls</span> <span class="devsite-syntax-n">mode</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">ToolConfig</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">FunctionCallingConfig</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">Mode</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">ANY</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-c1"># Allowed function calls to predict when the mode is ANY. If empty, any of</span> <span class="devsite-syntax-c1"># the provided function calls will be predicted.</span> <span class="devsite-syntax-n">allowed_function_names</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-s2">"get_current_weather"</span><span class="devsite-syntax-p">],</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-p">)</span> </code></pre></devsite-code></section> </div> <p>If the model determines that it needs the output of a particular function, the response that the application receives from the model contains the function name and the parameter values that the function should be called with.</p> <p>The following is an example of a model response to the user prompt &quot;What is the weather like in Boston?&quot;. The model proposes calling the <code translate="no" dir="ltr">get_current_weather</code> function with the parameter <code translate="no" dir="ltr">Boston, MA</code>.</p> <div></div><devsite-code><pre translate="no" dir="ltr" is-upgraded> candidates { content { role: "model" parts { function_call { name: "get_current_weather" args { fields { key: "location" value { string_value: "Boston, MA" } } } } } } ... } </pre></devsite-code> <p>For prompts such as &quot;Get weather details in New Delhi and San Francisco?&quot;, the model may propose several parallel function calls. To learn more, see <a href="#parallel-samples">Parallel function calling example</a>.</p> <h3 id="invoke-api" data-text="Step 4: Invoke an external API" tabindex="-1">Step 4: Invoke an external API</h3> <p>If the application receives a function name and parameter values from the model, the application must connect to an external API and call the function.</p> <p>The following example uses synthetic data to simulate a response payload from an external API:</p> <div class="ds-selector-tabs" data-ds-scope="code-sample"> <section><h3 id="python_3" data-text=" Python " tabindex="-1"> Python </h3><div></div><devsite-code><pre class="devsite-click-to-copy" translate="no" dir="ltr" is-upgraded syntax="Python"><code translate="no" dir="ltr"><span class="devsite-syntax-c1"># Check the function name that the model responded with, and make an API call to an external system</span> <span class="devsite-syntax-k">if</span> <span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">response</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">candidates</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-mi">0</span><span class="devsite-syntax-p">]</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">function_calls</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-mi">0</span><span class="devsite-syntax-p">]</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">name</span> <span class="devsite-syntax-o">==</span> <span class="devsite-syntax-s2">"get_current_weather"</span><span class="devsite-syntax-p">):</span> <span class="devsite-syntax-c1"># Extract the arguments to use in your API call</span> <span class="devsite-syntax-n">location</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">response</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">candidates</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-mi">0</span><span class="devsite-syntax-p">]</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">function_calls</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-mi">0</span><span class="devsite-syntax-p">]</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">args</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-s2">"location"</span><span class="devsite-syntax-p">]</span> <span class="devsite-syntax-c1"># Here you can use your preferred method to make an API request to fetch the current weather, for example:</span> <span class="devsite-syntax-c1"># api_response = requests.post(weather_api_url, data={"location": location})</span> <span class="devsite-syntax-c1"># In this example, we'll use synthetic data to simulate a response payload from an external API</span> <span class="devsite-syntax-n">api_response</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-s2">"""{ "location": "Boston, MA", "temperature": 38, "description": "Partly Cloudy",</span> <span class="devsite-syntax-s2"> "icon": "partly-cloudy", "humidity": 65, "wind": { "speed": 10, "direction": "NW" } }"""</span> </code></pre></devsite-code></section> </div> <p>For best practices related to API invocation, see <a href="#invoke-api-bp">Best practices - API invocation</a>.</p> <h3 id="submit-api-output" data-text="Step 5: Provide the function's output to the model" tabindex="-1">Step 5: Provide the function's output to the model</h3> <p>After an application receives a response from an external API, the application must provide this response to the model. The following is an example of how you can do this using Python:</p> <div class="ds-selector-tabs" data-ds-scope="code-sample"> <section><h3 id="python_4" data-text=" Python " tabindex="-1"> Python </h3><div></div><devsite-code><pre class="devsite-click-to-copy" translate="no" dir="ltr" is-upgraded syntax="Python"><code translate="no" dir="ltr"><span class="devsite-syntax-n">response</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">model</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">generate_content</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-p">[</span> <span class="devsite-syntax-n">user_prompt_content</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-c1"># User prompt</span> <span class="devsite-syntax-n">response</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">candidates</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-mi">0</span><span class="devsite-syntax-p">]</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">content</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-c1"># Function call response</span> <span class="devsite-syntax-n">Content</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">parts</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-p">[</span> <span class="devsite-syntax-n">Part</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">from_function_response</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">name</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-s2">"get_current_weather"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">response</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-s2">"content"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-n">api_response</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-c1"># Return the API response to Gemini</span> <span class="devsite-syntax-p">},</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-p">],</span> <span class="devsite-syntax-p">),</span> <span class="devsite-syntax-p">],</span> <span class="devsite-syntax-n">tools</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-n">weather_tool</span><span class="devsite-syntax-p">],</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-c1"># Get the model summary response</span> <span class="devsite-syntax-n">summary</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">response</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">text</span> </code></pre></devsite-code></section> </div> <p>If the model had proposed several parallel function calls, the application must provide all of the responses back to the model. To learn more, see <a href="#parallel-samples">Parallel function calling example</a>.</p> <p>The model may determine that the output of another function is necessary for responding to the prompt. In this case, the response that the application receives from the model contains another function name and another set of parameter values.</p> <p>If the model determines that the API response is sufficient for responding to the user&#39;s prompt, it creates a natural language response and returns it to the application. In this case, the application must pass the response back to the user. The following is an example of a response:</p> <div></div><devsite-code><pre translate="no" dir="ltr" is-upgraded> It is currently 38 degrees Fahrenheit in Boston, MA with partly cloudy skies. The humidity is 65% and the wind is blowing at 10 mph from the northwest. </pre></devsite-code> <h2 id="examples_of_function_calling" data-text="Examples of function calling" tabindex="-1">Examples of function calling</h2> <h3 id="text-samples" data-text="Text examples" tabindex="-1">Text examples</h3> <p>You can use function calling to generate a single text response. Ad hoc text responses are useful for specific business tasks, including code generation.</p> <p>If you use function calling to generate a single response, you must provide the model with the full context of the interaction. Vertex AI stores the history of the interaction on the client side.</p> <div class="ds-selector-tabs" data-ds-scope="code-sample"> <section><h3 id="python_5" data-text=" Python " tabindex="-1"> Python </h3><p>This example demonstrates a text scenario with one function and one prompt. It uses the <code translate="no" dir="ltr">GenerativeModel</code> class and its methods. For more information about using the Vertex AI SDK for Python with Gemini multimodal models, see <a href="/vertex-ai/generative-ai/docs/multimodal/sdk-for-gemini/gemini-sdk-overview">Introduction to multimodal classes in the Vertex AI SDK for Python</a>.</p> <p> <section> <h3 id="generative-ai-function-calling-text-python_vertex_ai_sdk" track-metadata-position="generative-ai-function-calling-text" track-metadata-region-tag="generative-ai-function-calling-text" data-text="Python" tabindex="-1">Python</h3> <p>To learn how to install or update the Vertex AI SDK for Python, see <a href="/vertex-ai/docs/start/use-vertex-ai-python-sdk" track-type="clientLibrariesReference" track- name="python_vertex_ai_sdk" track-metadata-position="generative-ai-function-calling-text">Install the Vertex AI SDK for Python</a>. For more information, see the <a href="/python/docs/reference/aiplatform/latest" track-type="clientLibrariesUsage" track-name="clientLibrariesLink" track-metadata-lang="python_vertex_ai_sdk"> Python API reference documentation</a>. </p> <div class="github-docwidget-gitinclude-code"> <div></div><devsite-code><pre suppresswarning="suppresswarning" translate="no" class="devsite-click-to-copy" track-metadata-position="GoogleCloudPlatform/python-docs-samples/generative_ai/function_calling/basic_example.py/HEAD/generativeaionvertexai_gemini_function_calling" data-code-snippet="true" data-github-includecode-link="https://github.com/GoogleCloudPlatform/python-docs-samples/blob/HEAD/generative_ai/function_calling/basic_example.py" feedback-context="{&#34;language&#34;: &#34;python_vertex_ai_sdk&#34;, &#34;region_tag&#34;: &#34;generative-ai-function-calling-text&#34;, &#34;snippet_file_url&#34;: &#34;https://github.com/GoogleCloudPlatform/python-docs-samples/blob/HEAD/generative_ai/function_calling/basic_example.py&#34;}" feedback-product="1634365" feedback-bucket="cloud-ai" language="python_vertex_ai_sdk" data-github-path="GoogleCloudPlatform/python-docs-samples/generative_ai/function_calling/basic_example.py" data-git-revision="HEAD" data-region-tag="generativeaionvertexai_gemini_function_calling" dir="ltr" is-upgraded syntax="Python"><code translate="no" dir="ltr"><span class="devsite-syntax-kn">import</span> <span class="devsite-syntax-nn">vertexai</span> <span class="devsite-syntax-kn">from</span> <span class="devsite-syntax-nn">vertexai.generative_models</span> <span class="devsite-syntax-kn">import</span> <span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">Content</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">FunctionDeclaration</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">GenerationConfig</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">GenerativeModel</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">Part</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">Tool</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-c1"># TODO(developer): Update &amp; uncomment below line</span> <span class="devsite-syntax-c1"># PROJECT_ID = "your-project-id"</span> <span class="devsite-syntax-c1"># Initialize Vertex AI</span> <span class="devsite-syntax-n">vertexai</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">init</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">project</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">PROJECT_ID</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">location</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-s2">"us-central1"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-c1"># Initialize Gemini model</span> <span class="devsite-syntax-n">model</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">GenerativeModel</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s2">"gemini-1.5-flash-002"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-c1"># Define the user's prompt in a Content object that we can reuse in model calls</span> <span class="devsite-syntax-n">user_prompt_content</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">Content</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">role</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-s2">"user"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">parts</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-p">[</span> <span class="devsite-syntax-n">Part</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">from_text</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s2">"What is the weather like in Boston?"</span><span class="devsite-syntax-p">),</span> <span class="devsite-syntax-p">],</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-c1"># Specify a function declaration and parameters for an API request</span> <span class="devsite-syntax-n">function_name</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-s2">"get_current_weather"</span> <span class="devsite-syntax-n">get_current_weather_func</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">FunctionDeclaration</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">name</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">function_name</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">description</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-s2">"Get the current weather in a given location"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-c1"># Function parameters are specified in JSON schema format</span> <span class="devsite-syntax-n">parameters</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-s2">"type"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-s2">"object"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-s2">"properties"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-p">{</span><span class="devsite-syntax-s2">"location"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-p">{</span><span class="devsite-syntax-s2">"type"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-s2">"string"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-s2">"description"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-s2">"Location"</span><span class="devsite-syntax-p">}},</span> <span class="devsite-syntax-p">},</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-c1"># Define a tool that includes the above get_current_weather_func</span> <span class="devsite-syntax-n">weather_tool</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">Tool</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">function_declarations</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-n">get_current_weather_func</span><span class="devsite-syntax-p">],</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-c1"># Send the prompt and instruct the model to generate content using the Tool that you just created</span> <span class="devsite-syntax-n">response</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">model</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">generate_content</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">user_prompt_content</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">generation_config</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">GenerationConfig</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">temperature</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-mi">0</span><span class="devsite-syntax-p">),</span> <span class="devsite-syntax-n">tools</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-n">weather_tool</span><span class="devsite-syntax-p">],</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-n">function_call</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">response</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">candidates</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-mi">0</span><span class="devsite-syntax-p">]</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">function_calls</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-mi">0</span><span class="devsite-syntax-p">]</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">function_call</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-c1"># Check the function name that the model responded with, and make an API call to an external system</span> <span class="devsite-syntax-k">if</span> <span class="devsite-syntax-n">function_call</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">name</span> <span class="devsite-syntax-o">==</span> <span class="devsite-syntax-n">function_name</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-c1"># Extract the arguments to use in your API call</span> <span class="devsite-syntax-n">location</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">function_call</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">args</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-s2">"location"</span><span class="devsite-syntax-p">]</span> <span class="devsite-syntax-c1"># noqa: F841</span> <span class="devsite-syntax-c1"># Here you can use your preferred method to make an API request to fetch the current weather, for example:</span> <span class="devsite-syntax-c1"># api_response = requests.post(weather_api_url, data={"location": location})</span> <span class="devsite-syntax-c1"># In this example, we'll use synthetic data to simulate a response payload from an external API</span> <span class="devsite-syntax-n">api_response</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-s2">"""{ "location": "Boston, MA", "temperature": 38, "description": "Partly Cloudy",</span> <span class="devsite-syntax-s2"> "icon": "partly-cloudy", "humidity": 65, "wind": { "speed": 10, "direction": "NW" } }"""</span> <span class="devsite-syntax-c1"># Return the API response to Gemini so it can generate a model response or request another function call</span> <span class="devsite-syntax-n">response</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">model</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">generate_content</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-p">[</span> <span class="devsite-syntax-n">user_prompt_content</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-c1"># User prompt</span> <span class="devsite-syntax-n">response</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">candidates</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-mi">0</span><span class="devsite-syntax-p">]</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">content</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-c1"># Function call response</span> <span class="devsite-syntax-n">Content</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">parts</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-p">[</span> <span class="devsite-syntax-n">Part</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">from_function_response</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">name</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">function_name</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">response</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-s2">"content"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-n">api_response</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-c1"># Return the API response to Gemini</span> <span class="devsite-syntax-p">},</span> <span class="devsite-syntax-p">),</span> <span class="devsite-syntax-p">],</span> <span class="devsite-syntax-p">),</span> <span class="devsite-syntax-p">],</span> <span class="devsite-syntax-n">tools</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-n">weather_tool</span><span class="devsite-syntax-p">],</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-c1"># Get the model response</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">response</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">text</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-c1"># Example response:</span> <span class="devsite-syntax-c1"># The weather in Boston is partly cloudy with a temperature of 38 degrees Fahrenheit.</span> <span class="devsite-syntax-c1"># The humidity is 65% and the wind is blowing from the northwest at 10 mph.</span> </code></pre></devsite-code> </div> </section> </p></section> <section><h3 id="c" data-text=" C# " tabindex="-1"> C# </h3><p>This example demonstrates a text scenario with one function and one prompt.</p> <section> <h3 id="generative-ai-function-calling-text-csharp" track-metadata-position="generative-ai-function-calling-text" track-metadata-region-tag="generative-ai-function-calling-text" data-text="C#" tabindex="-1"><span class="notranslate">C#</span></h3> <p> Before trying this sample, follow the <span class="notranslate">C#</span> setup instructions in the <a href="/vertex-ai/docs/start/client-libraries" track-type="clientLibrariesQuickstart" track-name="csharp" track-metadata-snippet-file-url="https://github.com/GoogleCloudPlatform/dotnet-docs-samples/blob//aiplatform/api/AIPlatform.Samples/FunctionCalling.cs" track-metadata-position="generative-ai-function-calling-text">Vertex AI quickstart using client libraries</a>. For more information, see the <a href="/dotnet/docs/reference/Google.Cloud.AIPlatform.V1/latest" track-type="clientLibrariesUsage" track-name="clientLibrariesLink" track-metadata-lang="csharp" track-metadata-snippet-file-url="https://github.com/GoogleCloudPlatform/dotnet-docs-samples/blob//aiplatform/api/AIPlatform.Samples/FunctionCalling.cs" track-metadata-region-tag="generative-ai-function-calling-text">Vertex AI <span class="notranslate">C#</span> API reference documentation</a>. </p> <p> To authenticate to Vertex AI, set up Application Default Credentials. For more information, see <a href="/docs/authentication/provide-credentials-adc#local-dev">Set up authentication for a local development environment</a>. </p> <div class="github-docwidget-gitinclude-code"> <div></div><devsite-code><pre suppresswarning="suppresswarning" translate="no" class="devsite-click-to-copy" track-metadata-position="GoogleCloudPlatform/dotnet-docs-samples/aiplatform/api/AIPlatform.Samples/FunctionCalling.cs/HEAD/generativeaionvertexai_gemini_function_calling" data-code-snippet="true" data-github-includecode-link="https://github.com/GoogleCloudPlatform/dotnet-docs-samples/blob/HEAD/aiplatform/api/AIPlatform.Samples/FunctionCalling.cs" feedback-context="{&#34;language&#34;: &#34;csharp&#34;, &#34;region_tag&#34;: &#34;generative-ai-function-calling-text&#34;, &#34;snippet_file_url&#34;: &#34;https://github.com/GoogleCloudPlatform/dotnet-docs-samples/blob/HEAD/aiplatform/api/AIPlatform.Samples/FunctionCalling.cs&#34;}" feedback-product="1634365" feedback-bucket="cloud-ai" language="csharp" data-github-path="GoogleCloudPlatform/dotnet-docs-samples/aiplatform/api/AIPlatform.Samples/FunctionCalling.cs" data-git-revision="HEAD" data-region-tag="generativeaionvertexai_gemini_function_calling" dir="ltr" is-upgraded syntax="C#"><code translate="no" dir="ltr"> <span class="devsite-syntax-k">using</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">Google.Cloud.AIPlatform.V1</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-k">using</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">System</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-k">using</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">System.Threading.Tasks</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-k">using</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">Type</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Google</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">Cloud</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">AIPlatform</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">V1</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">Type</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-k">using</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">Value</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Google</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">Protobuf</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WellKnownTypes</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">Value</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-k">public</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">class</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nc">FunctionCalling</span> <span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">public</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">async</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Task&lt;string&gt;</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nf">GenerateFunctionCall</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">string</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">projectId</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"your-project-id"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">string</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">location</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"us-central1"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">string</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">publisher</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"google"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">string</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">model</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"gemini-1.5-flash-001"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">var</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">predictionServiceClient</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">PredictionServiceClientBuilder</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Endpoint</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">$"{location}-aiplatform.googleapis.com"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}.</span><span class="devsite-syntax-n">Build</span><span class="devsite-syntax-p">();</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Define the user's prompt in a Content object that we can reuse in</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// model calls</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">var</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">userPromptContent</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Content</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Role</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"USER"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Parts</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Part</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Text</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"What is the weather like in Boston?"</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">};</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Specify a function declaration and parameters for an API request</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">var</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">functionName</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"get_current_weather"</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">var</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">getCurrentWeatherFunc</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">FunctionDeclaration</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Name</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">functionName</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Description</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"Get the current weather in a given location"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Parameters</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">OpenApiSchema</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Type</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Type</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">Object</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Properties</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-na">["location"]</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">new</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Type</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Type</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Description</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"Get the current weather in a given location"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-na">["unit"]</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">new</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Type</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Type</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Description</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"The unit of measurement for the temperature"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Enum</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span><span class="devsite-syntax-s">"celsius"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"fahrenheit"</span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Required</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"location"</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">};</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Send the prompt and instruct the model to generate content using the tool that you just created</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">var</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">generateContentRequest</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">GenerateContentRequest</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Model</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">$"projects/{projectId}/locations/{location}/publishers/{publisher}/models/{model}"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">GenerationConfig</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">GenerationConfig</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Temperature</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-m">0f</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Contents</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">userPromptContent</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Tools</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Tool</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">FunctionDeclarations</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">getCurrentWeatherFunc</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">};</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">GenerateContentResponse</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">response</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">await</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">predictionServiceClient</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">GenerateContentAsync</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">generateContentRequest</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">var</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">functionCall</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">response</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">Candidates</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-m">0</span><span class="devsite-syntax-p">].</span><span class="devsite-syntax-n">Content</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">Parts</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-m">0</span><span class="devsite-syntax-p">].</span><span class="devsite-syntax-n">FunctionCall</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">functionCall</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">string</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">apiResponse</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">""</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Check the function name that the model responded with, and make an API call to an external system</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">functionCall</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">Name</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">==</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">functionName</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Extract the arguments to use in your API call</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">string</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">locationCity</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">functionCall</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">Args</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">Fields</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-s">"location"</span><span class="devsite-syntax-p">].</span><span class="devsite-syntax-n">StringValue</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Here you can use your preferred method to make an API request to</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// fetch the current weather</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// In this example, we'll use synthetic data to simulate a response</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// payload from an external API</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">apiResponse</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">@"{ ""location"": ""Boston, MA"",</span> <span class="devsite-syntax-s"> ""temperature"": 38, ""description"": ""Partly Cloudy""}"</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Return the API response to Gemini so it can generate a model response or request another function call</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">generateContentRequest</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">GenerateContentRequest</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Model</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">$"projects/{projectId}/locations/{location}/publishers/{publisher}/models/{model}"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Contents</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">userPromptContent</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// User prompt</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">response</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">Candidates</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-m">0</span><span class="devsite-syntax-p">].</span><span class="devsite-syntax-n">Content</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Function call response,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Content</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Parts</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Part</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">FunctionResponse</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">new</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Name</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">functionName</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Response</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">new</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Fields</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"content"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Value</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">StringValue</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">apiResponse</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Tools</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Tool</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">FunctionDeclarations</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">getCurrentWeatherFunc</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">};</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">response</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">await</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">predictionServiceClient</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">GenerateContentAsync</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">generateContentRequest</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">string</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">responseText</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">response</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">Candidates</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-m">0</span><span class="devsite-syntax-p">].</span><span class="devsite-syntax-n">Content</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">Parts</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-m">0</span><span class="devsite-syntax-p">].</span><span class="devsite-syntax-n">Text</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">responseText</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">responseText</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-p">}</span> </code></pre></devsite-code> </div> </section> </section> <section><h3 id="node.js" data-text=" Node.js " tabindex="-1"> Node.js </h3><p>This example demonstrates a text scenario with one function and one prompt.</p> <p> <section> <h3 id="generative-ai-function-calling-text-nodejs" track-metadata-position="generative-ai-function-calling-text" track-metadata-region-tag="generative-ai-function-calling-text" data-text="Node.js" tabindex="-1"><span class="notranslate">Node.js</span></h3> <p> Before trying this sample, follow the <span class="notranslate">Node.js</span> setup instructions in the <a href="/vertex-ai/docs/start/client-libraries" track-type="clientLibrariesQuickstart" track-name="nodejs" track-metadata-snippet-file-url="https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob//generative-ai/snippets/function-calling/functionCallingStreamContent.js" track-metadata-position="generative-ai-function-calling-text">Vertex AI quickstart using client libraries</a>. For more information, see the <a href="/nodejs/docs/reference/aiplatform/latest" track-type="clientLibrariesUsage" track-name="clientLibrariesLink" track-metadata-lang="nodejs" track-metadata-snippet-file-url="https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob//generative-ai/snippets/function-calling/functionCallingStreamContent.js" track-metadata-region-tag="generative-ai-function-calling-text">Vertex AI <span class="notranslate">Node.js</span> API reference documentation</a>. </p> <p> To authenticate to Vertex AI, set up Application Default Credentials. For more information, see <a href="/docs/authentication/provide-credentials-adc#local-dev">Set up authentication for a local development environment</a>. </p> <div class="github-docwidget-gitinclude-code"> <div></div><devsite-code><pre suppresswarning="suppresswarning" translate="no" class="devsite-click-to-copy" track-metadata-position="GoogleCloudPlatform/nodejs-docs-samples/generative-ai/snippets/function-calling/functionCallingStreamContent.js/HEAD/generativeaionvertexai_gemini_function_calling_content" data-code-snippet="true" data-github-includecode-link="https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/HEAD/generative-ai/snippets/function-calling/functionCallingStreamContent.js" feedback-context="{&#34;language&#34;: &#34;nodejs&#34;, &#34;region_tag&#34;: &#34;generative-ai-function-calling-text&#34;, &#34;snippet_file_url&#34;: &#34;https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/HEAD/generative-ai/snippets/function-calling/functionCallingStreamContent.js&#34;}" feedback-product="1634365" feedback-bucket="cloud-ai" language="nodejs" data-github-path="GoogleCloudPlatform/nodejs-docs-samples/generative-ai/snippets/function-calling/functionCallingStreamContent.js" data-git-revision="HEAD" data-region-tag="generativeaionvertexai_gemini_function_calling_content" dir="ltr" is-upgraded syntax="JavaScript"><code translate="no" dir="ltr"><span class="devsite-syntax-kd">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">VertexAI</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">FunctionDeclarationSchemaType</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-p">}</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">require</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s1">'@google-cloud/vertexai'</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-kd">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">functionDeclarations</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">function_declarations</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">name</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'get_current_weather'</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">description</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'get weather in a given location'</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">parameters</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">type</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">FunctionDeclarationSchemaType</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">OBJECT</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">properties</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">location</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span><span class="devsite-syntax-nx">type</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">FunctionDeclarationSchemaType</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">STRING</span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">unit</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">type</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">FunctionDeclarationSchemaType</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">STRING</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kr">enum</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-s1">'celsius'</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'fahrenheit'</span><span class="devsite-syntax-p">],</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">required</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-s1">'location'</span><span class="devsite-syntax-p">],</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">],</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-p">];</span> <span class="devsite-syntax-kd">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">functionResponseParts</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">functionResponse</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">name</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'get_current_weather'</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">response</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span><span class="devsite-syntax-nx">name</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'get_current_weather'</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">content</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span><span class="devsite-syntax-nx">weather</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'super nice'</span><span class="devsite-syntax-p">}},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-p">];</span> <span class="devsite-syntax-cm">/**</span> <span class="devsite-syntax-cm"> * TODO(developer): Update these variables before running the sample.</span> <span class="devsite-syntax-cm"> */</span> <span class="devsite-syntax-k">async</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">function</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">functionCallingStreamContent</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">projectId</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'PROJECT_ID'</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">location</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'us-central1'</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">model</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'gemini-1.5-flash-001'</span> <span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Initialize Vertex with your Cloud project and location</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">vertexAI</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-ow">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">VertexAI</span><span class="devsite-syntax-p">({</span><span class="devsite-syntax-nx">project</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">projectId</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">location</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">location</span><span class="devsite-syntax-p">});</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Instantiate the model</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">generativeModel</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">vertexAI</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">getGenerativeModel</span><span class="devsite-syntax-p">({</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">model</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">model</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">});</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">request</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">contents</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span><span class="devsite-syntax-nx">role</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'user'</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">parts</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[{</span><span class="devsite-syntax-nx">text</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'What is the weather in Boston?'</span><span class="devsite-syntax-p">}]},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">role</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'ASSISTANT'</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">parts</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">functionCall</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">name</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'get_current_weather'</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">args</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span><span class="devsite-syntax-nx">location</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'Boston'</span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">],</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span><span class="devsite-syntax-nx">role</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'USER'</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">parts</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">functionResponseParts</span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">],</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">tools</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">functionDeclarations</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">};</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">streamingResp</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">await</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">generativeModel</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">generateContentStream</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">request</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">for</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">await</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-kd">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">item</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">of</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">streamingResp</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">stream</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">log</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">item</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">candidates</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-mf">0</span><span class="devsite-syntax-p">].</span><span class="devsite-syntax-nx">content</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">parts</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-mf">0</span><span class="devsite-syntax-p">].</span><span class="devsite-syntax-nx">text</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-p">}</span></code></pre></devsite-code> </div> </section> </p></section> <section><h3 id="rest" data-text=" REST " tabindex="-1"> REST </h3><p>This example demonstrates a text scenario with three functions and one prompt.</p> <p>In this example, you call the generative AI model twice.</p> <ul> <li>In the <a href="#text-rest-first-request">first call</a>, you provide the model with the prompt and the function declarations.</li> <li>In the <a href="#text-rest-second-request">second call</a>, you provide the model with the API response.</li> </ul> <h4 id="text-rest-first-request" data-text="First model request" tabindex="-1">First model request</h4> <p>The request must define a prompt in the <code translate="no" dir="ltr">text</code> parameter. This example defines the following prompt: &quot;Which theaters in Mountain View show the Barbie movie?&quot;.</p> <p>The request must also define a tool (<code translate="no" dir="ltr">tools</code>) with a set of function declarations (<code translate="no" dir="ltr">functionDeclarations</code>). These function declarations must be specified in a format that&#39;s compatible with the <a href="https://spec.openapis.org/oas/v3.0.3#schema">OpenAPI schema</a>. This example defines the following functions:</p> <ul> <li><code translate="no" dir="ltr">find_movies</code> finds movie titles playing in theaters.</li> <li><code translate="no" dir="ltr">find_theatres</code> finds theaters based on location.</li> <li><code translate="no" dir="ltr">get_showtimes</code> finds the start times for movies playing in a specific theater.</li> </ul> <p>To learn more about the parameters of the model request, see <a href="/vertex-ai/generative-ai/docs/model-reference/gemini">Gemini API</a>.</p> <p>Replace <var translate="no">my-project</var> with the name of your Google Cloud project.</p> <div> <devsite-expandable> <h4 class="showalways" id="first-model-request" data-text="First model request" tabindex="-1">First model request</h4> <div></div><devsite-code><pre class="devsite-click-to-copy" translate="no" dir="ltr" is-upgraded> PROJECT_ID=<var translate="no">my-project</var> MODEL_ID=gemini-1.0-pro API=streamGenerateContent curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Content-Type: application/json" https://us-central1-aiplatform.googleapis.com/v1/projects/${PROJECT_ID}/locations/us-central1/publishers/google/models/${MODEL_ID}:${API} -d '{ "contents": { "role": "user", "parts": { "text": "Which theaters in Mountain View show the Barbie movie?" } }, "tools": [ { "function_declarations": [ { "name": "find_movies", "description": "find movie titles currently playing in theaters based on any description, genre, title words, etc.", "parameters": { "type": "object", "properties": { "location": { "type": "string", "description": "The city and state, e.g. San Francisco, CA or a zip code e.g. 95616" }, "description": { "type": "string", "description": "Any kind of description including category or genre, title words, attributes, etc." } }, "required": [ "description" ] } }, { "name": "find_theaters", "description": "find theaters based on location and optionally movie title which are is currently playing in theaters", "parameters": { "type": "object", "properties": { "location": { "type": "string", "description": "The city and state, e.g. San Francisco, CA or a zip code e.g. 95616" }, "movie": { "type": "string", "description": "Any movie title" } }, "required": [ "location" ] } }, { "name": "get_showtimes", "description": "Find the start times for movies playing in a specific theater", "parameters": { "type": "object", "properties": { "location": { "type": "string", "description": "The city and state, e.g. San Francisco, CA or a zip code e.g. 95616" }, "movie": { "type": "string", "description": "Any movie title" }, "theater": { "type": "string", "description": "Name of the theater" }, "date": { "type": "string", "description": "Date for requested showtime" } }, "required": [ "location", "movie", "theater", "date" ] } } ] } ] }' </pre></devsite-code> </devsite-expandable> </div> <p>For the prompt &quot;Which theaters in Mountain View show the Barbie movie?&quot;, the model might return the function <code translate="no" dir="ltr">find_theatres</code> with parameters <code translate="no" dir="ltr">Barbie</code> and <code translate="no" dir="ltr">Mountain View, CA</code>.</p> <div> <devsite-expandable> <h4 class="showalways" id="response-to-first-model-request" data-text="Response to first model request" tabindex="-1">Response to first model request</h4> <div></div><devsite-code><pre translate="no" dir="ltr" is-upgraded> [{ "candidates": [ { "content": { "parts": [ { "functionCall": { "name": "find_theaters", "args": { "movie": "Barbie", "location": "Mountain View, CA" } } } ] }, "finishReason": "STOP", "safetyRatings": [ { "category": "HARM_CATEGORY_HARASSMENT", "probability": "NEGLIGIBLE" }, { "category": "HARM_CATEGORY_HATE_SPEECH", "probability": "NEGLIGIBLE" }, { "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT", "probability": "NEGLIGIBLE" }, { "category": "HARM_CATEGORY_DANGEROUS_CONTENT", "probability": "NEGLIGIBLE" } ] } ], "usageMetadata": { "promptTokenCount": 9, "totalTokenCount": 9 } }] </pre></devsite-code> </devsite-expandable> </div> <h4 id="text-rest-second-request" data-text="Second model request" tabindex="-1">Second model request</h4> <p>This example uses synthetic data instead of calling the external API. There are two results, each with two parameters (<code translate="no" dir="ltr">name</code> and <code translate="no" dir="ltr">address</code>):</p> <ol> <li><code translate="no" dir="ltr">name</code>: <code translate="no" dir="ltr">AMC Mountain View 16</code>, <code translate="no" dir="ltr">address</code>: <code translate="no" dir="ltr">2000 W El Camino Real, Mountain View, CA 94040</code></li> <li><code translate="no" dir="ltr">name</code>: <code translate="no" dir="ltr">Regal Edwards 14</code>, <code translate="no" dir="ltr">address</code>: <code translate="no" dir="ltr">245 Castro St, Mountain View, CA 94040</code></li> </ol> <p>Replace <var translate="no">my-project</var> with the name of your Google Cloud project.</p> <div> <devsite-expandable> <h4 class="showalways" id="second-model-request" data-text="Second model request" tabindex="-1">Second model request</h4> <div></div><devsite-code><pre class="devsite-click-to-copy" translate="no" dir="ltr" is-upgraded> PROJECT_ID=<var translate="no">my-project</var> MODEL_ID=gemini-1.0-pro API=streamGenerateContent curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Content-Type: application/json" https://us-central1-aiplatform.googleapis.com/v1/projects/${PROJECT_ID}/locations/us-central1/publishers/google/models/${MODEL_ID}:${API} -d '{ "contents": [{ "role": "user", "parts": [{ "text": "Which theaters in Mountain View show the Barbie movie?" }] }, { "role": "model", "parts": [{ "functionCall": { "name": "find_theaters", "args": { "location": "Mountain View, CA", "movie": "Barbie" } } }] }, { "parts": [{ "functionResponse": { "name": "find_theaters", "response": { "name": "find_theaters", "content": { "movie": "Barbie", "theaters": [{ "name": "AMC Mountain View 16", "address": "2000 W El Camino Real, Mountain View, CA 94040" }, { "name": "Regal Edwards 14", "address": "245 Castro St, Mountain View, CA 94040" }] } } } }] }], "tools": [{ "functionDeclarations": [{ "name": "find_movies", "description": "find movie titles currently playing in theaters based on any description, genre, title words, etc.", "parameters": { "type": "OBJECT", "properties": { "location": { "type": "STRING", "description": "The city and state, e.g. San Francisco, CA or a zip code e.g. 95616" }, "description": { "type": "STRING", "description": "Any kind of description including category or genre, title words, attributes, etc." } }, "required": ["description"] } }, { "name": "find_theaters", "description": "find theaters based on location and optionally movie title which are is currently playing in theaters", "parameters": { "type": "OBJECT", "properties": { "location": { "type": "STRING", "description": "The city and state, e.g. San Francisco, CA or a zip code e.g. 95616" }, "movie": { "type": "STRING", "description": "Any movie title" } }, "required": ["location"] } }, { "name": "get_showtimes", "description": "Find the start times for movies playing in a specific theater", "parameters": { "type": "OBJECT", "properties": { "location": { "type": "STRING", "description": "The city and state, e.g. San Francisco, CA or a zip code e.g. 95616" }, "movie": { "type": "STRING", "description": "Any movie title" }, "theater": { "type": "STRING", "description": "Name of the theater" }, "date": { "type": "STRING", "description": "Date for requested showtime" } }, "required": ["location", "movie", "theater", "date"] } }] }] }' </pre></devsite-code> </devsite-expandable> </div> <p>The model&#39;s response might be similar to the following:</p> <div> <devsite-expandable> <h4 class="showalways" id="response-to-second-model-request" data-text="Response to second model request" tabindex="-1">Response to second model request</h4> <div></div><devsite-code><pre translate="no" dir="ltr" is-upgraded> { "candidates": [ { "content": { "parts": [ { "text": " OK. Barbie is showing in two theaters in Mountain View, CA: AMC Mountain View 16 and Regal Edwards 14." } ] } } ], "usageMetadata": { "promptTokenCount": 9, "candidatesTokenCount": 27, "totalTokenCount": 36 } } </pre></devsite-code> </devsite-expandable> </div></section> </div> <h3 id="chat-samples" data-text="Chat examples" tabindex="-1">Chat examples</h3> <p>You can use function calling to support a chat session. Chat sessions are useful in freeform, conversational scenarios, where a user is likely to ask follow-up questions.</p> <p>If you use function calling in the context of a chat session, the session stores the context for you and includes it in every model request. Vertex AI stores the history of the interaction on the client side.</p> <div> <devsite-selector> <section> <h3 id="generative-ai-function-calling-text-python_vertex_ai_sdk" track-metadata-position="generative-ai-function-calling-text" track-metadata-region-tag="generative-ai-function-calling-text" data-text="Python" tabindex="-1">Python</h3> <p>This example demonstrates a chat scenario with two functions and two sequential prompts. It uses the <code translate="no" dir="ltr">GenerativeModel</code> class and its methods. For more information about using the Vertex AI SDK for Python with multimodal models, see <a href="/vertex-ai/generative-ai/docs/multimodal/sdk-for-gemini/gemini-sdk-overview">Introduction to multimodal classes in the Vertex AI SDK for Python</a>.</p> <p>To learn how to install or update Python, see <a href="/vertex-ai/docs/start/use-vertex-ai-python-sdk">Install the Vertex AI SDK for Python</a>. For more information, see the <a href="/python/docs/reference/aiplatform/latest">Python API reference documentation</a>.</p> <div class="github-docwidget-gitinclude-code"> <div></div><devsite-code><pre suppresswarning="suppresswarning" translate="no" class="devsite-click-to-copy" track-metadata-position="GoogleCloudPlatform/python-docs-samples/generative_ai/function_calling/chat_example.py/HEAD/generativeaionvertexai_gemini_function_calling_chat" data-code-snippet="true" data-github-includecode-link="https://github.com/GoogleCloudPlatform/python-docs-samples/blob/HEAD/generative_ai/function_calling/chat_example.py" feedback-context="{&#34;language&#34;: &#34;python_vertex_ai_sdk&#34;, &#34;region_tag&#34;: &#34;generative-ai-function-calling-text&#34;, &#34;snippet_file_url&#34;: &#34;https://github.com/GoogleCloudPlatform/python-docs-samples/blob/HEAD/generative_ai/function_calling/chat_example.py&#34;}" feedback-product="1634365" feedback-bucket="cloud-ai" language="python_vertex_ai_sdk" data-github-path="GoogleCloudPlatform/python-docs-samples/generative_ai/function_calling/chat_example.py" data-git-revision="HEAD" data-region-tag="generativeaionvertexai_gemini_function_calling_chat" dir="ltr" is-upgraded syntax="Python"><code translate="no" dir="ltr"><span class="devsite-syntax-kn">import</span> <span class="devsite-syntax-nn">vertexai</span> <span class="devsite-syntax-kn">from</span> <span class="devsite-syntax-nn">vertexai.generative_models</span> <span class="devsite-syntax-kn">import</span> <span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">FunctionDeclaration</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">GenerationConfig</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">GenerativeModel</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">Part</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">Tool</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-c1"># TODO(developer): Update &amp; uncomment below line</span> <span class="devsite-syntax-c1"># PROJECT_ID = "your-project-id"</span> <span class="devsite-syntax-c1"># Initialize Vertex AI</span> <span class="devsite-syntax-n">vertexai</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">init</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">project</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">PROJECT_ID</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">location</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-s2">"us-central1"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-c1"># Specify a function declaration and parameters for an API request</span> <span class="devsite-syntax-n">get_product_sku</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-s2">"get_product_sku"</span> <span class="devsite-syntax-n">get_product_sku_func</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">FunctionDeclaration</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">name</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">get_product_sku</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">description</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-s2">"Get the SKU for a product"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-c1"># Function parameters are specified in OpenAPI JSON schema format</span> <span class="devsite-syntax-n">parameters</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-s2">"type"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-s2">"object"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-s2">"properties"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-p">{</span> <span class="devsite-syntax-s2">"product_name"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-p">{</span><span class="devsite-syntax-s2">"type"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-s2">"string"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-s2">"description"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-s2">"Product name"</span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-p">},</span> <span class="devsite-syntax-p">},</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-c1"># Specify another function declaration and parameters for an API request</span> <span class="devsite-syntax-n">get_store_location_func</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">FunctionDeclaration</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">name</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-s2">"get_store_location"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">description</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-s2">"Get the location of the closest store"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-c1"># Function parameters are specified in JSON schema format</span> <span class="devsite-syntax-n">parameters</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-s2">"type"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-s2">"object"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-s2">"properties"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-p">{</span><span class="devsite-syntax-s2">"location"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-p">{</span><span class="devsite-syntax-s2">"type"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-s2">"string"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-s2">"description"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-s2">"Location"</span><span class="devsite-syntax-p">}},</span> <span class="devsite-syntax-p">},</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-c1"># Define a tool that includes the above functions</span> <span class="devsite-syntax-n">retail_tool</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">Tool</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">function_declarations</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-p">[</span> <span class="devsite-syntax-n">get_product_sku_func</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">get_store_location_func</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-p">],</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-c1"># Initialize Gemini model</span> <span class="devsite-syntax-n">model</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">GenerativeModel</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">model_name</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-s2">"gemini-1.5-flash-001"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">generation_config</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">GenerationConfig</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">temperature</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-mi">0</span><span class="devsite-syntax-p">),</span> <span class="devsite-syntax-n">tools</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-n">retail_tool</span><span class="devsite-syntax-p">],</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-c1"># Start a chat session</span> <span class="devsite-syntax-n">chat</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">model</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">start_chat</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-c1"># Send a prompt for the first conversation turn that should invoke the get_product_sku function</span> <span class="devsite-syntax-n">response</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">chat</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">send_message</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s2">"Do you have the Pixel 8 Pro in stock?"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-n">function_call</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">response</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">candidates</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-mi">0</span><span class="devsite-syntax-p">]</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">function_calls</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-mi">0</span><span class="devsite-syntax-p">]</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">function_call</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-c1"># Check the function name that the model responded with, and make an API call to an external system</span> <span class="devsite-syntax-k">if</span> <span class="devsite-syntax-n">function_call</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">name</span> <span class="devsite-syntax-o">==</span> <span class="devsite-syntax-n">get_product_sku</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-c1"># Extract the arguments to use in your API call</span> <span class="devsite-syntax-n">product_name</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">function_call</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">args</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-s2">"product_name"</span><span class="devsite-syntax-p">]</span> <span class="devsite-syntax-c1"># noqa: F841</span> <span class="devsite-syntax-c1"># Here you can use your preferred method to make an API request to retrieve the product SKU, as in:</span> <span class="devsite-syntax-c1"># api_response = requests.post(product_api_url, data={"product_name": product_name})</span> <span class="devsite-syntax-c1"># In this example, we'll use synthetic data to simulate a response payload from an external API</span> <span class="devsite-syntax-n">api_response</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-p">{</span><span class="devsite-syntax-s2">"sku"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-s2">"GA04834-US"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-s2">"in_stock"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-s2">"Yes"</span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-c1"># Return the API response to Gemini, so it can generate a model response or request another function call</span> <span class="devsite-syntax-n">response</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">chat</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">send_message</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">Part</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">from_function_response</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">name</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">get_product_sku</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">response</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-s2">"content"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-n">api_response</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-p">},</span> <span class="devsite-syntax-p">),</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-c1"># Extract the text from the model response</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">response</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">text</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-c1"># Send a prompt for the second conversation turn that should invoke the get_store_location function</span> <span class="devsite-syntax-n">response</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">chat</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">send_message</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-s2">"Is there a store in Mountain View, CA that I can visit to try it out?"</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-n">function_call</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">response</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">candidates</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-mi">0</span><span class="devsite-syntax-p">]</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">function_calls</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-mi">0</span><span class="devsite-syntax-p">]</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">function_call</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-c1"># Check the function name that the model responded with, and make an API call to an external system</span> <span class="devsite-syntax-k">if</span> <span class="devsite-syntax-n">function_call</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">name</span> <span class="devsite-syntax-o">==</span> <span class="devsite-syntax-s2">"get_store_location"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-c1"># Extract the arguments to use in your API call</span> <span class="devsite-syntax-n">location</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">function_call</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">args</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-s2">"location"</span><span class="devsite-syntax-p">]</span> <span class="devsite-syntax-c1"># noqa: F841</span> <span class="devsite-syntax-c1"># Here you can use your preferred method to make an API request to retrieve store location closest to the user, as in:</span> <span class="devsite-syntax-c1"># api_response = requests.post(store_api_url, data={"location": location})</span> <span class="devsite-syntax-c1"># In this example, we'll use synthetic data to simulate a response payload from an external API</span> <span class="devsite-syntax-n">api_response</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-p">{</span><span class="devsite-syntax-s2">"store"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-s2">"2000 N Shoreline Blvd, Mountain View, CA 94043, US"</span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-c1"># Return the API response to Gemini, so it can generate a model response or request another function call</span> <span class="devsite-syntax-n">response</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">chat</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">send_message</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">Part</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">from_function_response</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">name</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-s2">"get_store_location"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">response</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-s2">"content"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-n">api_response</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-p">},</span> <span class="devsite-syntax-p">),</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-c1"># Extract the text from the model response</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">response</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">text</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-c1"># Example response:</span> <span class="devsite-syntax-c1"># name: "get_product_sku"</span> <span class="devsite-syntax-c1"># args {</span> <span class="devsite-syntax-c1"># fields { key: "product_name" value {string_value: "Pixel 8 Pro" }</span> <span class="devsite-syntax-c1"># }</span> <span class="devsite-syntax-c1"># }</span> <span class="devsite-syntax-c1"># Yes, we have the Pixel 8 Pro in stock.</span> <span class="devsite-syntax-c1"># name: "get_store_location"</span> <span class="devsite-syntax-c1"># args {</span> <span class="devsite-syntax-c1"># fields { key: "location" value { string_value: "Mountain View, CA" }</span> <span class="devsite-syntax-c1"># }</span> <span class="devsite-syntax-c1"># }</span> <span class="devsite-syntax-c1"># Yes, there is a store located at 2000 N Shoreline Blvd, Mountain View, CA 94043, US.</span> </code></pre></devsite-code> </div> </section> <section> <h3 id="generative-ai-function-calling-text-java" track-metadata-position="generative-ai-function-calling-text" track-metadata-region-tag="generative-ai-function-calling-text" data-text="Java" tabindex="-1"><span class="notranslate">Java</span></h3> <p> Before trying this sample, follow the <span class="notranslate">Java</span> setup instructions in the <a href="/vertex-ai/docs/start/client-libraries" track-type="clientLibrariesQuickstart" track-name="java" track-metadata-snippet-file-url="https://github.com/GoogleCloudPlatform/java-docs-samples/blob//vertexai/snippets/src/main/java/vertexai/gemini/FunctionCalling.java" track-metadata-position="generative-ai-function-calling-text">Vertex AI quickstart using client libraries</a>. For more information, see the <a href="/java/docs/reference/google-cloud-aiplatform/latest/com.google.cloud.aiplatform.v1" track-type="clientLibrariesUsage" track-name="clientLibrariesLink" track-metadata-lang="java" track-metadata-snippet-file-url="https://github.com/GoogleCloudPlatform/java-docs-samples/blob//vertexai/snippets/src/main/java/vertexai/gemini/FunctionCalling.java" track-metadata-region-tag="generative-ai-function-calling-text">Vertex AI <span class="notranslate">Java</span> API reference documentation</a>. </p> <p> To authenticate to Vertex AI, set up Application Default Credentials. For more information, see <a href="/docs/authentication/provide-credentials-adc#local-dev">Set up authentication for a local development environment</a>. </p> <div class="github-docwidget-gitinclude-code"> <div></div><devsite-code><pre suppresswarning="suppresswarning" translate="no" class="devsite-click-to-copy" track-metadata-position="GoogleCloudPlatform/java-docs-samples/vertexai/snippets/src/main/java/vertexai/gemini/FunctionCalling.java/HEAD/generativeaionvertexai_gemini_function_calling" data-code-snippet="true" data-github-includecode-link="https://github.com/GoogleCloudPlatform/java-docs-samples/blob/HEAD/vertexai/snippets/src/main/java/vertexai/gemini/FunctionCalling.java" feedback-context="{&#34;language&#34;: &#34;java&#34;, &#34;region_tag&#34;: &#34;generative-ai-function-calling-text&#34;, &#34;snippet_file_url&#34;: &#34;https://github.com/GoogleCloudPlatform/java-docs-samples/blob/HEAD/vertexai/snippets/src/main/java/vertexai/gemini/FunctionCalling.java&#34;}" feedback-product="1634365" feedback-bucket="cloud-ai" language="java" data-github-path="GoogleCloudPlatform/java-docs-samples/vertexai/snippets/src/main/java/vertexai/gemini/FunctionCalling.java" data-git-revision="HEAD" data-region-tag="generativeaionvertexai_gemini_function_calling" dir="ltr" is-upgraded syntax="Java"><code translate="no" dir="ltr"><span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">com.google.cloud.vertexai.VertexAI</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">com.google.cloud.vertexai.api.Content</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">com.google.cloud.vertexai.api.FunctionDeclaration</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">com.google.cloud.vertexai.api.GenerateContentResponse</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">com.google.cloud.vertexai.api.Schema</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">com.google.cloud.vertexai.api.Tool</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">com.google.cloud.vertexai.api.Type</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">com.google.cloud.vertexai.generativeai.ChatSession</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">com.google.cloud.vertexai.generativeai.ContentMaker</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">com.google.cloud.vertexai.generativeai.GenerativeModel</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">com.google.cloud.vertexai.generativeai.PartMaker</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">com.google.cloud.vertexai.generativeai.ResponseHandler</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">java.io.IOException</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">java.util.Arrays</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">java.util.Collections</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kd">public</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">class</span> <span class="devsite-syntax-nc">FunctionCalling</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">public</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">static</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">void</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nf">main</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-o">[]</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">args</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">throws</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">IOException</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// TODO(developer): Replace these variables before running the sample.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">projectId</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"your-google-cloud-project-id"</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">location</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"us-central1"</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">modelName</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"gemini-1.5-flash-001"</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">promptText</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"What's the weather like in Paris?"</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">whatsTheWeatherLike</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">projectId</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">location</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">modelName</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">promptText</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// A request involving the interaction with an external tool</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">public</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">static</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nf">whatsTheWeatherLike</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">projectId</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">location</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">modelName</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">promptText</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">throws</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">IOException</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Initialize client that will be used to send requests.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// This client only needs to be created once, and can be reused for multiple requests.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">try</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">VertexAI</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">vertexAI</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">VertexAI</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">projectId</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">location</span><span class="devsite-syntax-p">))</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">FunctionDeclaration</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">functionDeclaration</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">FunctionDeclaration</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">newBuilder</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">setName</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"getCurrentWeather"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">setDescription</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"Get the current weather in a given location"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">setParameters</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Schema</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">newBuilder</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">setType</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">Type</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">OBJECT</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">putProperties</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"location"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Schema</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">newBuilder</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">setType</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">Type</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">STRING</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">setDescription</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"location"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">build</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">addRequired</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"location"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">build</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">build</span><span class="devsite-syntax-p">();</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"Function declaration:"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">functionDeclaration</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Add the function to a "tool"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Tool</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">tool</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Tool</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">newBuilder</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">addFunctionDeclarations</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">functionDeclaration</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">build</span><span class="devsite-syntax-p">();</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Start a chat session from a model, with the use of the declared function.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">GenerativeModel</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">model</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">GenerativeModel</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">modelName</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">vertexAI</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">withTools</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">Arrays</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">asList</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">tool</span><span class="devsite-syntax-p">));</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">ChatSession</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">chat</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">model</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">startChat</span><span class="devsite-syntax-p">();</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">format</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"Ask the question: %s"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">promptText</span><span class="devsite-syntax-p">));</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">GenerateContentResponse</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">response</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">chat</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">sendMessage</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">promptText</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// The model will most likely return a function call to the declared</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// function `getCurrentWeather` with "Paris" as the value for the</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// argument `location`.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"\nPrint response: "</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">ResponseHandler</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getContent</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">response</span><span class="devsite-syntax-p">));</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Provide an answer to the model so that it knows what the result</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// of a "function call" is.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Content</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">content</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">ContentMaker</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">fromMultiModalData</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">PartMaker</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">fromFunctionResponse</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"getCurrentWeather"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Collections</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">singletonMap</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"currentWeather"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"sunny"</span><span class="devsite-syntax-p">)));</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"Provide the function response: "</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">content</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">response</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">chat</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">sendMessage</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">content</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// See what the model replies now</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"Print response: "</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">finalAnswer</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">ResponseHandler</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getText</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">response</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">finalAnswer</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">finalAnswer</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-p">}</span></code></pre></devsite-code> </div> </section> <section> <h3 id="generative-ai-function-calling-text-go" track-metadata-position="generative-ai-function-calling-text" track-metadata-region-tag="generative-ai-function-calling-text" data-text="Go" tabindex="-1"><span class="notranslate">Go</span></h3> <p> Before trying this sample, follow the <span class="notranslate">Go</span> setup instructions in the <a href="/vertex-ai/docs/start/client-libraries" track-type="clientLibrariesQuickstart" track-name="go" track-metadata-snippet-file-url="https://github.com/GoogleCloudPlatform/golang-samples/blob//vertexai/function-calling/functioncalling.go" track-metadata-position="generative-ai-function-calling-text">Vertex AI quickstart using client libraries</a>. For more information, see the <a href="/go/docs/reference/cloud.google.com/go/aiplatform/latest/apiv1" track-type="clientLibrariesUsage" track-name="clientLibrariesLink" track-metadata-lang="go" track-metadata-snippet-file-url="https://github.com/GoogleCloudPlatform/golang-samples/blob//vertexai/function-calling/functioncalling.go" track-metadata-region-tag="generative-ai-function-calling-text">Vertex AI <span class="notranslate">Go</span> API reference documentation</a>. </p> <p> To authenticate to Vertex AI, set up Application Default Credentials. For more information, see <a href="/docs/authentication/provide-credentials-adc#local-dev">Set up authentication for a local development environment</a>. </p> <div class="github-docwidget-gitinclude-code"> <div></div><devsite-code><pre suppresswarning="suppresswarning" translate="no" class="devsite-click-to-copy" track-metadata-position="GoogleCloudPlatform/golang-samples/vertexai/function-calling/functioncalling.go/HEAD/generativeaionvertexai_function_calling_advanced" data-code-snippet="true" data-github-includecode-link="https://github.com/GoogleCloudPlatform/golang-samples/blob/HEAD/vertexai/function-calling/functioncalling.go" feedback-context="{&#34;language&#34;: &#34;golang&#34;, &#34;region_tag&#34;: &#34;generative-ai-function-calling-text&#34;, &#34;snippet_file_url&#34;: &#34;https://github.com/GoogleCloudPlatform/golang-samples/blob/HEAD/vertexai/function-calling/functioncalling.go&#34;}" feedback-product="1634365" feedback-bucket="cloud-ai" language="golang" data-github-path="GoogleCloudPlatform/golang-samples/vertexai/function-calling/functioncalling.go" data-git-revision="HEAD" data-region-tag="generativeaionvertexai_function_calling_advanced" dir="ltr" is-upgraded syntax="Go"><code translate="no" dir="ltr"><span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"context"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"encoding/json"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"errors"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"fmt"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"io"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"cloud.google.com/go/vertexai/genai"</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-c1">// functionCallsChat opens a chat session and sends 4 messages to the model:</span> <span class="devsite-syntax-c1">// - convert a first text question into a structured function call request</span> <span class="devsite-syntax-c1">// - convert the first structured function call response into natural language</span> <span class="devsite-syntax-c1">// - convert a second text question into a structured function call request</span> <span class="devsite-syntax-c1">// - convert the second structured function call response into natural language</span> <span class="devsite-syntax-kd">func</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">functionCallsChat</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">w</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">io</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Writer</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">projectID</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">location</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">modelName</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">string</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">error</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// location := "us-central1"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// modelName := "gemini-1.5-flash-001"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">ctx</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">:=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">context</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Background</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">client</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">:=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">genai</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">NewClient</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">ctx</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">projectID</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">location</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">!=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">nil</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">fmt</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Errorf</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"unable to create client: %w"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">defer</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">client</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Close</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">model</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">:=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">client</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">GenerativeModel</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">modelName</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Build an OpenAPI schema, in memory</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">paramsProduct</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">:=</span><span class="devsite-syntax-w"> </span>&amp;<span class="devsite-syntax-nx">genai</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Schema</span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">Type</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">genai</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">TypeObject</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">Properties</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">map</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-kt">string</span><span class="devsite-syntax-p">]</span><span class="devsite-syntax-o">*</span><span class="devsite-syntax-nx">genai</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Schema</span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"productName"</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">Type</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">genai</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">TypeString</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">Description</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"Product name"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">fundeclProductInfo</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">:=</span><span class="devsite-syntax-w"> </span>&amp;<span class="devsite-syntax-nx">genai</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">FunctionDeclaration</span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">Name</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"getProductSku"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">Description</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"Get the SKU for a product"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">Parameters</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">paramsProduct</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">paramsStore</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">:=</span><span class="devsite-syntax-w"> </span>&amp;<span class="devsite-syntax-nx">genai</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Schema</span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">Type</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">genai</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">TypeObject</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">Properties</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">map</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-kt">string</span><span class="devsite-syntax-p">]</span><span class="devsite-syntax-o">*</span><span class="devsite-syntax-nx">genai</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Schema</span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"location"</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">Type</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">genai</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">TypeString</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">Description</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"Location"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">fundeclStoreLocation</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">:=</span><span class="devsite-syntax-w"> </span>&amp;<span class="devsite-syntax-nx">genai</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">FunctionDeclaration</span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">Name</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"getStoreLocation"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">Description</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"Get the location of the closest store"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">Parameters</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">paramsStore</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">model</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Tools</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[]</span><span class="devsite-syntax-o">*</span><span class="devsite-syntax-nx">genai</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Tool</span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span><span class="devsite-syntax-nx">FunctionDeclarations</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[]</span><span class="devsite-syntax-o">*</span><span class="devsite-syntax-nx">genai</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">FunctionDeclaration</span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">fundeclProductInfo</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">fundeclStoreLocation</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">model</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">SetTemperature</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-mf">0.0</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">chat</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">:=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">model</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">StartChat</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Send a prompt for the first conversation turn that should invoke the getProductSku function</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">prompt</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">:=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"Do you have the Pixel 8 Pro in stock?"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">fmt</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Fprintf</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">w</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"Question: %s\n"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">prompt</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">resp</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">:=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">chat</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">SendMessage</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">ctx</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">genai</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Text</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">prompt</span><span class="devsite-syntax-p">))</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">!=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">nil</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nb">len</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">resp</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Candidates</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">==</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">0</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">||</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nb">len</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">resp</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Candidates</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-mi">0</span><span class="devsite-syntax-p">].</span><span class="devsite-syntax-nx">Content</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Parts</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">==</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">0</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">errors</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">New</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"empty response from model"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// The model has returned a function call to the declared function `getProductSku`</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// with a value for the argument `productName`.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">jsondata</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">:=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">json</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">MarshalIndent</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">resp</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Candidates</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-mi">0</span><span class="devsite-syntax-p">].</span><span class="devsite-syntax-nx">Content</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Parts</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-mi">0</span><span class="devsite-syntax-p">],</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"\t"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">" "</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">!=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">nil</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">fmt</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Errorf</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"json.MarshalIndent: %w"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">fmt</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Fprintf</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">w</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"function call generated by the model:\n\t%s\n"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nb">string</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">jsondata</span><span class="devsite-syntax-p">))</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Create a function call response, to simulate the result of a call to a</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// real service</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">funresp</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">:=</span><span class="devsite-syntax-w"> </span>&amp;<span class="devsite-syntax-nx">genai</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">FunctionResponse</span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">Name</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"getProductSku"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">Response</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">map</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-kt">string</span><span class="devsite-syntax-p">]</span><span class="devsite-syntax-kt">any</span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"sku"</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"GA04834-US"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"in_stock"</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"yes"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">jsondata</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">json</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">MarshalIndent</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">funresp</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"\t"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">" "</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">!=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">nil</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">fmt</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Errorf</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"json.MarshalIndent: %w"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">fmt</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Fprintf</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">w</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"function call response sent to the model:\n\t%s\n\n"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nb">string</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">jsondata</span><span class="devsite-syntax-p">))</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// And provide the function call response to the model</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">resp</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">chat</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">SendMessage</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">ctx</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">funresp</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">!=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">nil</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nb">len</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">resp</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Candidates</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">==</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">0</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">||</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nb">len</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">resp</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Candidates</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-mi">0</span><span class="devsite-syntax-p">].</span><span class="devsite-syntax-nx">Content</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Parts</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">==</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">0</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">errors</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">New</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"empty response from model"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// The model has taken the function call response as input, and has</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// reformulated the response to the user.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">jsondata</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">json</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">MarshalIndent</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">resp</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Candidates</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-mi">0</span><span class="devsite-syntax-p">].</span><span class="devsite-syntax-nx">Content</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Parts</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-mi">0</span><span class="devsite-syntax-p">],</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"\t"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">" "</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">!=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">nil</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">fmt</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Errorf</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"json.MarshalIndent: %w"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">fmt</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Fprintf</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">w</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"Answer generated by the model:\n\t%s\n\n"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nb">string</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">jsondata</span><span class="devsite-syntax-p">))</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Send a prompt for the second conversation turn that should invoke the getStoreLocation function</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">prompt2</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">:=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"Is there a store in Mountain View, CA that I can visit to try it out?"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">fmt</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Fprintf</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">w</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"Question: %s\n"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">prompt</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">resp</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">chat</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">SendMessage</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">ctx</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">genai</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Text</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">prompt2</span><span class="devsite-syntax-p">))</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">!=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">nil</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nb">len</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">resp</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Candidates</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">==</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">0</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">||</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nb">len</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">resp</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Candidates</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-mi">0</span><span class="devsite-syntax-p">].</span><span class="devsite-syntax-nx">Content</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Parts</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">==</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">0</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">errors</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">New</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"empty response from model"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// The model has returned a function call to the declared function `getStoreLocation`</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// with a value for the argument `store`.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">jsondata</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">json</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">MarshalIndent</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">resp</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Candidates</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-mi">0</span><span class="devsite-syntax-p">].</span><span class="devsite-syntax-nx">Content</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Parts</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-mi">0</span><span class="devsite-syntax-p">],</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"\t"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">" "</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">!=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">nil</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">fmt</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Errorf</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"json.MarshalIndent: %w"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">fmt</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Fprintf</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">w</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"function call generated by the model:\n\t%s\n"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nb">string</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">jsondata</span><span class="devsite-syntax-p">))</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Create a function call response, to simulate the result of a call to a</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// real service</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">funresp</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">=</span><span class="devsite-syntax-w"> </span>&amp;<span class="devsite-syntax-nx">genai</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">FunctionResponse</span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">Name</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"getStoreLocation"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">Response</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">map</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-kt">string</span><span class="devsite-syntax-p">]</span><span class="devsite-syntax-kt">any</span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"store"</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"2000 N Shoreline Blvd, Mountain View, CA 94043, US"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">jsondata</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">json</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">MarshalIndent</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">funresp</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"\t"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">" "</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">!=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">nil</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">fmt</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Errorf</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"json.MarshalIndent: %w"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">fmt</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Fprintf</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">w</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"function call response sent to the model:\n\t%s\n\n"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nb">string</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">jsondata</span><span class="devsite-syntax-p">))</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// And provide the function call response to the model</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">resp</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">chat</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">SendMessage</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">ctx</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">funresp</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">!=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">nil</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nb">len</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">resp</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Candidates</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">==</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">0</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">||</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nb">len</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">resp</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Candidates</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-mi">0</span><span class="devsite-syntax-p">].</span><span class="devsite-syntax-nx">Content</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Parts</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">==</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">0</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">errors</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">New</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"empty response from model"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// The model has taken the function call response as input, and has</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// reformulated the response to the user.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">jsondata</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">json</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">MarshalIndent</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">resp</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Candidates</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-mi">0</span><span class="devsite-syntax-p">].</span><span class="devsite-syntax-nx">Content</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Parts</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-mi">0</span><span class="devsite-syntax-p">],</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"\t"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">" "</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">!=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">nil</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">fmt</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Errorf</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"json.MarshalIndent: %w"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">fmt</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Fprintf</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">w</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"Answer generated by the model:\n\t%s\n\n"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nb">string</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">jsondata</span><span class="devsite-syntax-p">))</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">nil</span> <span class="devsite-syntax-p">}</span> </code></pre></devsite-code> </div> </section> <section> <h3 id="generative-ai-function-calling-text-nodejs" track-metadata-position="generative-ai-function-calling-text" track-metadata-region-tag="generative-ai-function-calling-text" data-text="Node.js" tabindex="-1"><span class="notranslate">Node.js</span></h3> <p> Before trying this sample, follow the <span class="notranslate">Node.js</span> setup instructions in the <a href="/vertex-ai/docs/start/client-libraries" track-type="clientLibrariesQuickstart" track-name="nodejs" track-metadata-snippet-file-url="https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob//generative-ai/snippets/function-calling/functionCallingStreamChat.js" track-metadata-position="generative-ai-function-calling-text">Vertex AI quickstart using client libraries</a>. For more information, see the <a href="/nodejs/docs/reference/aiplatform/latest" track-type="clientLibrariesUsage" track-name="clientLibrariesLink" track-metadata-lang="nodejs" track-metadata-snippet-file-url="https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob//generative-ai/snippets/function-calling/functionCallingStreamChat.js" track-metadata-region-tag="generative-ai-function-calling-text">Vertex AI <span class="notranslate">Node.js</span> API reference documentation</a>. </p> <p> To authenticate to Vertex AI, set up Application Default Credentials. For more information, see <a href="/docs/authentication/provide-credentials-adc#local-dev">Set up authentication for a local development environment</a>. </p> <div class="github-docwidget-gitinclude-code"> <div></div><devsite-code><pre suppresswarning="suppresswarning" translate="no" class="devsite-click-to-copy" track-metadata-position="GoogleCloudPlatform/nodejs-docs-samples/generative-ai/snippets/function-calling/functionCallingStreamChat.js/HEAD/generativeaionvertexai_gemini_function_calling_chat" data-code-snippet="true" data-github-includecode-link="https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/HEAD/generative-ai/snippets/function-calling/functionCallingStreamChat.js" feedback-context="{&#34;language&#34;: &#34;nodejs&#34;, &#34;region_tag&#34;: &#34;generative-ai-function-calling-text&#34;, &#34;snippet_file_url&#34;: &#34;https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/HEAD/generative-ai/snippets/function-calling/functionCallingStreamChat.js&#34;}" feedback-product="1634365" feedback-bucket="cloud-ai" language="nodejs" data-github-path="GoogleCloudPlatform/nodejs-docs-samples/generative-ai/snippets/function-calling/functionCallingStreamChat.js" data-git-revision="HEAD" data-region-tag="generativeaionvertexai_gemini_function_calling_chat" dir="ltr" is-upgraded syntax="JavaScript"><code translate="no" dir="ltr"><span class="devsite-syntax-kd">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">VertexAI</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">FunctionDeclarationSchemaType</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-p">}</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">require</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s1">'@google-cloud/vertexai'</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-kd">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">functionDeclarations</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">function_declarations</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">name</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'get_current_weather'</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">description</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'get weather in a given location'</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">parameters</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">type</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">FunctionDeclarationSchemaType</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">OBJECT</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">properties</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">location</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span><span class="devsite-syntax-nx">type</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">FunctionDeclarationSchemaType</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">STRING</span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">unit</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">type</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">FunctionDeclarationSchemaType</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">STRING</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kr">enum</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-s1">'celsius'</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'fahrenheit'</span><span class="devsite-syntax-p">],</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">required</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-s1">'location'</span><span class="devsite-syntax-p">],</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">],</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-p">];</span> <span class="devsite-syntax-kd">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">functionResponseParts</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">functionResponse</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">name</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'get_current_weather'</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">response</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span><span class="devsite-syntax-nx">name</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'get_current_weather'</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">content</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span><span class="devsite-syntax-nx">weather</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'super nice'</span><span class="devsite-syntax-p">}},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-p">];</span> <span class="devsite-syntax-cm">/**</span> <span class="devsite-syntax-cm"> * TODO(developer): Update these variables before running the sample.</span> <span class="devsite-syntax-cm"> */</span> <span class="devsite-syntax-k">async</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">function</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">functionCallingStreamChat</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">projectId</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'PROJECT_ID'</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">location</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'us-central1'</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">model</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'gemini-1.5-flash-001'</span> <span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Initialize Vertex with your Cloud project and location</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">vertexAI</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-ow">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">VertexAI</span><span class="devsite-syntax-p">({</span><span class="devsite-syntax-nx">project</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">projectId</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">location</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">location</span><span class="devsite-syntax-p">});</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Instantiate the model</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">generativeModel</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">vertexAI</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">getGenerativeModel</span><span class="devsite-syntax-p">({</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">model</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">model</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">});</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Create a chat session and pass your function declarations</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">chat</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">generativeModel</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">startChat</span><span class="devsite-syntax-p">({</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">tools</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">functionDeclarations</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">});</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">chatInput1</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'What is the weather in Boston?'</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// This should include a functionCall response from the model</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">result1</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">await</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">chat</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">sendMessageStream</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">chatInput1</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">for</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">await</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-kd">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">item</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">of</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">result1</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">stream</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">log</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">item</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">candidates</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-mf">0</span><span class="devsite-syntax-p">]);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">await</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">result1</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">response</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Send a follow up message with a FunctionResponse</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">result2</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">await</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">chat</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">sendMessageStream</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">functionResponseParts</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">for</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">await</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-kd">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">item</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">of</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">result2</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">stream</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">log</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">item</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">candidates</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-mf">0</span><span class="devsite-syntax-p">]);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// This should include a text response from the model using the response content</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// provided above</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">response2</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">await</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">result2</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">response</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">log</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">response2</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">candidates</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-mf">0</span><span class="devsite-syntax-p">].</span><span class="devsite-syntax-nx">content</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">parts</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-mf">0</span><span class="devsite-syntax-p">].</span><span class="devsite-syntax-nx">text</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-p">}</span></code></pre></devsite-code> </div> </section> </devsite-selector> </div> <h2 id="parallel-samples" data-text="Parallel function calling example" tabindex="-1">Parallel function calling example</h2> <p>For prompts such as &quot;Get weather details in New Delhi and San Francisco?&quot;, the model may propose several parallel function calls. For a list of models that support parallel function calling, see <a href="#supported_models">Supported models</a>.</p> <aside class="objective"> To learn about parallel function calling with an end-to-end Jupyter notebook tutorial, see <a href="https://github.com/GoogleCloudPlatform/generative-ai/blob/main/gemini/function-calling/parallel_function_calling.ipynb">Working with Parallel Function Calls and Multiple Function Responses in Gemini</a> </aside> <div class="ds-selector-tabs" data-ds-scope="code-sample"> <section><h3 id="rest_1" data-text=" REST " tabindex="-1"> REST </h3><p>This example demonstrates a scenario with one <code translate="no" dir="ltr">get_current_weather</code> function. The user prompt is &quot;Get weather details in New Delhi and San Francisco?&quot;. The model proposes two parallel <code translate="no" dir="ltr">get_current_weather</code> function calls: one with the parameter <code translate="no" dir="ltr">New Delhi</code> and the other with the parameter <code translate="no" dir="ltr">San Francisco</code>.</p> <p>To learn more about the parameters of the model request, see <a href="/vertex-ai/generative-ai/docs/model-reference/gemini">Gemini API</a>.</p> <div></div><devsite-code><pre translate="no" dir="ltr" is-upgraded> { "candidates": [ { "content": { "role": "model", "parts": [ { "functionCall": { "name": "get_current_weather", "args": { "location": "New Delhi" } } }, { "functionCall": { "name": "get_current_weather", "args": { "location": "San Francisco" } } } ] }, ... } ], ... } </pre></devsite-code> <p>The following command demonstrates how you can provide the function output to the model. Replace <var translate="no">my-project</var> with the name of your Google Cloud project.</p> <div> <devsite-expandable> <h4 class="showalways" id="model-request" data-text="Model request" tabindex="-1">Model request</h4> <div></div><devsite-code><pre class="devsite-click-to-copy" translate="no" dir="ltr" is-upgraded> PROJECT_ID=<var translate="no">my-project</var> MODEL_ID=gemini-1.5-pro-002 VERSION="v1" LOCATION="us-central1" ENDPOINT=${LOCATION}-aiplatform.googleapis.com API="generateContent" curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Content-Type: application/json" https://${ENDPOINT}/${VERSION}/projects/${PROJECT_ID}/locations/${LOCATION}/publishers/google/models/${MODEL_ID}:${API} -d '{ "contents": [ { "role": "user", "parts": { "text": "What is difference in temperature in New Delhi and San Francisco?" } }, { "role": "model", "parts": [ { "functionCall": { "name": "get_current_weather", "args": { "location": "New Delhi" } } }, { "functionCall": { "name": "get_current_weather", "args": { "location": "San Francisco" } } } ] }, { "role": "user", "parts": [ { "functionResponse": { "name": "get_current_weather", "response": { "temperature": 30.5, "unit": "C" } } }, { "functionResponse": { "name": "get_current_weather", "response": { "temperature": 20, "unit": "C" } } } ] } ], "tools": [ { "function_declarations": [ { "name": "get_current_weather", "description": "Get the current weather in a specific location", "parameters": { "type": "object", "properties": { "location": { "type": "string", "description": "The city and state, e.g. San Francisco, CA or a zip code e.g. 95616" } }, "required": [ "location" ] } } ] } ] }' </pre></devsite-code> </devsite-expandable> </div> <p>The natural language response created by the model is similar to the following:</p> <div> <devsite-expandable> <h4 class="showalways" id="model-response" data-text="Model response" tabindex="-1">Model response</h4> <div></div><devsite-code><pre class="devsite-click-to-copy" translate="no" dir="ltr" is-upgraded> [ { "candidates": [ { "content": { "parts": [ { "text": "The temperature in New Delhi is 30.5C and the temperature in San Francisco is 20C. The difference is 10.5C. \n" } ] }, "finishReason": "STOP", ... } ] ... } ] </pre></devsite-code> </devsite-expandable> </div></section> <section><h3 id="python_6" data-text=" Python " tabindex="-1"> Python </h3> <div class="github-docwidget-gitinclude-code"> <div></div><devsite-code><pre suppresswarning="suppresswarning" translate="no" class="devsite-click-to-copy" track-metadata-position="GoogleCloudPlatform/python-docs-samples/generative_ai/function_calling/parallel_function_calling_example.py/HEAD/generativeaionvertexai_function_calling_generate_parallel_calls" data-code-snippet="true" data-github-includecode-link="https://github.com/GoogleCloudPlatform/python-docs-samples/blob/HEAD/generative_ai/function_calling/parallel_function_calling_example.py" feedback-context="{&#34;language&#34;: &#34;python_vertex_ai_sdk&#34;, &#34;region_tag&#34;: &#34;generative-ai-function-calling-text&#34;, &#34;snippet_file_url&#34;: &#34;https://github.com/GoogleCloudPlatform/python-docs-samples/blob/HEAD/generative_ai/function_calling/parallel_function_calling_example.py&#34;}" feedback-product="1634365" feedback-bucket="cloud-ai" language="python_vertex_ai_sdk" data-github-path="GoogleCloudPlatform/python-docs-samples/generative_ai/function_calling/parallel_function_calling_example.py" data-git-revision="HEAD" data-region-tag="generativeaionvertexai_function_calling_generate_parallel_calls" dir="ltr" is-upgraded syntax="Python"><code translate="no" dir="ltr"><span class="devsite-syntax-kn">import</span> <span class="devsite-syntax-nn">vertexai</span> <span class="devsite-syntax-kn">from</span> <span class="devsite-syntax-nn">vertexai.generative_models</span> <span class="devsite-syntax-kn">import</span> <span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">FunctionDeclaration</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">GenerativeModel</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">Part</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">Tool</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-c1"># TODO(developer): Update &amp; uncomment below line</span> <span class="devsite-syntax-c1"># PROJECT_ID = "your-project-id"</span> <span class="devsite-syntax-c1"># Initialize Vertex AI</span> <span class="devsite-syntax-n">vertexai</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">init</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">project</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">PROJECT_ID</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">location</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-s2">"us-central1"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-c1"># Specify a function declaration and parameters for an API request</span> <span class="devsite-syntax-n">function_name</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-s2">"get_current_weather"</span> <span class="devsite-syntax-n">get_current_weather_func</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">FunctionDeclaration</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">name</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">function_name</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">description</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-s2">"Get the current weather in a given location"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">parameters</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-s2">"type"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-s2">"object"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-s2">"properties"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-p">{</span> <span class="devsite-syntax-s2">"location"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-p">{</span> <span class="devsite-syntax-s2">"type"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-s2">"string"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-s2">"description"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-s2">"The location for which to get the weather. </span><span class="devsite-syntax-se">\</span> <span class="devsite-syntax-s2"> It can be a city name, a city name and state, or a zip code. </span><span class="devsite-syntax-se">\</span> <span class="devsite-syntax-s2"> Examples: 'San Francisco', 'San Francisco, CA', '95616', etc."</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-p">},</span> <span class="devsite-syntax-p">},</span> <span class="devsite-syntax-p">},</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-c1"># In this example, we'll use synthetic data to simulate a response payload from an external API</span> <span class="devsite-syntax-k">def</span> <span class="devsite-syntax-nf">mock_weather_api_service</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">location</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">str</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-o">-</span>&gt; <span class="devsite-syntax-nb">str</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-n">temperature</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-mi">25</span> <span class="devsite-syntax-k">if</span> <span class="devsite-syntax-n">location</span> <span class="devsite-syntax-o">==</span> <span class="devsite-syntax-s2">"San Francisco"</span> <span class="devsite-syntax-k">else</span> <span class="devsite-syntax-mi">35</span> <span class="devsite-syntax-k">return</span> <span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"""</span>{{ "location": "{location}", "temperature": {temperature}, "unit": "C" }<span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"""</span> <span class="devsite-syntax-c1"># Define a tool that includes the above function</span> <span class="devsite-syntax-n">tools</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">Tool</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">function_declarations</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-n">get_current_weather_func</span><span class="devsite-syntax-p">],</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-c1"># Initialize Gemini model</span> <span class="devsite-syntax-n">model</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">GenerativeModel</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">model_name</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-s2">"gemini-1.5-pro-002"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">tools</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-n">tools</span><span class="devsite-syntax-p">],</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-c1"># Start a chat session</span> <span class="devsite-syntax-n">chat_session</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">model</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">start_chat</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-n">response</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">chat_session</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">send_message</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-s2">"Get weather details in New Delhi and San Francisco?"</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-n">function_calls</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">response</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">candidates</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-mi">0</span><span class="devsite-syntax-p">]</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">function_calls</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s2">"Suggested finction calls:</span><span class="devsite-syntax-se">\n</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">function_calls</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-k">if</span> <span class="devsite-syntax-n">function_calls</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-n">api_responses</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-p">[]</span> <span class="devsite-syntax-k">for</span> <span class="devsite-syntax-n">func</span> <span class="devsite-syntax-ow">in</span> <span class="devsite-syntax-n">function_calls</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-k">if</span> <span class="devsite-syntax-n">func</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">name</span> <span class="devsite-syntax-o">==</span> <span class="devsite-syntax-n">function_name</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-n">api_responses</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">append</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-p">{</span> <span class="devsite-syntax-s2">"content"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-n">mock_weather_api_service</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">location</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">func</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">args</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-s2">"location"</span><span class="devsite-syntax-p">]</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-p">}</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-c1"># Return the API response to Gemini</span> <span class="devsite-syntax-n">response</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">chat_session</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">send_message</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-p">[</span> <span class="devsite-syntax-n">Part</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">from_function_response</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">name</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-s2">"get_current_weather"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">response</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">api_responses</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-mi">0</span><span class="devsite-syntax-p">],</span> <span class="devsite-syntax-p">),</span> <span class="devsite-syntax-n">Part</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">from_function_response</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">name</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-s2">"get_current_weather"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">response</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">api_responses</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-mi">1</span><span class="devsite-syntax-p">],</span> <span class="devsite-syntax-p">),</span> <span class="devsite-syntax-p">],</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">response</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">text</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-c1"># Example response:</span> <span class="devsite-syntax-c1"># The current weather in New Delhi is 35°C. The current weather in San Francisco is 25°C.</span></code></pre></devsite-code> </div> </section> </div> <h2 id="best-practices" data-text="Best practices for function calling" tabindex="-1">Best practices for function calling</h2> <h3 id="function-name-bp" data-text="Function name" tabindex="-1">Function name</h3> <p>Function name should start with a letter or an underscore and contains only characters a-z, A-Z, 0-9, underscores, dots or dashes with a maximum length of 64.</p> <h3 id="function-description-bp" data-text="Function description" tabindex="-1">Function description</h3> <p>Write function descriptions clearly and verbosely. For example, for a <code translate="no" dir="ltr">book_flight_ticket</code> function:</p> <ul> <li>The following is an example of a good function description: <code translate="no" dir="ltr">book flight tickets after confirming users&#39; specific requirements, such as time, departure, destination, party size and preferred airline</code></li> <li>The following is an example of a bad function description: <code translate="no" dir="ltr">book flight ticket</code></li> </ul> <h3 id="function-parameters-bp" data-text="Function parameters" tabindex="-1">Function parameters</h3> <p>Function parameter and nested attribute names should start with a letter or an underscore and contains only characters a-z, A-Z, 0-9, or underscores with a maximum length of 64. Don&#39;t use period (<code translate="no" dir="ltr">.</code>), dash (<code translate="no" dir="ltr">-</code>), or space characters in the function parameter names and nested attributes. Instead, use underscore (<code translate="no" dir="ltr">_</code>) characters or any other characters.</p> <h4 id="descriptions" data-text="Descriptions" tabindex="-1">Descriptions</h4> <p>Write clear and verbose parameter descriptions, including details such as your preferred format or values. For example, for a <code translate="no" dir="ltr">book_flight_ticket</code> function:</p> <ul> <li>The following is a good example of a <code translate="no" dir="ltr">departure</code> parameter description: <code translate="no" dir="ltr">Use the 3 char airport code to represent the airport. For example, SJC or SFO. Don&#39;t use the city name.</code></li> <li>The following is a bad example of a <code translate="no" dir="ltr">departure</code> parameter description: <code translate="no" dir="ltr">the departure airport</code></li> </ul> <h4 id="types" data-text="Types" tabindex="-1">Types</h4> <p>If possible, use strongly typed parameters to reduce model hallucinations. For example, if the parameter values are from a finite set, add an <code translate="no" dir="ltr">enum</code> field instead of putting the set of values into the description. If the parameter value is always an integer, set the type to <code translate="no" dir="ltr">integer</code> rather than <code translate="no" dir="ltr">number</code>.</p> <h4 id="system_instructions" data-text="System instructions" tabindex="-1">System instructions</h4> <p>When using functions with date, time, or location parameters, include the current date, time, or relevant location information (for example, city and country) in the system instruction. This ensures the model has the necessary context to process the request accurately, even if the user&#39;s prompt lacks details.</p> <h3 id="prompt-bp" data-text="User prompt" tabindex="-1">User prompt</h3> <p>For best results, prepend the user prompt with the following details:</p> <ul> <li>Additional context for the model-for example, <code translate="no" dir="ltr">You are a flight API assistant to help with searching flights based on user preferences.</code></li> <li>Details or instructions on how and when to use the functions-for example, <code translate="no" dir="ltr">Don&#39;t make assumptions on the departure or destination airports. Always use a future date for the departure or destination time.</code></li> <li>Instructions to ask clarifying questions if user queries are ambiguous-for example, <code translate="no" dir="ltr">Ask clarifying questions if not enough information is available.</code></li> </ul> <h3 id="generation-config-bp" data-text="Generation configuration" tabindex="-1">Generation configuration</h3> <p>For the temperature parameter, use <code translate="no" dir="ltr">0</code> or another low value. This instructs the model to generate more confident results and reduces hallucinations.</p> <h3 id="invoke-api-bp" data-text="API invocation" tabindex="-1">API invocation</h3> <p>If the model proposes the invocation of a function that would send an order, update a database, or otherwise have significant consequences, validate the function call with the user before executing it.</p> <h2 id="pricing" data-text="Pricing" tabindex="-1">Pricing</h2> <p>The pricing for function calling is based on the number of characters within the text inputs and outputs. To learn more, see <a href="/vertex-ai/generative-ai/pricing">Vertex AI pricing</a>.</p> <p>Here, text input (prompt) refers to the user prompt for the current conversation turn, the function declarations for the current conversation turn, and the history of the conversation. The history of the conversation includes the queries, the function calls, and the function responses of previous conversation turns. Vertex AI truncates the history of the conversation at 32,000 characters.</p> <p>Text output (response) refers to the function calls and the text responses for the current conversation turn.</p> <h2 id="whats_next" data-text="What's next" tabindex="-1">What's next</h2> <ul> <li><p>See the <a href="/vertex-ai/generative-ai/docs/model-reference/function-calling">API reference for function calling</a>.</p></li> <li><p>Learn about <a href="/vertex-ai/generative-ai/docs/extensions/overview">Vertex AI extensions</a>.</p></li> <li><p>Learn about <a href="/vertex-ai/generative-ai/docs/reasoning-engine/overview">LangChain on Vertex AI</a>.</p></li> </ul> <devsite-hats-survey class="nocontent" hats-id="mwETRvWii0eU5NUYprb0Y9z5GVbc" listnr-id="83405"></devsite-hats-survey> </div> <devsite-thumb-rating position="footer"> </devsite-thumb-rating> <devsite-feedback position="footer" project-name="Generative AI on Vertex AI" product-id="5164350" bucket="Documentation" context="" version="t-devsite-webserver-20241114-r00-rc02.464922260396498922" data-label="Send Feedback Button" track-type="feedback" track-name="sendFeedbackLink" track-metadata-position="footer" class="nocontent" project-feedback-url="https://issuetracker.google.com/issues/new?component=1130925" project-icon="https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/cloud/images/favicons/onecloud/super_cloud.png" project-support-url="https://cloud.google.com/support-hub" > <button> Send feedback </button> </devsite-feedback> <div class="devsite-floating-action-buttons"> </div> </article> <devsite-content-footer class="nocontent"> <p>Except as otherwise noted, the content of this page is licensed under the <a href="https://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 License</a>, and code samples are licensed under the <a href="https://www.apache.org/licenses/LICENSE-2.0">Apache 2.0 License</a>. For details, see the <a href="https://developers.google.com/site-policies">Google Developers Site Policies</a>. Java is a registered trademark of Oracle and/or its affiliates.</p> <p>Last updated 2024-11-26 UTC.</p> </devsite-content-footer> <devsite-notification > </devsite-notification> <div class="devsite-content-data"> <template class="devsite-thumb-rating-feedback"> <devsite-feedback position="thumb-rating" project-name="Generative AI on Vertex AI" product-id="5164350" bucket="Documentation" context="" version="t-devsite-webserver-20241114-r00-rc02.464922260396498922" data-label="Send Feedback Button" track-type="feedback" track-name="sendFeedbackLink" track-metadata-position="thumb-rating" class="nocontent" project-feedback-url="https://issuetracker.google.com/issues/new?component=1130925" project-icon="https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/cloud/images/favicons/onecloud/super_cloud.png" project-support-url="https://cloud.google.com/support-hub" > <button> Need to tell us more? </button> </devsite-feedback> </template> <template class="devsite-content-data-template"> [[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-11-26 UTC."],[],[]] </template> </div> </devsite-content> </main> <devsite-footer-promos class="devsite-footer"> </devsite-footer-promos> <devsite-footer-linkboxes class="devsite-footer"> <nav class="devsite-footer-linkboxes nocontent" aria-label="Footer links"> <ul class="devsite-footer-linkboxes-list"> <li class="devsite-footer-linkbox "> <h3 class="devsite-footer-linkbox-heading no-link">Why Google</h3> <ul class="devsite-footer-linkbox-list"> <li class="devsite-footer-linkbox-item"> <a href="/why-google-cloud/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 1)" track-metadata-child_headline="why google"track-name="choosing google cloud"track-metadata-module="footer"track-type="footer link"track-metadata-eventDetail="cloud.google.com/why-google-cloud/"track-metadata-position="footer"> Choosing Google Cloud </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/trust-center/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 2)" track-type="footer link"track-metadata-eventDetail="cloud.google.com/security/"track-name="trust and security"track-metadata-module="footer"track-metadata-position="footer"track-metadata-child_headline="why google"> Trust and security </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/solutions/modern-infrastructure/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 3)" track-type="footer link"track-name="modern infrastructure cloud"track-metadata-module="footer"track-metadata-position="footer"track-metadata-child_headline="why google"track-metadata-eventDetail="cloud.google.com/solutions/modern-infrastructure/"> Modern Infrastructure Cloud </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/multicloud/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 4)" track-metadata-eventDetail="cloud.google.com/multicloud/"track-metadata-position="footer"track-name="multicloud"track-metadata-child_headline="why google"track-type="footer link"track-metadata-module="footer"> Multicloud </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/infrastructure/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 5)" track-metadata-position="footer"track-metadata-eventDetail="cloud.google.com/infrastructure/"track-metadata-child_headline="why google"track-type="footer link"track-metadata-module="footer"track-name="global infrastructure"> Global infrastructure </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/customers/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 6)" track-metadata-child_headline="why google"track-metadata-eventDetail="cloud.google.com/customers/"track-metadata-module="footer"track-metadata-position="footer"track-type="footer link"track-name="customers and case studies"> Customers and case studies </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/analyst-reports/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 7)" track-metadata-position="footer"track-metadata-module="footer"track-name="analyst reports"track-metadata-eventDetail="cloud.google.com/analyst-reports/"track-metadata-child_headline="why google"track-type="footer link"> Analyst reports </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/whitepapers/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 8)" track-name="whitepapers"track-metadata-module="footer"track-metadata-child_headline="why google"track-metadata-eventDetail="cloud.google.com/whitepapers/"track-metadata-position="footer"track-type="footer link"> Whitepapers </a> </li> <li class="devsite-footer-linkbox-item"> <a href="//cloud.google.com/blog/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 9)" track-name="blog"track-metadata-position="footer"track-type="footer link"track-metadata-eventDetail="cloud.google.com/blog/"track-metadata-child_headline="engage"track-metadata-module="footer"> Blog </a> </li> </ul> </li> <li class="devsite-footer-linkbox "> <h3 class="devsite-footer-linkbox-heading no-link">Products and pricing</h3> <ul class="devsite-footer-linkbox-list"> <li class="devsite-footer-linkbox-item"> <a href="/pricing/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 1)" track-metadata-position="footer"track-metadata-child_headline="products and pricing"track-type="footer link"track-name="google cloud pricing"track-metadata-module="footer"track-metadata-eventDetail="cloud.google.com/pricing/"> Google Cloud pricing </a> </li> <li class="devsite-footer-linkbox-item"> <a href="//workspace.google.com/pricing.html" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 2)" track-name="google workspace pricing"track-metadata-module="footer"track-metadata-eventDetail="workspace.google.com/pricing.html"track-metadata-position="footer"track-metadata-child_headline="products and pricing"target="_blank"track-type="footer link"> Google Workspace pricing </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/products/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 3)" track-metadata-module="footer"track-name="see all products"track-metadata-eventDetail="cloud.google.com/products/"track-metadata-child_headline="products and pricing"track-type="footer link"track-metadata-position="footer"> See all products </a> </li> </ul> </li> <li class="devsite-footer-linkbox "> <h3 class="devsite-footer-linkbox-heading no-link">Solutions</h3> <ul class="devsite-footer-linkbox-list"> <li class="devsite-footer-linkbox-item"> <a href="/solutions/infrastructure-modernization/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 1)" track-metadata-module="footer"track-metadata-eventDetail="cloud.google.com/solutions/infrastructure-modernization/"track-name="infrastructure modernization"track-metadata-position="footer"track-metadata-child_headline="solutions"track-type="footer link"> Infrastructure modernization </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/solutions/databases/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 2)" track-metadata-module="footer"track-metadata-eventDetail="cloud.google.com/solutions/databases"track-name="databases"track-metadata-position="footer"track-type="footer link"track-metadata-child_headline="solutions"> Databases </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/solutions/application-modernization/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 3)" track-metadata-child_headline="solutions"track-metadata-module="footer"track-type="footer link"track-name="application development"track-metadata-position="footer"track-metadata-eventDetail="cloud.google.com/solutions/application-modernization/"> Application modernization </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/solutions/smart-analytics/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 4)" track-metadata-child_headline="solutions"track-metadata-eventDetail="cloud.google.com/solutions/smart-analytics/"track-metadata-module="footer"track-metadata-position="footer"track-name="smart analytics"track-type="footer link"> Smart analytics </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/solutions/ai/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 5)" track-type="footer link"track-metadata-position="footer"track-metadata-child_headline="solutions"track-metadata-eventDetail="cloud.google.com/solutions/ai/"track-metadata-module="footer"track-name="artificial intelligence"> Artificial Intelligence </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/solutions/security/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 6)" track-metadata-module="footer"track-type="footer link"track-name="security"track-metadata-position="footer"track-metadata-eventDetail="cloud.google.com/solutions/security/"track-metadata-child_headline="solutions"> Security </a> </li> <li class="devsite-footer-linkbox-item"> <a href="https://workspace.google.com/enterprise/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 7)" track-type="footer link"track-metadata-child_headline="solutions"target="_blank"track-name="productivity and work transformation"track-metadata-position="footer"track-metadata-eventDetail="workspace.google.com/enterprise/"track-metadata-module="footer"> Productivity & work transformation </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/solutions/#industry-solutions" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 8)" track-type="footer link"track-metadata-position="footer"track-metadata-module="footer"track-name="industry solutions"track-metadata-eventDetail="cloud.google.com/solutions/#industry-solutions"track-metadata-child_headline="solutions"> Industry solutions </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/solutions/devops/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 9)" track-metadata-child_headline="solutions"track-metadata-module="footer"track-type="footer link"track-name="devops solutions"track-metadata-position="footer"track-metadata-eventDetail="cloud.google.com/solutions/devops/"> DevOps solutions </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/solutions/#section-14" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 10)" track-metadata-position="footer"track-type="footer link"track-metadata-module="footer"track-name="small business solutions"track-metadata-eventDetail="cloud.google.com/solutions/#section-14"track-metadata-child_headline="solutions"> Small business solutions </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/solutions/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 11)" track-metadata-eventDetail="cloud.google.com/solutions/"track-metadata-module="footer"track-type="footer link"track-name="see all solutions"track-metadata-position="footer"track-metadata-child_headline="solutions"> See all solutions </a> </li> </ul> </li> <li class="devsite-footer-linkbox "> <h3 class="devsite-footer-linkbox-heading no-link">Resources</h3> <ul class="devsite-footer-linkbox-list"> <li class="devsite-footer-linkbox-item"> <a href="/affiliate-program/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 1)" track-metadata-position="footer"track-metadata-eventDetail="cloud.google.com/affiliate-program/"track-metadata-module="footer"track-type="footer link"track-metadata-child_headline="resources"track-name="google cloud affiliate program"> Google Cloud Affiliate Program </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/docs/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 2)" track-metadata-child_headline="resources"track-name="google cloud documentation"track-metadata-eventDetail="cloud.google.com/docs/"track-metadata-module="footer"track-type="footer link"track-metadata-position="footer"> Google Cloud documentation </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/docs/get-started/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 3)" track-name="google cloud quickstarts"track-metadata-position="footer"track-metadata-module="footer"track-metadata-child_headline="resources"track-metadata-eventDetail="cloud.google.com/docs/get-started/"track-type="footer link"> Google Cloud quickstarts </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/marketplace/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 4)" track-type="footer link"track-name="google cloud marketplace"track-metadata-eventDetail="cloud.google.com/marketplace/"track-metadata-module="footer"track-metadata-position="footer"track-metadata-child_headline="resources"> Google Cloud Marketplace </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/discover/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 5)" track-name="learn about cloud computing"track-type="footer link"track-metadata-module="footer"track-metadata-position="footer"track-metadata-eventDetail="learn/"track-metadata-child_headline="resources"> Learn about cloud computing </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/support-hub/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 6)" track-metadata-child_headline="resources"track-type="footer link"track-metadata-module="footer"track-name="support"track-metadata-eventDetail="cloud.google.com/support-hub/"track-metadata-position="footer"> Support </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/docs/samples" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 7)" track-metadata-module="footer"track-metadata-eventDetail="cloud.google.com/docs/samples"track-metadata-position="footer"track-metadata-child_headline="resources"track-type="footer link"track-name="code samples"> Code samples </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/architecture/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 8)" track-type="footer link"track-metadata-module="footer"track-metadata-position="footer"track-name="cloud architecture center"track-metadata-child_headline="resources"track-metadata-eventDetail="cloud.google.com/architecture/"> Cloud Architecture Center </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/learn/training/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 9)" track-metadata-module="footer"track-metadata-position="footer"track-name="training"track-type="footer link"track-metadata-child_headline="resources"track-metadata-eventDetail="cloud.google.com/training/"> Training </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/learn/certification/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 10)" track-type="footer link"track-metadata-module="footer"track-metadata-child_headline="resources"track-metadata-position="footer"track-metadata-eventDetail="cloud.google.com/certification"track-name="certifications"> Certifications </a> </li> <li class="devsite-footer-linkbox-item"> <a href="//developers.google.com" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 11)" track-name="google developers"track-metadata-eventDetail="developers.google.com"track-metadata-position="footer"target="_blank"track-type="footer link"track-metadata-module="footer"track-metadata-child_headline="resources"> Google for Developers </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/startup/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 12)" track-name="google cloud for startups"track-metadata-eventDetail="cloud.google.com/startup/"track-type="footer link"track-metadata-child_headline="resources"track-metadata-module="footer"track-metadata-position="footer"> Google Cloud for Startups </a> </li> <li class="devsite-footer-linkbox-item"> <a href="//status.cloud.google.com" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 13)" track-type="footer link"track-name="system status"track-metadata-position="footer"track-metadata-module="footer"track-metadata-child_headline="resources"target="_blank"track-metadata-eventDetail="status.cloud.google.com"> System status </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/release-notes" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 14)" track-name="release notes"track-type="footer link"track-metadata-position="footer"track-metadata-eventDetail="cloud.google.com/release-notes/"track-metadata-child_headline="resources"track-metadata-module="footer"> Release Notes </a> </li> </ul> </li> <li class="devsite-footer-linkbox "> <h3 class="devsite-footer-linkbox-heading no-link">Engage</h3> <ul class="devsite-footer-linkbox-list"> <li class="devsite-footer-linkbox-item"> <a href="/contact/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 1)" track-metadata-eventDetail="cloud.google.com/contact/"track-name="contact sales"track-type="footer link"track-metadata-position="footer"track-metadata-module="footer"track-metadata-child_headline="engage"> Contact sales </a> </li> <li class="devsite-footer-linkbox-item"> <a href="//cloud.google.com/find-a-partner" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 2)" track-type="footer link"track-metadata-position="footer"track-name="find a partner"track-metadata-eventDetail="cloud.google.com/find-a-partner"target="_blank"track-metadata-child_headline="engage"track-metadata-module="footer"> Find a Partner </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/partners/become-a-partner/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 3)" track-metadata-position="footer"track-metadata-module="footer"track-name="become a partner"track-metadata-eventDetail="cloud.google.com/partners/become-a-partner/"track-metadata-child_headline="engage"track-type="footer link"> Become a Partner </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/events/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 4)" track-metadata-child_headline="engage"track-metadata-module="footer"track-metadata-eventDetail="cloud.withgoogle.com/events"track-metadata-position="footer"track-name="events"track-type="footer link"> Events </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/podcasts/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 5)" track-name="podcasts"track-metadata-position="footer"track-metadata-module="footer"target="_blank"track-metadata-eventDetail="cloud.google.com/podcasts/"track-type="footer link"rel="noopener"track-metadata-child_headline="engage"> Podcasts </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/developers/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 6)" track-metadata-module="footer"track-name="developer center"track-metadata-position="footer"track-metadata-child_headline="engage"track-metadata-eventDetail="cloud.google.com/developers/"track-type="footer link"> Developer Center </a> </li> <li class="devsite-footer-linkbox-item"> <a href="https://www.googlecloudpresscorner.com/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 7)" rel="noopener"track-name="press corner"track-metadata-module="footer"target="_blank"track-metadata-position="footer"track-metadata-eventDetail="www.googlecloudpresscorner.com"track-type="footer link"track-metadata-child_headline="engage"> Press Corner </a> </li> <li class="devsite-footer-linkbox-item"> <a href="//www.youtube.com/googlecloud" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 8)" track-metadata-position="footer"track-type="footer link"track-metadata-eventDetail="www.youtube.com/googlecloud"rel="noopener"track-metadata-module="footer"target="_blank"track-name="google cloud on youtube"track-metadata-child_headline="engage"> Google Cloud on YouTube </a> </li> <li class="devsite-footer-linkbox-item"> <a href="//www.youtube.com/googlecloudplatform" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 9)" target="_blank"track-metadata-child_headline="engage"track-metadata-module="footer"track-name="google cloud tech on youtube"rel="noopener"track-type="footer link"track-metadata-position="footer"track-metadata-eventDetail="www.youtube.com/googlecloudplatform"> Google Cloud Tech on YouTube </a> </li> <li class="devsite-footer-linkbox-item"> <a href="//x.com/googlecloud" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 10)" track-metadata-position="footer"track-metadata-module="footer"rel="noopener"track-metadata-eventDetail="x.com/googlecloud"track-metadata-child_headline="engage"track-type="footer link"track-name="follow on x"target="_blank"> Follow on X </a> </li> <li class="devsite-footer-linkbox-item"> <a href="//userresearch.google.com/?reserved=1&amp;utm_source=website&amp;Q_Language=en&amp;utm_medium=own_srch&amp;utm_campaign=CloudWebFooter&amp;utm_term=0&amp;utm_content=0&amp;productTag=clou&amp;campaignDate=jul19&amp;pType=devel&amp;referral_code=jk212693" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 11)" track-metadata-eventDetail="userresearch.google.com/?reserved=1&amp;utm_source=website&amp;Q_Language=en&amp;utm_medium=own_srch&amp;utm_campaign=CloudWebFooter&amp;utm_term=0&amp;utm_content=0&amp;productTag=clou&amp;campaignDate=jul19&amp;pType=devel&amp;referral_code=jk212693"track-metadata-module="footer"track-type="footer link"track-metadata-child_headline="engage"target="_blank"track-metadata-position="footer"track-name="join user research"> Join User Research </a> </li> <li class="devsite-footer-linkbox-item"> <a href="//careers.google.com/cloud" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 12)" track-metadata-eventDetail="careers.google.com/cloud"track-metadata-module="footer"target="_blank"track-metadata-position="footer"track-name="we are hiring join google cloud"track-type="footer link"track-metadata-child_headline="engage"> We're hiring. Join Google Cloud! </a> </li> <li class="devsite-footer-linkbox-item"> <a href="https://www.googlecloudcommunity.com/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 13)" track-metadata-eventDetail="www.googlecloudcommunity.com"track-name="google cloud community"track-type="footer link"target="_blank"track-metadata-position="footer"track-metadata-module="footer"track-metadata-child_headline="engage"rel="noopener"> Google Cloud Community </a> </li> </ul> </li> </ul> </nav> </devsite-footer-linkboxes> <devsite-footer-utility class="devsite-footer"> <div class="devsite-footer-utility nocontent"> <nav class="devsite-footer-utility-links" aria-label="Utility links"> <ul class="devsite-footer-utility-list"> <li class="devsite-footer-utility-item "> <a class="devsite-footer-utility-link gc-analytics-event" href="//about.google/" data-category="Site-Wide Custom Events" data-label="Footer About Google link" track-metadata-module="utility footer" track-type="footer link" track-name="about google" track-metadata-position="footer" track-metadata-eventDetail="//about.google/" target="_blank" > About Google </a> </li> <li class="devsite-footer-utility-item devsite-footer-privacy-link"> <a class="devsite-footer-utility-link gc-analytics-event" href="//policies.google.com/privacy" data-category="Site-Wide Custom Events" data-label="Footer Privacy link" target="_blank" track-metadata-module="utility footer" track-type="footer link" track-name="privacy" track-metadata-eventDetail="//policies.google.com/privacy" track-metadata-position="footer" > Privacy </a> </li> <li class="devsite-footer-utility-item "> <a class="devsite-footer-utility-link gc-analytics-event" href="//www.google.com/intl/en/policies/terms/regional.html" data-category="Site-Wide Custom Events" data-label="Footer Site terms link" track-metadata-position="footer" track-metadata-module="utility footer" track-type="footer link" track-metadata-eventDetail="//www.google.com/intl/en/policies/terms/regional.html" track-name="site terms" target="_blank" > Site terms </a> </li> <li class="devsite-footer-utility-item "> <a class="devsite-footer-utility-link gc-analytics-event" href="/product-terms/" data-category="Site-Wide Custom Events" data-label="Footer Google Cloud terms link" track-metadata-position="footer" track-type="footer link" track-metadata-eventDetail="/product-terms/" track-metadata-module="utility footer" track-name="google cloud terms" > Google Cloud terms </a> </li> <li class="devsite-footer-utility-item glue-cookie-notification-bar-control"> <a class="devsite-footer-utility-link gc-analytics-event" href="#" data-category="Site-Wide Custom Events" data-label="Footer Manage cookies link" track-metadata-module="utility footer" track-metadata-eventDetail="#" track-name="Manage cookies" aria-hidden="true" track-type="footer link" track-metadata-position="footer" > Manage cookies </a> </li> <li class="devsite-footer-utility-item devsite-footer-carbon-button"> <a class="devsite-footer-utility-link gc-analytics-event" href="/sustainability" data-category="Site-Wide Custom Events" data-label="Footer Our third decade of climate action: join us link" track-type="footer link" track-metadata-position="footer" track-metadata-module="utility footer" track-metadata-eventDetail="/sustainability/" track-name="Our third decade of climate action: join us" > Our third decade of climate action: join us </a> </li> <li class="devsite-footer-utility-item devsite-footer-utility-button"> <span class="devsite-footer-utility-description">Sign up for the Google Cloud newsletter</span> <a class="devsite-footer-utility-link gc-analytics-event" href="/newsletter/" data-category="Site-Wide Custom Events" data-label="Footer Subscribe link" track-name="subscribe" track-metadata-module="utility footer" track-type="footer link" track-metadata-eventDetail="/newsletter/" track-metadata-position="footer" > Subscribe </a> </li> </ul> <devsite-language-selector> <ul role="presentation"> <li role="presentation"> <a role="menuitem" lang="en" >English</a> </li> <li role="presentation"> <a role="menuitem" lang="de" >Deutsch</a> </li> <li role="presentation"> <a role="menuitem" lang="es_419" >Español – América Latina</a> </li> <li role="presentation"> <a role="menuitem" lang="fr" >Français</a> </li> <li role="presentation"> <a role="menuitem" lang="id" >Indonesia</a> </li> <li role="presentation"> <a role="menuitem" lang="it" >Italiano</a> </li> <li role="presentation"> <a role="menuitem" lang="pt_br" >Português – Brasil</a> </li> <li role="presentation"> <a role="menuitem" lang="zh_cn" >中文 – 简体</a> </li> <li role="presentation"> <a role="menuitem" lang="ja" >日本語</a> </li> <li role="presentation"> <a role="menuitem" lang="ko" >한국어</a> </li> </ul> </devsite-language-selector> </nav> </div> </devsite-footer-utility> <devsite-panel></devsite-panel> </section></section> <devsite-sitemask></devsite-sitemask> <devsite-snackbar></devsite-snackbar> <devsite-tooltip ></devsite-tooltip> <devsite-heading-link></devsite-heading-link> <devsite-analytics> <script type="application/json" analytics>[]</script> <script type="application/json" tag-management>{&#34;at&#34;: &#34;True&#34;, &#34;ga4&#34;: [], &#34;ga4p&#34;: [], &#34;gtm&#34;: [{&#34;id&#34;: &#34;GTM-5CVQBG&#34;, &#34;purpose&#34;: 1}], &#34;parameters&#34;: {&#34;internalUser&#34;: &#34;False&#34;, &#34;language&#34;: {&#34;machineTranslated&#34;: &#34;False&#34;, &#34;requested&#34;: &#34;en&#34;, &#34;served&#34;: &#34;en&#34;}, &#34;pageType&#34;: &#34;article&#34;, &#34;projectName&#34;: &#34;Generative AI on Vertex AI&#34;, &#34;signedIn&#34;: &#34;False&#34;, &#34;tenant&#34;: &#34;cloud&#34;, &#34;recommendations&#34;: {&#34;sourcePage&#34;: &#34;&#34;, &#34;sourceType&#34;: 0, &#34;sourceRank&#34;: 0, &#34;sourceIdenticalDescriptions&#34;: 0, &#34;sourceTitleWords&#34;: 0, &#34;sourceDescriptionWords&#34;: 0, &#34;experiment&#34;: &#34;&#34;}, &#34;experiment&#34;: {&#34;ids&#34;: &#34;&#34;}}}</script> </devsite-analytics> <devsite-badger></devsite-badger> <cloudx-user></cloudx-user> <cloudx-free-trial-eligible-store freeTrialEligible='true'></cloudx-free-trial-eligible-store> <cloudx-pricing-socket></cloudx-pricing-socket> <cloudx-experiments type="TestAACodivertedExperiment" path="/virtual/TestAACodivertedExperiment/configureExperiment" location="SG" variant="variant2" ></cloudx-experiments> <cloudx-experiment-ids userCountry="SG" devsiteExperimentIdList="[39300012, 39300021, 39300118, 39300195, 39300241, 39300319, 39300320, 39300326, 39300346, 39300354, 39300363, 39300374, 39300412, 39300422, 39300436, 39300473, 39300488, 39300496, 39300498]"> </cloudx-experiment-ids> <script nonce="eUmYBT1srVu8d5bqMCIzbLdCyALjAd"> (function(d,e,v,s,i,t,E){d['GoogleDevelopersObject']=i; t=e.createElement(v);t.async=1;t.src=s;E=e.getElementsByTagName(v)[0]; E.parentNode.insertBefore(t,E);})(window, document, 'script', 'https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/cloud/js/app_loader.js', '[2,"en",null,"/js/devsite_app_module.js","https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625","https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/cloud","https://cloud-dot-devsite-v2-prod.appspot.com",null,null,["/_pwa/cloud/manifest.json","https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/images/video-placeholder.svg","https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/cloud/images/favicons/onecloud/favicon.ico","https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/cloud/images/cloud-logo.svg","https://fonts.googleapis.com/css?family=Google+Sans:400,500,700|Google+Sans+Text:400,400italic,500,500italic,700,700italic|Roboto:400,400italic,500,500italic,700,700italic|Roboto+Mono:400,500,700&display=swap"],1,null,[1,6,8,12,14,17,21,25,50,52,63,70,75,76,80,87,91,92,93,97,98,100,101,102,103,104,105,107,108,109,110,112,113,116,117,118,120,122,124,125,126,127,129,130,131,132,133,134,135,136,138,140,141,147,148,149,151,152,156,157,158,159,161,163,164,168,169,170,179,180,182,183,186,191,193,196],"AIzaSyAP-jjEJBzmIyKR4F-3XITp8yM9T1gEEI8","AIzaSyB6xiKGDR5O3Ak2okS4rLkauxGUG7XP0hg","cloud.google.com","AIzaSyAQk0fBONSGUqCNznf6Krs82Ap1-NV6J4o","AIzaSyCCxcqdrZ_7QMeLCRY20bh_SXdAYqy70KY",null,null,null,["Search__enable_suggestions_from_borg","Cloud__enable_cloud_shell","Profiles__enable_complete_playlist_endpoint","MiscFeatureFlags__enable_variable_operator","Profiles__enable_dashboard_curated_recommendations","Cloud__enable_cloudx_ping","MiscFeatureFlags__enable_project_variables","MiscFeatureFlags__developers_footer_dark_image","CloudShell__cloud_shell_button","Search__enable_ai_search_summaries","MiscFeatureFlags__developers_footer_image","Cloud__enable_free_trial_server_call","Search__scope_to_project_tenant","Profiles__enable_awarding_url","MiscFeatureFlags__emergency_css","Profiles__enable_recognition_badges","Concierge__enable_pushui","DevPro__enable_cloud_innovators_plus","EngEduTelemetry__enable_engedu_telemetry","Cloud__enable_legacy_calculator_redirect","Profiles__enable_page_saving","Search__enable_dynamic_content_confidential_banner","Profiles__enable_release_notes_notifications","Search__enable_page_map","Profiles__enable_developer_profiles_callout","MiscFeatureFlags__enable_firebase_utm","Profiles__enable_profile_collections","Concierge__enable_concierge_restricted","TpcFeatures__enable_required_headers","DevPro__enable_developer_subscriptions","BookNav__enable_tenant_cache_key","MiscFeatureFlags__enable_view_transitions","Cloud__enable_cloudx_experiment_ids","Profiles__enable_public_developer_profiles","Search__enable_ai_eligibility_checks","Search__enable_ai_search_summaries_restricted","Experiments__reqs_query_experiments","CloudShell__cloud_code_overflow_menu","Profiles__require_profile_eligibility_for_signin","Cloud__enable_cloud_shell_fte_user_flow","TpcFeatures__enable_mirror_tenant_redirects","Cloud__enable_cloud_facet_chat","MiscFeatureFlags__enable_explain_this_code","Analytics__enable_clearcut_logging","Profiles__enable_completecodelab_endpoint","Cloud__enable_cloud_dlp_service","Cloud__enable_llm_concierge_chat"],null,null,"AIzaSyBLEMok-5suZ67qRPzx0qUtbnLmyT_kCVE","https://developerscontentserving-pa.clients6.google.com","AIzaSyCM4QpTRSqP5qI4Dvjt4OAScIN8sOUlO-k","https://developerscontentsearch-pa.clients6.google.com",1,4,1,"https://developerprofiles-pa.clients6.google.com",[2,"cloud","Google Cloud","cloud.google.com",null,"cloud-dot-devsite-v2-prod.appspot.com",null,null,[1,1,null,null,null,null,null,null,null,null,null,[1],null,null,null,null,null,1,[1],[null,null,null,[1,20],"/terms/recommendations"],[1],null,[1],[1,null,1],[1,1,null,null,1,null,["/vertex-ai/"]]],null,[22,null,null,null,null,null,"/images/cloud-logo.svg","/images/favicons/onecloud/apple-icon.png",null,null,null,null,1,1,1,[6,5],[],null,null,[[],[],[],[],[],[],[],[]],null,1,null,null,null,null,[]],[],null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,[6,1,14,15,22,23,29,37],null,[[null,null,null,null,null,null,[1,[["docType","Choose a content type",[["ApiReference",null,null,null,null,null,null,null,null,"API reference"],["Sample",null,null,null,null,null,null,null,null,"Code sample"],["ReferenceArchitecture",null,null,null,null,null,null,null,null,"Reference architecture"],["Tutorial",null,null,null,null,null,null,null,null,"Tutorial"]]],["category","Choose a topic",[["AiAndMachineLearning",null,null,null,null,null,null,null,null,"Artificial intelligence and machine learning (AI/ML)"],["ApplicationDevelopment",null,null,null,null,null,null,null,null,"Application development"],["BigDataAndAnalytics",null,null,null,null,null,null,null,null,"Big data and analytics"],["Compute",null,null,null,null,null,null,null,null,"Compute"],["Containers",null,null,null,null,null,null,null,null,"Containers"],["Databases",null,null,null,null,null,null,null,null,"Databases"],["HybridCloud",null,null,null,null,null,null,null,null,"Hybrid and multicloud"],["LoggingAndMonitoring",null,null,null,null,null,null,null,null,"Logging and monitoring"],["Migrations",null,null,null,null,null,null,null,null,"Migrations"],["Networking",null,null,null,null,null,null,null,null,"Networking"],["SecurityAndCompliance",null,null,null,null,null,null,null,null,"Security and compliance"],["Serverless",null,null,null,null,null,null,null,null,"Serverless"],["Storage",null,null,null,null,null,null,null,null,"Storage"]]]]]],[1],null,1],[[null,null,null,null,null,["GTM-5CVQBG"],null,null,null,null,null,[["GTM-5CVQBG",2]],1],null,null,null,null,null,1],"mwETRvWii0eU5NUYprb0Y9z5GVbc",4,null,null,null,null,null,null,null,null,null,null,null,null,null,"cloud.devsite.google"],null,"pk_live_5170syrHvgGVmSx9sBrnWtA5luvk9BwnVcvIi7HizpwauFG96WedXsuXh790rtij9AmGllqPtMLfhe2RSwD6Pn38V00uBCydV4m"]') </script> <devsite-a11y-announce></devsite-a11y-announce> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10