File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed
src/google/adk/flows/llm_flows Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change 15
15
from __future__ import annotations
16
16
17
17
import copy
18
- from typing import AsyncGenerator
19
- from typing import Generator
20
- from typing import Optional
18
+ from typing import AsyncGenerator , Generator , Optional
21
19
22
20
from google .genai import types
23
21
from typing_extensions import override
@@ -202,8 +200,14 @@ def _get_contents(
202
200
# Parse the events, leaving the contents and the function calls and
203
201
# responses from the current agent.
204
202
for event in events :
205
- if not event .content or not event .content .role :
206
- # Skip events without content, or generated neither by user nor by model.
203
+ if (
204
+ not event .content
205
+ or not event .content .role
206
+ or not event .content .parts
207
+ or event .content .parts [0 ].text == ''
208
+ ):
209
+ # Skip events without content, or generated neither by user nor by model
210
+ # or has empty text.
207
211
# E.g. events purely for mutating session states.
208
212
continue
209
213
if not _is_event_belongs_to_branch (current_branch , event ):
You can’t perform that action at this time.
0 commit comments