mirror of
https://github.com/encounter/adk-python.git
synced 2026-07-09 18:19:28 -07:00
feat: Add artifact metadata support and a new sample for context offloading
Enhanced `save_artifact` in `callback_context.py` to accept `custom_metadata` and added `get_artifact_version` to retrieve artifact details. Introduced a new sample, `context_offloading_with_artifact`, demonstrating how to use ADK artifacts to offload large data from the LLM context. The sample includes: - `QueryLargeDataTool`: Generates mock sales reports, saves them as artifacts with custom metadata, and injects the artifact content into the LLM request immediately after creation. - `CustomLoadArtifactsTool`: Provides summaries of available artifacts to the LLM based on metadata and loads artifact content on demand when `load_artifacts` is called. Co-authored-by: Hangfei Lin <hangfei@google.com> PiperOrigin-RevId: 830592786
This commit is contained in:
committed by
Copybara-Service
parent
74959414d8
commit
2b0f953255
@@ -296,6 +296,7 @@ class TestCallbackContext:
|
||||
session_id="test-session-id",
|
||||
filename="test_file.txt",
|
||||
artifact=test_artifact,
|
||||
custom_metadata=None,
|
||||
)
|
||||
assert version == 1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user