feat: Use json schema for agent tool declaration when feature enabled

Co-authored-by: Xuan Yang <xygoogle@google.com>
PiperOrigin-RevId: 854329254
This commit is contained in:
Xuan Yang
2026-01-09 13:45:46 -08:00
committed by Copybara-Service
parent 86e7664006
commit 6b241f5ef2
5 changed files with 302 additions and 32 deletions
@@ -13,9 +13,9 @@
# limitations under the License.
from enum import Enum
from unittest import mock
from google.adk.features import FeatureName
from google.adk.features._feature_registry import temporary_feature_override
from google.adk.tools import _automatic_function_calling_util
from google.adk.tools.tool_context import ToolContext
from google.adk.utils.variant_utils import GoogleLLMVariant
@@ -435,11 +435,8 @@ class TestJsonSchemaFeatureFlagEnabled:
@pytest.fixture(autouse=True)
def enable_feature_flag(self):
"""Enable the JSON_SCHEMA_FOR_FUNC_DECL feature flag for all tests."""
with mock.patch.object(
_automatic_function_calling_util,
'is_feature_enabled',
autospec=True,
side_effect=lambda f: f == FeatureName.JSON_SCHEMA_FOR_FUNC_DECL,
with temporary_feature_override(
FeatureName.JSON_SCHEMA_FOR_FUNC_DECL, True
):
yield