|
203 | 203 | "os.environ[\"GOOGLE_CLOUD_LOCATION\"] = LOCATION" |
204 | 204 | ] |
205 | 205 | }, |
| 206 | + { |
| 207 | + "cell_type": "markdown", |
| 208 | + "metadata": {}, |
| 209 | + "source": [ |
| 210 | + "## (Optional) Set up logging\n", |
| 211 | + "To surface ADK logs in your notebook, you may need to configure the logging level of ADK's logger." |
| 212 | + ] |
| 213 | + }, |
| 214 | + { |
| 215 | + "cell_type": "code", |
| 216 | + "execution_count": null, |
| 217 | + "metadata": {}, |
| 218 | + "outputs": [], |
| 219 | + "source": [ |
| 220 | + "import logging\n", |
| 221 | + "import sys\n", |
| 222 | + "\n", |
| 223 | + "# Set up a general handler for all logs to be printed in your Colab output.\n", |
| 224 | + "# We'll set the overall level to INFO.\n", |
| 225 | + "logging.basicConfig(\n", |
| 226 | + " level=logging.INFO,\n", |
| 227 | + " format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',\n", |
| 228 | + " stream=sys.stdout\n", |
| 229 | + ")\n", |
| 230 | + "\n", |
| 231 | + "# Get the specific logger used by ADK.\n", |
| 232 | + "adk_logger = logging.getLogger('google_adk')\n", |
| 233 | + "\n", |
| 234 | + "# Set its level to DEBUG to ensure you capture ALL messages from the SDK,\n", |
| 235 | + "# even if the general level is higher (like INFO).\n", |
| 236 | + "adk_logger.setLevel(logging.DEBUG)" |
| 237 | + ] |
| 238 | + }, |
206 | 239 | { |
207 | 240 | "cell_type": "markdown", |
208 | 241 | "metadata": { |
|
229 | 262 | "from google.adk.agents import LlmAgent\n", |
230 | 263 | "from google.adk.runners import Runner\n", |
231 | 264 | "from google.adk.sessions import InMemorySessionService\n", |
232 | | - "from google.genai import types\n", |
233 | 265 | "from google.genai.types import Content, Part\n", |
234 | 266 | "\n", |
235 | 267 | "APP_NAME = \"memory_example_app\"\n", |
|
0 commit comments