Skip to content

Commit 084229c

Browse files
Tongzhou-Jiangcopybara-github
authored andcommitted
fix: Save artifact in init_session
Closes google/adk-python#3495 PiperOrigin-RevId: 833983514
1 parent e0bc3d8 commit 084229c

File tree

2 files changed

+12
-2
lines changed
  • vertexai
    • agent_engines/templates
    • preview/reasoning_engines/templates

2 files changed

+12
-2
lines changed

vertexai/agent_engines/templates/adk.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,13 @@ def is_version_sufficient(version_to_check: str) -> bool:
135135

136136
class _ArtifactVersion:
137137
def __init__(self, **kwargs):
138+
from google.genai import types
139+
138140
self.version: Optional[str] = kwargs.get("version")
139-
self.data = kwargs.get("data")
141+
data = kwargs.get("data")
142+
self.data: Optional[types.Part] = (
143+
types.Part.model_validate(data) if isinstance(data, dict) else data
144+
)
140145

141146
def dump(self) -> Dict[str, Any]:
142147
result = {}

vertexai/preview/reasoning_engines/templates/adk.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,13 @@ def is_version_sufficient(version_to_check: str) -> bool:
137137

138138
class _ArtifactVersion:
139139
def __init__(self, **kwargs):
140+
from google.genai import types
141+
140142
self.version: Optional[str] = kwargs.get("version")
141-
self.data = kwargs.get("data")
143+
data = kwargs.get("data")
144+
self.data: Optional[types.Part] = (
145+
types.Part.model_validate(data) if isinstance(data, dict) else data
146+
)
142147

143148
def dump(self) -> Dict[str, Any]:
144149
result = {}

0 commit comments

Comments
 (0)