docs(memory): use public preload_memory tool API in examples#1804
docs(memory): use public preload_memory tool API in examples#1804garyzava wants to merge 2 commits into
Conversation
The memory docs and the express-mode weather agent notebook referenced `adk.tools.preload_memory_tool.PreloadMemoryTool()`, which raises `AttributeError: module 'google.adk.tools' has no attribute 'preload_memory_tool'` because the submodule is not exposed via the package's lazy `__getattr__`. Use the documented public API `from google.adk.tools import preload_memory` and pass the `preload_memory` instance directly, consistent with how the sibling `load_memory` tool is shown in the same page. Fixes google#1771
✅ Deploy Preview for adk-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Friendly bump — this fixes the |
|
@joefernandez would you be able to take a look when you have a moment? It's a small docs-only fix for the |
Summary
The Memory docs and the express-mode weather agent notebook show the preload
tool as
adk.tools.preload_memory_tool.PreloadMemoryTool(). Copy-pasting thatthrows
AttributeError: module 'google.adk.tools' has no attribute 'preload_memory_tool'. This PR changes the Python examples to the public API,from google.adk.tools import preload_memory, which is also howload_memoryis shown on the same page.
Fixes #1771
What changed
docs/sessions/memory.md- both Python tabs now importpreload_memoryandpass the
preload_memoryinstance intools=[...].examples/python/notebooks/express-mode-weather-agent.ipynb- same fix in theimport cell and the agent definition.
Go, Java, Kotlin and TypeScript tabs are left as-is.
Why
google.adk.toolsexports the tool through a lazy__getattr__as the instancepreload_memory(from .preload_memory_tool import preload_memory_tool as preload_memory). Thepreload_memory_toolsubmodule isn't an attribute of thepackage, so the documented
adk.tools.preload_memory_tool.PreloadMemoryTool()fails. Using
preload_memorydirectly matches the existingload_memoryexample (
from google.adk.tools import load_memory->tools=[load_memory]).How I tested
Checked against
google-adk==2.1.0:mkdocs buildpasses, and the renderedsessions/memory/page now only showspreload_memory.Backward compatibility
Docs/examples only.
from google.adk.tools.preload_memory_tool import PreloadMemoryToolstill works; this just documents the supported public form.No code changes.