mirror of
https://github.com/google/adk-docs.git
synced 2026-09-14 16:16:59 +08:00
34d4ec2921
* Upgrade Kotlin examples to adk-kotlin 0.7.0 The Kotlin examples were pinned to adk-kotlin 0.5.0, which predates the context caching, Vertex AI memory, and RAG retrieval APIs. Bump the pin to 0.7.0 so snippets for those features can be added. Three consequences of the bump are handled here: - `ExperimentalResumabilityFeature` was removed in 0.7.0, so RunConfigExample no longer opts into it. The annotation class is gone, not merely deprecated, so this is a hard compile break rather than a warning that could be deferred. - The Vertex AI session and memory services expose Ktor's `HttpClient` as a defaulted constructor parameter, so any snippet naming them needs Ktor on the compile classpath, not just at runtime. - The `resolutionStrategy` block forcing kotlin-stdlib 2.1.20 is now dead. It worked around 0.5.0 publishing a stdlib newer than this project's compiler; 0.6.0 fixed that upstream. Verified that the highest stdlib on the compile classpath is still 2.1.20 without it. Also fixes two unrelated snags found while validating the above: - `check_kotlin_snippets.sh` walked `examples/kotlin` without pruning build output, so after any local build it reported every generated KSP file as an unregistered snippet. CI only ever ran it against a clean checkout, so the bug was invisible there. - A transclusion path in logging.md was split across two lines, so the include never resolved and the code block rendered empty. * Fix broken links to adk-python plugin samples The three plugin sample links 404. adk-python renamed `contributing/samples/plugin/` to `contributing/samples/plugins/`; the directory contents are otherwise unchanged, so only the path segment moves. This is what the repo-wide `link-check` job has been failing on. It is unrelated to the 0.7.0 upgrade in this PR, but the check gates the merge and the fix is confined to the three URLs. Verified all three targets return 200. * Add Kotlin snippet for the Knowledge Engine retrieval tool The Knowledge Engine integration page only showed Python. `VertexAiRagRetrieval` landed in adk-kotlin 0.7.0, so add a Kotlin tab and advertise Kotlin support in the page badge. Retrieval runs inside the model through the Gemini-native `vertexRagStore` kind rather than as a locally executed tool, so the snippet configures the corpus via `VertexRagStoreRagResource` and leaves invocation to the model. Registers the new file in files_to_test.txt so it stays in the compile regression suite. * Use the conventional package for the RAG retrieval snippet RagEngine.kt declared `package integrations`. Every other snippet in the tree uses `com.google.adk.kt.examples.<area>`. It compiled either way because the source root is `snippets/` and Kotlin does not require the directory to match the package, so nothing would have caught it. Also worth flagging for anyone reading this alongside the memory snippets: the two APIs take opposite corpus formats. `VertexAiRagRetrieval` here wants the full `projects/.../ragCorpora/...` resource name, while `VertexAiRagMemoryService` wants a bare corpus id and rejects the full name. That is the library's doing, not a docs inconsistency.
1.2 KiB
1.2 KiB
catalog_title, catalog_description, catalog_icon, catalog_tags
| catalog_title | catalog_description | catalog_icon | catalog_tags | ||
|---|---|---|---|---|---|
| Knowledge Engine | Perform private data retrieval using Knowledge Engine | /integrations/assets/agent-platform.svg |
|
Knowledge Engine tool for ADK
Supported in ADKPython v0.1.0Java v0.2.0Kotlin v0.7.0
The vertex_ai_rag_retrieval tool allows the agent to perform private data
retrieval using Knowledge Engine.
When you use grounding with Knowledge Engine, you need to prepare a RAG corpus beforehand. Please refer to the Knowledge Engine page for setting it up.
!!! warning "Warning: Single tool per agent limitation"
This tool can only be used ***by itself*** within an agent instance.
For more information about this limitation and workarounds, see
[Limitations for ADK tools](/tools/limitations/).
=== "Python"
```py
--8<-- "examples/python/snippets/tools/built-in-tools/rag_engine.py"
```
=== "Kotlin"
```kotlin
--8<-- "examples/kotlin/snippets/integrations/RagEngine.kt:full_code"
```