|
@@ -27,8 +27,16 @@
|
|
|
"\n",
|
|
|
"# **Objectives**\n",
|
|
|
"\n",
|
|
|
- "In this tutorial, you will learn how to use either OpenAI SDK or Vertex AI SDK in Python to make function calls via the Llama 4 Maverick model on Vertex AI. We will use a currency exchange function as an example, you can replace it with another function with the right functionality for you.\n",
|
|
|
- "This tutorial is based on this Vertex AI codelab: https://codelabs.developers.google.com/codelabs/gemini-function-calling"
|
|
|
+ "In this tutorial, you will learn how to use either OpenAI SDK or Vertex AI SDK in Python to make function calls via the Llama 4 Maverick fully managed model on Vertex AI.\n",
|
|
|
+ " See here for more info on using the [OpenAI SDK with Vertex](https://cloud.google.com/vertex-ai/generative-ai/docs/migrate/openai/overview#:~:text=The%20Chat%20Completions%20API%20works,the%20Google%20Gen%20AI%20SDK.), as well as recommendations on when to use OpenAI SDK vs. Vertex AI SDK.\n",
|
|
|
+ "\n",
|
|
|
+ "We will use a currency exchange function as an example, you can replace it with another function with the right functionality for you.\n",
|
|
|
+ "This tutorial is based on this Vertex AI codelab: https://codelabs.developers.google.com/codelabs/gemini-function-calling\n",
|
|
|
+ "\n",
|
|
|
+ "# **Setup and Relevant Links**\n",
|
|
|
+ "Llama on Vertex AI (fully managed): https://cloud.google.com/vertex-ai/generative-ai/docs/partner-models/llama\n",
|
|
|
+ "\n",
|
|
|
+ "Official docs from Vertex on tool calling with Llama coming soon.\n"
|
|
|
],
|
|
|
"metadata": {
|
|
|
"id": "JIVs8gXB1Auw"
|
|
@@ -76,7 +84,7 @@
|
|
|
"if not project_id or project_id == \"[your-project-id]\":\n",
|
|
|
" project_id = str(os.environ.get(\"GOOGLE_CLOUD_PROJECT\"))\n",
|
|
|
"\n",
|
|
|
- "location = os.environ.get(\"GOOGLE_CLOUD_REGION\", \"us-central1\")\n",
|
|
|
+ "location = os.environ.get(\"GOOGLE_CLOUD_REGION\", \"us-east5\")\n",
|
|
|
"\n",
|
|
|
"# run gcloud auth print-access-token from terminal to get this\n",
|
|
|
"access_token = \"\"\n",
|
|
@@ -465,6 +473,25 @@
|
|
|
]
|
|
|
}
|
|
|
]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "cell_type": "markdown",
|
|
|
+ "source": [
|
|
|
+ "# **Congrats and conclusion**\n",
|
|
|
+ "\n",
|
|
|
+ "Leveraging function calling via Llama 4 in Vertex AI, you've successfully built a generative AI pipeline that uses the OpenAI and/or Vertex AI SDK! Users can ask about exchange rates, and the system will fetch the latest data from an external API and respond with an answer.\n",
|
|
|
+ "\n",
|
|
|
+ "Given a prompt from an end-user, Llama takes care of selecting the appropriate function, extracting parameters from the prompt, and returning a structured data object for you to make an external API call.\n",
|
|
|
+ "\n",
|
|
|
+ "\n",
|
|
|
+ "# **Cleanup**\n",
|
|
|
+ "You can perform the following cleanup to avoid incurring charges to your Google Cloud account for the resources used in this codelab:\n",
|
|
|
+ "* To avoid unnecessary Google Cloud charges, use the Google Cloud console to delete your project if you do not need it.\n",
|
|
|
+ "* If you want to disable the APIs for Vertex AI, navigate to the Vertex AI API Service Details page and click Disable API and confirm.\n"
|
|
|
+ ],
|
|
|
+ "metadata": {
|
|
|
+ "id": "pT9Cf6TtAgX7"
|
|
|
+ }
|
|
|
}
|
|
|
]
|
|
|
}
|