Skip to content

Commit

Permalink
updating docs for video and parallel function calling with formatted …
Browse files Browse the repository at this point in the history
…notebooks
  • Loading branch information
anirudh161 committed May 10, 2024
1 parent a86e76a commit 71065ca
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 61 deletions.
70 changes: 30 additions & 40 deletions site/en/gemini-api/docs/function-calling/python.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,7 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "42b27b02d2f5",
"outputId": "8440de71-9ec3-45c5-c9e8-5193f5ff7919"
"id": "42b27b02d2f5"
},
"outputs": [
{
Expand Down Expand Up @@ -279,8 +278,7 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "81d8def3d865",
"outputId": "cb88151d-e5e5-43f4-9c4e-e6341839a217"
"id": "81d8def3d865"
},
"outputs": [
{
Expand All @@ -303,8 +301,7 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "951c0f83f72e",
"outputId": "2cfdb1eb-2bcc-4b5f-a184-6d7254a3b837"
"id": "951c0f83f72e"
},
"outputs": [
{
Expand All @@ -324,6 +321,9 @@
},
{
"cell_type": "markdown",
"metadata": {
"id": "J0bgvvIs3I9J"
},
"source": [
"Examine the chat history to see the flow of the conversation and how function calls are integrated within it.\n",
"\n",
Expand All @@ -341,17 +341,13 @@
"1. **Model**: Determines that the multiply function is helpful and sends a FunctionCall request to the user.\n",
"1. **User**: The `ChatSession` automatically executes the function (due to `enable_automatic_function_calling` being set) and sends back a `FunctionResponse` with the calculated result.\n",
"1. **Model**: Uses the function's output to formulate the final answer and presents it as a text response."
],
"metadata": {
"id": "J0bgvvIs3I9J"
}
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "9f7eff1e8e60",
"outputId": "139b4b1a-4886-43eb-cd84-9023da7f653d"
"id": "9f7eff1e8e60"
},
"outputs": [
{
Expand Down Expand Up @@ -410,26 +406,31 @@
},
{
"cell_type": "markdown",
"metadata": {
"id": "qiOShqKn1Bh_"
},
"source": [
"## Parallel function calling\n",
"\n",
"In addition to basic function calling described above, you can also call multiple functions in a single turn. This section shows an example for how you can use parallel function calling."
],
"metadata": {
"id": "qiOShqKn1Bh_"
}
]
},
{
"cell_type": "markdown",
"source": [
"Define the tools."
],
"metadata": {
"id": "PvHIHmFdTg_c"
}
},
"source": [
"Define the tools."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "89QPizVHTeJa"
},
"outputs": [],
"source": [
"def power_disco_ball(power: bool) -> bool:\n",
" \"\"\"Powers the spinning disco ball.\"\"\"\n",
Expand Down Expand Up @@ -459,12 +460,7 @@
" \"\"\"\n",
" print(f\"Lights are now set to {brightness:.0%}\")\n",
" return True"
],
"metadata": {
"id": "89QPizVHTeJa"
},
"execution_count": null,
"outputs": []
]
},
{
"cell_type": "markdown",
Expand All @@ -479,8 +475,7 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "21ecYHLgIsCl",
"outputId": "eb1a6a96-e021-4851-af28-38a35133b593"
"id": "21ecYHLgIsCl"
},
"outputs": [
{
Expand Down Expand Up @@ -523,8 +518,7 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "L7RxoiR3foBR",
"outputId": "1f33f596-c29a-4014-d14f-9cc8d8ee1262"
"id": "L7RxoiR3foBR"
},
"outputs": [
{
Expand Down Expand Up @@ -603,8 +597,7 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "e36166b2c1b6",
"outputId": "af6f27d2-3358-409b-ef8c-7ee9ef9f58ca"
"id": "e36166b2c1b6"
},
"outputs": [
{
Expand Down Expand Up @@ -725,8 +718,7 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "4cefe2c3c808",
"outputId": "9bcf4b22-cfbd-42ae-e42b-092dbc07a780"
"id": "4cefe2c3c808"
},
"outputs": [
{
Expand Down Expand Up @@ -802,8 +794,7 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "xhey4QA0DTJf",
"outputId": "282ef2ec-4f3b-408e-baaa-8c96a8262220"
"id": "xhey4QA0DTJf"
},
"outputs": [
{
Expand Down Expand Up @@ -858,8 +849,7 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "88758eebfd5c",
"outputId": "3a54fd79-1151-4ab2-9d97-571ca67f9147"
"id": "88758eebfd5c"
},
"outputs": [
{
Expand Down Expand Up @@ -920,7 +910,7 @@
],
"metadata": {
"colab": {
"provenance": [],
"name": "python.ipynb",
"toc_visible": true
},
"google": {
Expand All @@ -941,4 +931,4 @@
},
"nbformat": 4,
"nbformat_minor": 0
}
}
42 changes: 21 additions & 21 deletions site/en/gemini-api/docs/prompting_with_media.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,12 @@
},
{
"cell_type": "markdown",
"source": [
"### Upload an image file to the File API"
],
"metadata": {
"id": "rsdNkDszLBmQ"
}
},
"source": [
"### Upload an image file to the File API"
]
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -207,8 +207,7 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "N9NxXGZKKusG",
"outputId": "e0faa4d3-dc5e-4d78-8694-ddc92dee4379"
"id": "N9NxXGZKKusG"
},
"outputs": [
{
Expand Down Expand Up @@ -315,12 +314,12 @@
},
{
"cell_type": "markdown",
"source": [
"## Prompting with videos"
],
"metadata": {
"id": "TaUZc1mvLkHY"
}
},
"source": [
"## Prompting with videos"
]
},
{
"cell_type": "markdown",
Expand All @@ -339,14 +338,14 @@
},
{
"cell_type": "code",
"source": [
"!wget https://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4"
],
"execution_count": null,
"metadata": {
"id": "V4XeFdX1rxaE"
},
"execution_count": null,
"outputs": []
"outputs": [],
"source": [
"!wget https://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4"
]
},
{
"cell_type": "code",
Expand All @@ -365,12 +364,12 @@
},
{
"cell_type": "markdown",
"source": [
"NOTE: The File API service currently samples the video at 1 FPS and may be subject to change to provide the best inference quality."
],
"metadata": {
"id": "06GCLdmwNin5"
}
},
"source": [
"NOTE: The File API service currently samples the video at 1 FPS and may be subject to change to provide the best inference quality."
]
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -597,7 +596,8 @@
],
"metadata": {
"colab": {
"provenance": []
"name": "prompting_with_media.ipynb",
"toc_visible": true
},
"kernelspec": {
"display_name": "Python 3",
Expand All @@ -606,4 +606,4 @@
},
"nbformat": 4,
"nbformat_minor": 0
}
}

0 comments on commit 71065ca

Please sign in to comment.