├── README.md ├── LICENSE ├── .gitignore └── gemini_context_caching.ipynb /README.md: -------------------------------------------------------------------------------- 1 | # Gemini-Context-Caching 2 | Gemini Context Caching showing information retrieval from Video. 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 AI Anytime 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | share/python-wheels/ 24 | *.egg-info/ 25 | .installed.cfg 26 | *.egg 27 | MANIFEST 28 | 29 | # PyInstaller 30 | # Usually these files are written by a python script from a template 31 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 32 | *.manifest 33 | *.spec 34 | 35 | # Installer logs 36 | pip-log.txt 37 | pip-delete-this-directory.txt 38 | 39 | # Unit test / coverage reports 40 | htmlcov/ 41 | .tox/ 42 | .nox/ 43 | .coverage 44 | .coverage.* 45 | .cache 46 | nosetests.xml 47 | coverage.xml 48 | *.cover 49 | *.py,cover 50 | .hypothesis/ 51 | .pytest_cache/ 52 | cover/ 53 | 54 | # Translations 55 | *.mo 56 | *.pot 57 | 58 | # Django stuff: 59 | *.log 60 | local_settings.py 61 | db.sqlite3 62 | db.sqlite3-journal 63 | 64 | # Flask stuff: 65 | instance/ 66 | .webassets-cache 67 | 68 | # Scrapy stuff: 69 | .scrapy 70 | 71 | # Sphinx documentation 72 | docs/_build/ 73 | 74 | # PyBuilder 75 | .pybuilder/ 76 | target/ 77 | 78 | # Jupyter Notebook 79 | .ipynb_checkpoints 80 | 81 | # IPython 82 | profile_default/ 83 | ipython_config.py 84 | 85 | # pyenv 86 | # For a library or package, you might want to ignore these files since the code is 87 | # intended to run in multiple environments; otherwise, check them in: 88 | # .python-version 89 | 90 | # pipenv 91 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 92 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 93 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 94 | # install all needed dependencies. 95 | #Pipfile.lock 96 | 97 | # poetry 98 | # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. 99 | # This is especially recommended for binary packages to ensure reproducibility, and is more 100 | # commonly ignored for libraries. 101 | # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control 102 | #poetry.lock 103 | 104 | # pdm 105 | # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. 106 | #pdm.lock 107 | # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it 108 | # in version control. 109 | # https://pdm.fming.dev/latest/usage/project/#working-with-version-control 110 | .pdm.toml 111 | .pdm-python 112 | .pdm-build/ 113 | 114 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm 115 | __pypackages__/ 116 | 117 | # Celery stuff 118 | celerybeat-schedule 119 | celerybeat.pid 120 | 121 | # SageMath parsed files 122 | *.sage.py 123 | 124 | # Environments 125 | .env 126 | .venv 127 | env/ 128 | venv/ 129 | ENV/ 130 | env.bak/ 131 | venv.bak/ 132 | 133 | # Spyder project settings 134 | .spyderproject 135 | .spyproject 136 | 137 | # Rope project settings 138 | .ropeproject 139 | 140 | # mkdocs documentation 141 | /site 142 | 143 | # mypy 144 | .mypy_cache/ 145 | .dmypy.json 146 | dmypy.json 147 | 148 | # Pyre type checker 149 | .pyre/ 150 | 151 | # pytype static type analyzer 152 | .pytype/ 153 | 154 | # Cython debug symbols 155 | cython_debug/ 156 | 157 | # PyCharm 158 | # JetBrains specific template is maintained in a separate JetBrains.gitignore that can 159 | # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore 160 | # and can be added to the global gitignore or merged into this file. For a more nuclear 161 | # option (not recommended) you can uncomment the following to ignore the entire idea folder. 162 | #.idea/ 163 | -------------------------------------------------------------------------------- /gemini_context_caching.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "nbformat": 4, 3 | "nbformat_minor": 0, 4 | "metadata": { 5 | "colab": { 6 | "provenance": [] 7 | }, 8 | "kernelspec": { 9 | "name": "python3", 10 | "display_name": "Python 3" 11 | }, 12 | "language_info": { 13 | "name": "python" 14 | } 15 | }, 16 | "cells": [ 17 | { 18 | "cell_type": "code", 19 | "source": [ 20 | "!pip install -U google-generativeai" 21 | ], 22 | "metadata": { 23 | "colab": { 24 | "base_uri": "https://localhost:8080/", 25 | "height": 880 26 | }, 27 | "collapsed": true, 28 | "id": "l-txkUB5CAHO", 29 | "outputId": "ba5de438-bd23-4fed-e82a-a7758784e803" 30 | }, 31 | "execution_count": 4, 32 | "outputs": [ 33 | { 34 | "output_type": "stream", 35 | "name": "stdout", 36 | "text": [ 37 | "Requirement already satisfied: google-generativeai in /usr/local/lib/python3.10/dist-packages (0.5.4)\n", 38 | "Collecting google-generativeai\n", 39 | " Downloading google_generativeai-0.7.0-py3-none-any.whl (163 kB)\n", 40 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m163.1/163.1 kB\u001b[0m \u001b[31m3.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", 41 | "\u001b[?25hCollecting google-ai-generativelanguage==0.6.5 (from google-generativeai)\n", 42 | " Downloading google_ai_generativelanguage-0.6.5-py3-none-any.whl (717 kB)\n", 43 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m717.3/717.3 kB\u001b[0m \u001b[31m21.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", 44 | "\u001b[?25hRequirement already satisfied: google-api-core in /usr/local/lib/python3.10/dist-packages (from google-generativeai) (2.11.1)\n", 45 | "Requirement already satisfied: google-api-python-client in /usr/local/lib/python3.10/dist-packages (from google-generativeai) (2.84.0)\n", 46 | "Requirement already satisfied: google-auth>=2.15.0 in /usr/local/lib/python3.10/dist-packages (from google-generativeai) (2.27.0)\n", 47 | "Requirement already satisfied: protobuf in /usr/local/lib/python3.10/dist-packages (from google-generativeai) (3.20.3)\n", 48 | "Requirement already satisfied: pydantic in /usr/local/lib/python3.10/dist-packages (from google-generativeai) (2.7.4)\n", 49 | "Requirement already satisfied: tqdm in /usr/local/lib/python3.10/dist-packages (from google-generativeai) (4.66.4)\n", 50 | "Requirement already satisfied: typing-extensions in /usr/local/lib/python3.10/dist-packages (from google-generativeai) (4.12.2)\n", 51 | "Requirement already satisfied: proto-plus<2.0.0dev,>=1.22.3 in /usr/local/lib/python3.10/dist-packages (from google-ai-generativelanguage==0.6.5->google-generativeai) (1.23.0)\n", 52 | "Requirement already satisfied: cachetools<6.0,>=2.0.0 in /usr/local/lib/python3.10/dist-packages (from google-auth>=2.15.0->google-generativeai) (5.3.3)\n", 53 | "Requirement already satisfied: pyasn1-modules>=0.2.1 in /usr/local/lib/python3.10/dist-packages (from google-auth>=2.15.0->google-generativeai) (0.4.0)\n", 54 | "Requirement already satisfied: rsa<5,>=3.1.4 in /usr/local/lib/python3.10/dist-packages (from google-auth>=2.15.0->google-generativeai) (4.9)\n", 55 | "Requirement already satisfied: googleapis-common-protos<2.0.dev0,>=1.56.2 in /usr/local/lib/python3.10/dist-packages (from google-api-core->google-generativeai) (1.63.1)\n", 56 | "Requirement already satisfied: requests<3.0.0.dev0,>=2.18.0 in /usr/local/lib/python3.10/dist-packages (from google-api-core->google-generativeai) (2.31.0)\n", 57 | "Requirement already satisfied: httplib2<1dev,>=0.15.0 in /usr/local/lib/python3.10/dist-packages (from google-api-python-client->google-generativeai) (0.22.0)\n", 58 | "Requirement already satisfied: google-auth-httplib2>=0.1.0 in /usr/local/lib/python3.10/dist-packages (from google-api-python-client->google-generativeai) (0.1.1)\n", 59 | "Requirement already satisfied: uritemplate<5,>=3.0.1 in /usr/local/lib/python3.10/dist-packages (from google-api-python-client->google-generativeai) (4.1.1)\n", 60 | "Requirement already satisfied: annotated-types>=0.4.0 in /usr/local/lib/python3.10/dist-packages (from pydantic->google-generativeai) (0.7.0)\n", 61 | "Requirement already satisfied: pydantic-core==2.18.4 in /usr/local/lib/python3.10/dist-packages (from pydantic->google-generativeai) (2.18.4)\n", 62 | "Requirement already satisfied: grpcio<2.0dev,>=1.33.2 in /usr/local/lib/python3.10/dist-packages (from google-api-core->google-generativeai) (1.64.1)\n", 63 | "Requirement already satisfied: grpcio-status<2.0.dev0,>=1.33.2 in /usr/local/lib/python3.10/dist-packages (from google-api-core->google-generativeai) (1.48.2)\n", 64 | "Requirement already satisfied: pyparsing!=3.0.0,!=3.0.1,!=3.0.2,!=3.0.3,<4,>=2.4.2 in /usr/local/lib/python3.10/dist-packages (from httplib2<1dev,>=0.15.0->google-api-python-client->google-generativeai) (3.1.2)\n", 65 | "Requirement already satisfied: pyasn1<0.7.0,>=0.4.6 in /usr/local/lib/python3.10/dist-packages (from pyasn1-modules>=0.2.1->google-auth>=2.15.0->google-generativeai) (0.6.0)\n", 66 | "Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests<3.0.0.dev0,>=2.18.0->google-api-core->google-generativeai) (3.3.2)\n", 67 | "Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests<3.0.0.dev0,>=2.18.0->google-api-core->google-generativeai) (3.7)\n", 68 | "Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.10/dist-packages (from requests<3.0.0.dev0,>=2.18.0->google-api-core->google-generativeai) (2.0.7)\n", 69 | "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/dist-packages (from requests<3.0.0.dev0,>=2.18.0->google-api-core->google-generativeai) (2024.6.2)\n", 70 | "Installing collected packages: google-ai-generativelanguage, google-generativeai\n", 71 | " Attempting uninstall: google-ai-generativelanguage\n", 72 | " Found existing installation: google-ai-generativelanguage 0.6.4\n", 73 | " Uninstalling google-ai-generativelanguage-0.6.4:\n", 74 | " Successfully uninstalled google-ai-generativelanguage-0.6.4\n", 75 | " Attempting uninstall: google-generativeai\n", 76 | " Found existing installation: google-generativeai 0.5.4\n", 77 | " Uninstalling google-generativeai-0.5.4:\n", 78 | " Successfully uninstalled google-generativeai-0.5.4\n", 79 | "Successfully installed google-ai-generativelanguage-0.6.5 google-generativeai-0.7.0\n" 80 | ] 81 | }, 82 | { 83 | "output_type": "display_data", 84 | "data": { 85 | "application/vnd.colab-display-data+json": { 86 | "pip_warning": { 87 | "packages": [ 88 | "google" 89 | ] 90 | }, 91 | "id": "c9a9bf1d6f054bf3a388d076b7affde3" 92 | } 93 | }, 94 | "metadata": {} 95 | } 96 | ] 97 | }, 98 | { 99 | "cell_type": "code", 100 | "execution_count": 18, 101 | "metadata": { 102 | "id": "aroyMVS15dVN" 103 | }, 104 | "outputs": [], 105 | "source": [ 106 | "import google.generativeai as genai\n", 107 | "import os\n", 108 | "from google.colab import userdata\n", 109 | "import time" 110 | ] 111 | }, 112 | { 113 | "cell_type": "code", 114 | "source": [ 115 | "os.environ[\"GOOGLE_API_KEY\"] = userdata.get(\"GOOGLE_API_KEY\")\n", 116 | "genai.configure(api_key=os.environ['GOOGLE_API_KEY'])" 117 | ], 118 | "metadata": { 119 | "id": "IIalVMrMDjyX" 120 | }, 121 | "execution_count": 25, 122 | "outputs": [] 123 | }, 124 | { 125 | "cell_type": "code", 126 | "source": [ 127 | "video_file_name = \"sam.mp4\"" 128 | ], 129 | "metadata": { 130 | "id": "xZPkEot4B-mm" 131 | }, 132 | "execution_count": 26, 133 | "outputs": [] 134 | }, 135 | { 136 | "cell_type": "code", 137 | "source": [ 138 | "video_file = genai.upload_file(path=video_file_name)" 139 | ], 140 | "metadata": { 141 | "id": "V_u5ooV7C1zJ" 142 | }, 143 | "execution_count": 27, 144 | "outputs": [] 145 | }, 146 | { 147 | "cell_type": "code", 148 | "source": [ 149 | "while video_file.state.name == \"PROCESSING\":\n", 150 | " print('Waiting for video to be processed.')\n", 151 | " time.sleep(2)\n", 152 | " video_file = genai.get_file(video_file.name)\n", 153 | "\n", 154 | "print(f'Video processing complete: ' + video_file.uri)" 155 | ], 156 | "metadata": { 157 | "colab": { 158 | "base_uri": "https://localhost:8080/", 159 | "height": 52 160 | }, 161 | "id": "f5QfxAG7DIAL", 162 | "outputId": "de6d27de-0154-4d19-d83e-4e6af23443e2" 163 | }, 164 | "execution_count": 28, 165 | "outputs": [ 166 | { 167 | "output_type": "stream", 168 | "name": "stdout", 169 | "text": [ 170 | "Waiting for video to be processed.\n", 171 | "Video processing complete: https://generativelanguage.googleapis.com/v1beta/files/p68jd6kcni96\n" 172 | ] 173 | } 174 | ] 175 | }, 176 | { 177 | "cell_type": "markdown", 178 | "source": [ 179 | "\" Context caching \" is a feature that allows you to reduce cost and latency by caching input tokens and referencing the cached tokens in subsequent requests.\n", 180 | "\n", 181 | "When you store a token in the cache, you specify the cache duration ( TTL ) for the token. The cost of storing the cache depends on the size of the input token and the duration for which the token is kept.\n", 182 | "\n", 183 | "\"Context caching\" is supported in both \"Gemini 1.5 Pro\" and \"Gemini 1.5 Flash\"." 184 | ], 185 | "metadata": { 186 | "id": "abPG_fHqQ0sd" 187 | } 188 | }, 189 | { 190 | "cell_type": "code", 191 | "source": [ 192 | "from google.generativeai import caching\n", 193 | "import datetime" 194 | ], 195 | "metadata": { 196 | "id": "U2Z4mZHVEIDf" 197 | }, 198 | "execution_count": 29, 199 | "outputs": [] 200 | }, 201 | { 202 | "cell_type": "markdown", 203 | "source": [ 204 | "Use cases for Context caching\n", 205 | "Context caching is appropriate when the initial context is referenced repeatedly by short requests.\n", 206 | "\n", 207 | "Chatbots with long system instructions Repetitive analysis of long video files Periodic queries against large document sets Frequent code repository analysis Bug fixing\n" 208 | ], 209 | "metadata": { 210 | "id": "_NAiGivVQwGs" 211 | } 212 | }, 213 | { 214 | "cell_type": "code", 215 | "source": [ 216 | "cache = caching.CachedContent.create(\n", 217 | " model=\"models/gemini-1.5-flash-001\",\n", 218 | " display_name=\"AI Anytime Video\",\n", 219 | " system_instruction=\"You are an expert video analyzer, and your task is to answer user's query based on the video file you have access to.\",\n", 220 | " contents=[video_file],\n", 221 | " ttl=datetime.timedelta(minutes=5),\n", 222 | ")" 223 | ], 224 | "metadata": { 225 | "id": "YEa-ELWPDH9b" 226 | }, 227 | "execution_count": 30, 228 | "outputs": [] 229 | }, 230 | { 231 | "cell_type": "code", 232 | "source": [ 233 | "model = genai.GenerativeModel.from_cached_content(cached_content=cache)" 234 | ], 235 | "metadata": { 236 | "id": "wl_E3s2cDH6f" 237 | }, 238 | "execution_count": 31, 239 | "outputs": [] 240 | }, 241 | { 242 | "cell_type": "code", 243 | "source": [ 244 | "response = model.generate_content(\n", 245 | " [\"What is this video all about?\"]\n", 246 | ")" 247 | ], 248 | "metadata": { 249 | "id": "Z6I6PDDTPk4L" 250 | }, 251 | "execution_count": 32, 252 | "outputs": [] 253 | }, 254 | { 255 | "cell_type": "code", 256 | "source": [ 257 | "response" 258 | ], 259 | "metadata": { 260 | "colab": { 261 | "base_uri": "https://localhost:8080/" 262 | }, 263 | "id": "0sSAFlJ5Pt0G", 264 | "outputId": "55349afd-285b-4e57-a7e9-b230fc06317f" 265 | }, 266 | "execution_count": 33, 267 | "outputs": [ 268 | { 269 | "output_type": "execute_result", 270 | "data": { 271 | "text/plain": [ 272 | "response:\n", 273 | "GenerateContentResponse(\n", 274 | " done=True,\n", 275 | " iterator=None,\n", 276 | " result=protos.GenerateContentResponse({\n", 277 | " \"candidates\": [\n", 278 | " {\n", 279 | " \"content\": {\n", 280 | " \"parts\": [\n", 281 | " {\n", 282 | " \"text\": \"This video is an interview with Sam Altman, CEO of OpenAI, about his advice on work-life balance in your twenties. He stresses that working hard early in your career is important for long-term success. He also talks about the importance of enjoying your work and believing in what you're doing to stay motivated and push through the difficult times. \\n\"\n", 283 | " }\n", 284 | " ],\n", 285 | " \"role\": \"model\"\n", 286 | " },\n", 287 | " \"finish_reason\": \"STOP\",\n", 288 | " \"index\": 0,\n", 289 | " \"safety_ratings\": [\n", 290 | " {\n", 291 | " \"category\": \"HARM_CATEGORY_SEXUALLY_EXPLICIT\",\n", 292 | " \"probability\": \"NEGLIGIBLE\"\n", 293 | " },\n", 294 | " {\n", 295 | " \"category\": \"HARM_CATEGORY_HATE_SPEECH\",\n", 296 | " \"probability\": \"NEGLIGIBLE\"\n", 297 | " },\n", 298 | " {\n", 299 | " \"category\": \"HARM_CATEGORY_HARASSMENT\",\n", 300 | " \"probability\": \"NEGLIGIBLE\"\n", 301 | " },\n", 302 | " {\n", 303 | " \"category\": \"HARM_CATEGORY_DANGEROUS_CONTENT\",\n", 304 | " \"probability\": \"NEGLIGIBLE\"\n", 305 | " }\n", 306 | " ]\n", 307 | " }\n", 308 | " ],\n", 309 | " \"usage_metadata\": {\n", 310 | " \"prompt_token_count\": 77326,\n", 311 | " \"candidates_token_count\": 72,\n", 312 | " \"total_token_count\": 77398,\n", 313 | " \"cached_content_token_count\": 77318\n", 314 | " }\n", 315 | " }),\n", 316 | ")" 317 | ] 318 | }, 319 | "metadata": {}, 320 | "execution_count": 33 321 | } 322 | ] 323 | }, 324 | { 325 | "cell_type": "code", 326 | "source": [ 327 | "print(response.usage_metadata)" 328 | ], 329 | "metadata": { 330 | "colab": { 331 | "base_uri": "https://localhost:8080/" 332 | }, 333 | "id": "KGWD-UxEPz7K", 334 | "outputId": "4d537f9c-fc0b-4ffe-a6b0-aa7ec5a02435" 335 | }, 336 | "execution_count": 34, 337 | "outputs": [ 338 | { 339 | "output_type": "stream", 340 | "name": "stdout", 341 | "text": [ 342 | "prompt_token_count: 77326\n", 343 | "candidates_token_count: 72\n", 344 | "total_token_count: 77398\n", 345 | "cached_content_token_count: 77318\n", 346 | "\n" 347 | ] 348 | } 349 | ] 350 | }, 351 | { 352 | "cell_type": "markdown", 353 | "source": [ 354 | "・The minimum number of input tokens for Context caching is 32,768, and the maximum is the same as the maximum for the specified model.\n", 355 | "\n", 356 | "・If the cache retention time (TTL) is not set, it is 1 hour.\n", 357 | "\n", 358 | "・The model does not distinguish between cached and normal tokens. Cached content is simply prefixed to the prompt.\n", 359 | "\n", 360 | "・The cache service provides a delete operation to manually delete content from the cache.\n", 361 | "\n", 362 | "・In paid versions, there are no special rate or usage limits for Context caching. Standard rate limits apply to GenerateContent, and the token limit includes cached tokens. In free versions, \"Gemini 1.5 Flash\" has a storage limit of 1 million tokens, and caching is not available in \"Gemini 1.5 Pro\".\n", 363 | "\n", 364 | "・You cannot retrieve or display cached content, but you can retrieve the metadata (name, display_name, model, and create, update, expire times).\n", 365 | "\n", 366 | "・You can update the display_name and set a new ttl or expire_time. No other changes are supported.\n", 367 | "\n", 368 | ". The number of cached tokens is returned by the create, get, and list operations of the usage_metadata cache service, and also when using GenerateContent caching." 369 | ], 370 | "metadata": { 371 | "id": "q7IA6CvTQMbJ" 372 | } 373 | }, 374 | { 375 | "cell_type": "code", 376 | "source": [], 377 | "metadata": { 378 | "id": "wljTWW8lQEgK" 379 | }, 380 | "execution_count": null, 381 | "outputs": [] 382 | } 383 | ] 384 | } --------------------------------------------------------------------------------