chore: Migrate json field names to camelCase (2/n)

PiperOrigin-RevId: 757937550
This commit is contained in:
Google Team Member 2025-05-12 15:33:03 -07:00 committed by Copybara-Service
parent 05a0c6b307
commit 27b229719e
2 changed files with 27 additions and 12 deletions

View File

@ -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

View File

@ -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,
)