# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Utilities for Output Schema.

This module is for ADK internal use only.
Please do not rely on the implementation details.
"""

from __future__ import annotations

from typing import Union

from ..models.base_llm import BaseLlm
from .model_name_utils import is_gemini_2_or_above
from .variant_utils import get_google_llm_variant
from .variant_utils import GoogleLLMVariant


def can_use_output_schema_with_tools(model: Union[str, BaseLlm]):
  """Returns True if output schema with tools is supported."""
  model_string = model if isinstance(model, str) else model.model

  return (
      get_google_llm_variant() == GoogleLLMVariant.VERTEX_AI
      and is_gemini_2_or_above(model_string)
  )
