diff --git a/src/google/adk/cli/fast_api.py b/src/google/adk/cli/fast_api.py index 086d433..f898362 100644 --- a/src/google/adk/cli/fast_api.py +++ b/src/google/adk/cli/fast_api.py @@ -76,6 +76,7 @@ from .cli_eval import EvalMetric from .cli_eval import EvalMetricResult from .cli_eval import EvalSetResult from .cli_eval import EvalStatus +from .utils import common from .utils import create_empty_state from .utils import envs from .utils import evals @@ -119,27 +120,18 @@ class AgentRunRequest(BaseModel): streaming: bool = False -class AddSessionToEvalSetRequest(BaseModel): +class AddSessionToEvalSetRequest(common.BaseModel): eval_id: str session_id: str user_id: str -class RunEvalRequest(BaseModel): - model_config = ConfigDict( - alias_generator=alias_generators.to_camel, - ) - +class RunEvalRequest(common.BaseModel): eval_ids: list[str] # if empty, then all evals in the eval set are run. eval_metrics: list[EvalMetric] -class RunEvalResult(BaseModel): - model_config = ConfigDict( - alias_generator=alias_generators.to_camel, - populate_by_name=True, - ) - +class RunEvalResult(common.BaseModel): eval_set_file: str eval_set_id: str eval_id: str diff --git a/src/google/adk/cli/utils/common.py b/src/google/adk/cli/utils/common.py new file mode 100644 index 0000000..522fdef --- /dev/null +++ b/src/google/adk/cli/utils/common.py @@ -0,0 +1,23 @@ +# 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. + +import pydantic +from pydantic import alias_generators + + +class BaseModel(pydantic.BaseModel): + model_config = pydantic.ConfigDict( + alias_generator=alias_generators.to_camel, + populate_by_name=True, + )