From 1f26cad634299abb6bd160dfc9dc5d0f0685a2e0 Mon Sep 17 00:00:00 2001 From: Shilpa Kancharla Date: Wed, 18 Dec 2024 13:51:49 -0500 Subject: [PATCH 1/2] Update links in get_started.ipynb --- gemini-2/get_started.ipynb | 115 ++++++++++++++++++++++++------------- 1 file changed, 74 insertions(+), 41 deletions(-) diff --git a/gemini-2/get_started.ipynb b/gemini-2/get_started.ipynb index 2374a7ad2..2eb19c371 100644 --- a/gemini-2/get_started.ipynb +++ b/gemini-2/get_started.ipynb @@ -11,7 +11,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "metadata": { "cellView": "form", "id": "9r9Ggw012g9c" @@ -98,7 +98,8 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "46zEFO2a9FFd" + "id": "46zEFO2a9FFd", + "outputId": "8a605a60-5360-41c5-f27f-271013b38189" }, "outputs": [ { @@ -203,7 +204,8 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "T8md0ayAJ-RZ" + "id": "T8md0ayAJ-RZ", + "outputId": "b69b68f1-78e0-49b0-a71b-a327117234a2" }, "outputs": [ { @@ -241,7 +243,8 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "Z7WFm928wEYR" + "id": "Z7WFm928wEYR", + "outputId": "c4d598a2-c6f4-4e68-fcfe-30bc30e5293f" }, "outputs": [ { @@ -276,7 +279,8 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "bQ3zu5udSBuD" + "id": "bQ3zu5udSBuD", + "outputId": "163383a1-34ad-4562-bf5a-554e02c00e72" }, "outputs": [ { @@ -307,7 +311,8 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "cDxd7Pp_SELb" + "id": "cDxd7Pp_SELb", + "outputId": "35b1333b-ac28-4d25-fad6-4ca45e18e51c" }, "outputs": [ { @@ -379,14 +384,15 @@ "source": [ "## Configure model parameters\n", "\n", - "You can include parameter values in each call that you send to a model to control how the model generates a response. Learn more about [experimenting with parameter values](https://cloud.google.com/vertex-ai/generative-ai/docs/learn/prompts/adjust-parameter-values)." + "You can include parameter values in each call that you send to a model to control how the model generates a response. Learn more about [experimenting with parameter values](https://ai.google.dev/gemini-api/docs/text-generation?lang=node#configure)." ] }, { "cell_type": "code", "execution_count": null, "metadata": { - "id": "r5izy6jsbEnL" + "id": "r5izy6jsbEnL", + "outputId": "a2e8bc03-5312-47fa-e81d-7216991c3f6b" }, "outputs": [ { @@ -431,14 +437,15 @@ "source": [ "## Configure safety filters\n", "\n", - "The Gemini API provides safety filters that you can adjust across multiple filter categories to restrict or allow certain types of content. You can use these filters to adjust what's appropriate for your use case. See the [Configure safety filters](https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/configure-safety-filters) page for details." + "The Gemini API provides safety filters that you can adjust across multiple filter categories to restrict or allow certain types of content. You can use these filters to adjust what's appropriate for your use case. See the [Configure safety filters](https://ai.google.dev/gemini-api/docs/safety-settings) page for details." ] }, { "cell_type": "code", "execution_count": null, "metadata": { - "id": "SJIvAfMqbzQL" + "id": "SJIvAfMqbzQL", + "outputId": "69cc68b6-125c-4c4a-fc3d-65ef35e422ec" }, "outputs": [ { @@ -528,7 +535,8 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "SnzMJJ-adOfX" + "id": "SnzMJJ-adOfX", + "outputId": "a6d7f14e-7a4d-4f86-96e0-6205fba1b16b" }, "outputs": [ { @@ -608,7 +616,8 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "9qAObeZMdgln" + "id": "9qAObeZMdgln", + "outputId": "9cfc6f0d-2681-46b7-a8ca-d474e984a600" }, "outputs": [ { @@ -714,14 +723,15 @@ "source": [ "## Generate JSON\n", "\n", - "The [controlled generation](https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/control-generated-output) capability in Gemini API allows you to constraint the model output to a structured format. You can provide the schemas as Pydantic Models or a JSON string." + "The [controlled generation](https://ai.google.dev/gemini-api/docs/structured-output?lang=python#generate-json) capability in Gemini API allows you to constraint the model output to a structured format. You can provide the schemas as Pydantic Models or a JSON string." ] }, { "cell_type": "code", "execution_count": null, "metadata": { - "id": "xRJHVjr-gqHi" + "id": "xRJHVjr-gqHi", + "outputId": "4cb27a37-82b5-4d90-ce96-5aa5917e609b" }, "outputs": [ { @@ -773,7 +783,8 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "3gIsSNqXtOXB" + "id": "3gIsSNqXtOXB", + "outputId": "dbdbdc0b-e0cb-4643-e6a8-4a3e3ee84980" }, "outputs": [ { @@ -866,7 +877,8 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "OPTI7noYuwgr" + "id": "OPTI7noYuwgr", + "outputId": "ca72062c-7a3d-44f1-ebdf-7276a24dc998" }, "outputs": [ { @@ -962,14 +974,15 @@ "source": [ "## Function calling\n", "\n", - "[Function calling](https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/function-calling) lets you provide a set of tools that it can use to respond to the user's prompt. You create a description of a function in your code, then pass that description to a language model in a request. The response from the model includes the name of a function that matches the description and the arguments to call it with." + "[Function calling](https://ai.google.dev/gemini-api/docs/function-calling) lets you provide a set of tools that it can use to respond to the user's prompt. You create a description of a function in your code, then pass that description to a language model in a request. The response from the model includes the name of a function that matches the description and the arguments to call it with." ] }, { "cell_type": "code", "execution_count": null, "metadata": { - "id": "APk6sXO6wLQp" + "id": "APk6sXO6wLQp", + "outputId": "09025f20-2782-4f67-f2b4-aa784323d1e5" }, "outputs": [ { @@ -1040,7 +1053,8 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "8FVVJHb828le" + "id": "8FVVJHb828le", + "outputId": "5ecc1c27-9702-48c4-e840-1fd3df883e7c" }, "outputs": [ { @@ -1067,7 +1081,8 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "NlJ9NwRGT6d1" + "id": "NlJ9NwRGT6d1", + "outputId": "b0ac064d-873b-4f2c-e55d-cb786bc3f357" }, "outputs": [ { @@ -1138,7 +1153,8 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "3Sa6lEH9Tjm5" + "id": "3Sa6lEH9Tjm5", + "outputId": "27191838-5a58-4bfe-f687-488051bc463a" }, "outputs": [ { @@ -1165,7 +1181,8 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "kC3bJQJcUKFk" + "id": "kC3bJQJcUKFk", + "outputId": "45edf59d-778c-436b-a0d3-18522c4baa7a" }, "outputs": [ { @@ -1521,7 +1538,8 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "b0BfhLDFWfCS" + "id": "b0BfhLDFWfCS", + "outputId": "8a052c49-d45d-4432-883d-c46b98146a0e" }, "outputs": [ { @@ -1548,7 +1566,8 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "tH2h2WDVWptt" + "id": "tH2h2WDVWptt", + "outputId": "21496932-5a39-410e-8108-7b317e0cc2fe" }, "outputs": [ { @@ -1622,7 +1641,8 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "lCSuGd9i9fEB" + "id": "lCSuGd9i9fEB", + "outputId": "d51bee2b-4992-4c09-e435-b2fabbdc4029" }, "outputs": [ { @@ -1649,7 +1669,8 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "0wjKO0eI9yps" + "id": "0wjKO0eI9yps", + "outputId": "cfb7c0e9-3fb4-4778-9f84-3c8ad38dca09" }, "outputs": [ { @@ -1712,7 +1733,8 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "e9ohtLxU-SFE" + "id": "e9ohtLxU-SFE", + "outputId": "881e8337-68a9-45d6-9a87-7d998430f43f" }, "outputs": [ { @@ -1753,7 +1775,8 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "PY1WlxMk-0Uy" + "id": "PY1WlxMk-0Uy", + "outputId": "21e94410-234a-4cbe-f0e4-39b01a54eae0" }, "outputs": [ { @@ -1782,7 +1805,8 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "eEk4P3fK_OcJ" + "id": "eEk4P3fK_OcJ", + "outputId": "34b02927-9ac2-4aad-9602-8a087fc25772" }, "outputs": [ { @@ -1813,7 +1837,8 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "oMz9GIuvAiCO" + "id": "oMz9GIuvAiCO", + "outputId": "ad69d13f-dd28-426f-d8e4-64c85abc12b0" }, "outputs": [ { @@ -1832,7 +1857,8 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "cX82TyGL-e2O" + "id": "cX82TyGL-e2O", + "outputId": "c6a7bd80-1bd9-44b2-e525-000f6eba44bc" }, "outputs": [ { @@ -1912,7 +1938,7 @@ "source": [ "## Use context caching\n", "\n", - "[Context caching](https://cloud.google.com/vertex-ai/generative-ai/docs/context-cache/context-cache-overview) lets you to store frequently used input tokens in a dedicated cache and reference them for subsequent requests, eliminating the need to repeatedly pass the same set of tokens to a model.\n", + "[Context caching](https://ai.google.dev/gemini-api/docs/caching?lang=python) lets you to store frequently used input tokens in a dedicated cache and reference them for subsequent requests, eliminating the need to repeatedly pass the same set of tokens to a model.\n", "\n", "Context caching is only available for stable models with fixed versions (for example, `gemini-1.5-pro-002`). You must include the version postfix (for example, the `-002` in `gemini-1.5-pro-002`). It is not yet available of Gemini 2.0 because it is an experimental model. You can find more caching examples [here](https://github.com/google-gemini/cookbook/blob/main/quickstarts/Caching.ipynb)." ] @@ -2017,7 +2043,8 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "-Qo7-sU2w92j" + "id": "-Qo7-sU2w92j", + "outputId": "599dc89b-0f1e-40af-c03c-34a16f03ac3b" }, "outputs": [ { @@ -2050,7 +2077,8 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "gxJ_2Bel_Kqg" + "id": "gxJ_2Bel_Kqg", + "outputId": "61f4c01a-6fe5-4934-d084-a25d65aab81d" }, "outputs": [ { @@ -2081,7 +2109,8 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "zSZeG60Dx4V-" + "id": "zSZeG60Dx4V-", + "outputId": "5845c9f7-aaaa-420d-99e0-d63faadd5b6d" }, "outputs": [ { @@ -2107,7 +2136,7 @@ "source": [ "## Get text embeddings\n", "\n", - "You can get text embeddings for a snippet of text by using `embed_content` method. All models produce an output with 768 dimensions by default. However, some models give users the option to choose an output dimensionality between 1 and 768. See [Vertex AI text embeddings API](https://cloud.google.com/vertex-ai/generative-ai/docs/embeddings/get-text-embeddings) for more details." + "You can get text embeddings for a snippet of text by using `embed_content` method. All models produce an output with 768 dimensions by default. However, some models give users the option to choose an output dimensionality between 1 and 768. See the [embeddings guide](https://ai.google.dev/gemini-api/docs/embeddings) for more details." ] }, { @@ -2125,7 +2154,8 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "0afi69R9x_bh" + "id": "0afi69R9x_bh", + "outputId": "e336504b-83b0-41fb-b80a-80f7e625d456" }, "outputs": [ { @@ -2163,7 +2193,8 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "zNeuBlNt4CRk" + "id": "zNeuBlNt4CRk", + "outputId": "eb4a9891-964c-41bc-9b54-8a0c0d4af0cc" }, "outputs": [ { @@ -2194,7 +2225,8 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "s4oAtC8a4GYH" + "id": "s4oAtC8a4GYH", + "outputId": "8eb44e5e-1922-4311-c5bb-697920564ced" }, "outputs": [ { @@ -2233,7 +2265,8 @@ "metadata": { "colab": { "name": "get_started.ipynb", - "toc_visible": true + "toc_visible": true, + "provenance": [] }, "kernelspec": { "display_name": "Python 3", @@ -2242,4 +2275,4 @@ }, "nbformat": 4, "nbformat_minor": 0 -} +} \ No newline at end of file From e91b0357ed877f5f4b675024005231cd8deed404 Mon Sep 17 00:00:00 2001 From: Shilpa Kancharla Date: Wed, 18 Dec 2024 14:49:12 -0500 Subject: [PATCH 2/2] Reformat notebook --- gemini-2/get_started.ipynb | 101 +++++++++++++------------------------ 1 file changed, 34 insertions(+), 67 deletions(-) diff --git a/gemini-2/get_started.ipynb b/gemini-2/get_started.ipynb index 2eb19c371..c1ce5a64f 100644 --- a/gemini-2/get_started.ipynb +++ b/gemini-2/get_started.ipynb @@ -98,8 +98,7 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "46zEFO2a9FFd", - "outputId": "8a605a60-5360-41c5-f27f-271013b38189" + "id": "46zEFO2a9FFd" }, "outputs": [ { @@ -204,8 +203,7 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "T8md0ayAJ-RZ", - "outputId": "b69b68f1-78e0-49b0-a71b-a327117234a2" + "id": "T8md0ayAJ-RZ" }, "outputs": [ { @@ -243,8 +241,7 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "Z7WFm928wEYR", - "outputId": "c4d598a2-c6f4-4e68-fcfe-30bc30e5293f" + "id": "Z7WFm928wEYR" }, "outputs": [ { @@ -279,8 +276,7 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "bQ3zu5udSBuD", - "outputId": "163383a1-34ad-4562-bf5a-554e02c00e72" + "id": "bQ3zu5udSBuD" }, "outputs": [ { @@ -311,8 +307,7 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "cDxd7Pp_SELb", - "outputId": "35b1333b-ac28-4d25-fad6-4ca45e18e51c" + "id": "cDxd7Pp_SELb" }, "outputs": [ { @@ -391,8 +386,7 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "r5izy6jsbEnL", - "outputId": "a2e8bc03-5312-47fa-e81d-7216991c3f6b" + "id": "r5izy6jsbEnL" }, "outputs": [ { @@ -444,8 +438,7 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "SJIvAfMqbzQL", - "outputId": "69cc68b6-125c-4c4a-fc3d-65ef35e422ec" + "id": "SJIvAfMqbzQL" }, "outputs": [ { @@ -535,8 +528,7 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "SnzMJJ-adOfX", - "outputId": "a6d7f14e-7a4d-4f86-96e0-6205fba1b16b" + "id": "SnzMJJ-adOfX" }, "outputs": [ { @@ -616,8 +608,7 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "9qAObeZMdgln", - "outputId": "9cfc6f0d-2681-46b7-a8ca-d474e984a600" + "id": "9qAObeZMdgln" }, "outputs": [ { @@ -730,8 +721,7 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "xRJHVjr-gqHi", - "outputId": "4cb27a37-82b5-4d90-ce96-5aa5917e609b" + "id": "xRJHVjr-gqHi" }, "outputs": [ { @@ -783,8 +773,7 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "3gIsSNqXtOXB", - "outputId": "dbdbdc0b-e0cb-4643-e6a8-4a3e3ee84980" + "id": "3gIsSNqXtOXB" }, "outputs": [ { @@ -877,8 +866,7 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "OPTI7noYuwgr", - "outputId": "ca72062c-7a3d-44f1-ebdf-7276a24dc998" + "id": "OPTI7noYuwgr" }, "outputs": [ { @@ -981,8 +969,7 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "APk6sXO6wLQp", - "outputId": "09025f20-2782-4f67-f2b4-aa784323d1e5" + "id": "APk6sXO6wLQp" }, "outputs": [ { @@ -1053,8 +1040,7 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "8FVVJHb828le", - "outputId": "5ecc1c27-9702-48c4-e840-1fd3df883e7c" + "id": "8FVVJHb828le" }, "outputs": [ { @@ -1081,8 +1067,7 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "NlJ9NwRGT6d1", - "outputId": "b0ac064d-873b-4f2c-e55d-cb786bc3f357" + "id": "NlJ9NwRGT6d1" }, "outputs": [ { @@ -1153,8 +1138,7 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "3Sa6lEH9Tjm5", - "outputId": "27191838-5a58-4bfe-f687-488051bc463a" + "id": "3Sa6lEH9Tjm5" }, "outputs": [ { @@ -1181,8 +1165,7 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "kC3bJQJcUKFk", - "outputId": "45edf59d-778c-436b-a0d3-18522c4baa7a" + "id": "kC3bJQJcUKFk" }, "outputs": [ { @@ -1538,8 +1521,7 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "b0BfhLDFWfCS", - "outputId": "8a052c49-d45d-4432-883d-c46b98146a0e" + "id": "b0BfhLDFWfCS" }, "outputs": [ { @@ -1566,8 +1548,7 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "tH2h2WDVWptt", - "outputId": "21496932-5a39-410e-8108-7b317e0cc2fe" + "id": "tH2h2WDVWptt" }, "outputs": [ { @@ -1641,8 +1622,7 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "lCSuGd9i9fEB", - "outputId": "d51bee2b-4992-4c09-e435-b2fabbdc4029" + "id": "lCSuGd9i9fEB" }, "outputs": [ { @@ -1669,8 +1649,7 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "0wjKO0eI9yps", - "outputId": "cfb7c0e9-3fb4-4778-9f84-3c8ad38dca09" + "id": "0wjKO0eI9yps" }, "outputs": [ { @@ -1733,8 +1712,7 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "e9ohtLxU-SFE", - "outputId": "881e8337-68a9-45d6-9a87-7d998430f43f" + "id": "e9ohtLxU-SFE" }, "outputs": [ { @@ -1775,8 +1753,7 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "PY1WlxMk-0Uy", - "outputId": "21e94410-234a-4cbe-f0e4-39b01a54eae0" + "id": "PY1WlxMk-0Uy" }, "outputs": [ { @@ -1805,8 +1782,7 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "eEk4P3fK_OcJ", - "outputId": "34b02927-9ac2-4aad-9602-8a087fc25772" + "id": "eEk4P3fK_OcJ" }, "outputs": [ { @@ -1837,8 +1813,7 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "oMz9GIuvAiCO", - "outputId": "ad69d13f-dd28-426f-d8e4-64c85abc12b0" + "id": "oMz9GIuvAiCO" }, "outputs": [ { @@ -1857,8 +1832,7 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "cX82TyGL-e2O", - "outputId": "c6a7bd80-1bd9-44b2-e525-000f6eba44bc" + "id": "cX82TyGL-e2O" }, "outputs": [ { @@ -2043,8 +2017,7 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "-Qo7-sU2w92j", - "outputId": "599dc89b-0f1e-40af-c03c-34a16f03ac3b" + "id": "-Qo7-sU2w92j" }, "outputs": [ { @@ -2077,8 +2050,7 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "gxJ_2Bel_Kqg", - "outputId": "61f4c01a-6fe5-4934-d084-a25d65aab81d" + "id": "gxJ_2Bel_Kqg" }, "outputs": [ { @@ -2109,8 +2081,7 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "zSZeG60Dx4V-", - "outputId": "5845c9f7-aaaa-420d-99e0-d63faadd5b6d" + "id": "zSZeG60Dx4V-" }, "outputs": [ { @@ -2154,8 +2125,7 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "0afi69R9x_bh", - "outputId": "e336504b-83b0-41fb-b80a-80f7e625d456" + "id": "0afi69R9x_bh" }, "outputs": [ { @@ -2193,8 +2163,7 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "zNeuBlNt4CRk", - "outputId": "eb4a9891-964c-41bc-9b54-8a0c0d4af0cc" + "id": "zNeuBlNt4CRk" }, "outputs": [ { @@ -2225,8 +2194,7 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "s4oAtC8a4GYH", - "outputId": "8eb44e5e-1922-4311-c5bb-697920564ced" + "id": "s4oAtC8a4GYH" }, "outputs": [ { @@ -2265,8 +2233,7 @@ "metadata": { "colab": { "name": "get_started.ipynb", - "toc_visible": true, - "provenance": [] + "toc_visible": true }, "kernelspec": { "display_name": "Python 3", @@ -2275,4 +2242,4 @@ }, "nbformat": 4, "nbformat_minor": 0 -} \ No newline at end of file +}