Merge branch 'main' into #247-OpenAPIToolSet-Considering-Required-parameters

This commit is contained in:
sumant-pangotra 2025-05-02 12:06:41 +05:30 committed by GitHub
commit 42f87a9c94
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -15,9 +15,7 @@
from __future__ import annotations from __future__ import annotations
import copy import copy
from typing import AsyncGenerator from typing import AsyncGenerator, Generator, Optional
from typing import Generator
from typing import Optional
from google.genai import types from google.genai import types
from typing_extensions import override from typing_extensions import override
@ -202,8 +200,14 @@ def _get_contents(
# Parse the events, leaving the contents and the function calls and # Parse the events, leaving the contents and the function calls and
# responses from the current agent. # responses from the current agent.
for event in events: for event in events:
if not event.content or not event.content.role: if (
# Skip events without content, or generated neither by user nor by model. not event.content
or not event.content.role
or not event.content.parts
or event.content.parts[0].text == ''
):
# Skip events without content, or generated neither by user nor by model
# or has empty text.
# E.g. events purely for mutating session states. # E.g. events purely for mutating session states.
continue continue
if not _is_event_belongs_to_branch(current_branch, event): if not _is_event_belongs_to_branch(current_branch, event):