diff --git a/src/google/adk/auth/auth_credential.py b/src/google/adk/auth/auth_credential.py index ed2ec48..fae4fba 100644 --- a/src/google/adk/auth/auth_credential.py +++ b/src/google/adk/auth/auth_credential.py @@ -15,13 +15,18 @@ from enum import Enum from typing import Any, Dict, List, Optional +from pydantic import alias_generators from pydantic import BaseModel from pydantic import ConfigDict from pydantic import Field class BaseModelWithConfig(BaseModel): - model_config = ConfigDict(extra="allow") + model_config = ConfigDict( + extra="allow", + alias_generator=alias_generators.to_camel, + populate_by_name=True, + ) """The pydantic model config.""" diff --git a/src/google/adk/auth/auth_tool.py b/src/google/adk/auth/auth_tool.py index 91bdf68..d560424 100644 --- a/src/google/adk/auth/auth_tool.py +++ b/src/google/adk/auth/auth_tool.py @@ -12,13 +12,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -from pydantic import BaseModel - from .auth_credential import AuthCredential +from .auth_credential import BaseModelWithConfig from .auth_schemes import AuthScheme -class AuthConfig(BaseModel): +class AuthConfig(BaseModelWithConfig): """The auth config sent by tool asking client to collect auth credentials and adk and client will help to fill in the response @@ -45,7 +44,7 @@ class AuthConfig(BaseModel): this field""" -class AuthToolArguments(BaseModel): +class AuthToolArguments(BaseModelWithConfig): """the arguments for the special long running function tool that is used to request end user credentials. diff --git a/src/google/adk/cli/cli_eval.py b/src/google/adk/cli/cli_eval.py index b1d09d3..f2f2586 100644 --- a/src/google/adk/cli/cli_eval.py +++ b/src/google/adk/cli/cli_eval.py @@ -30,6 +30,7 @@ from pydantic import Field from ..agents import Agent from ..sessions.session import Session +from .utils import common logger = logging.getLogger(__name__) @@ -50,7 +51,7 @@ class EvalMetricResult(BaseModel): eval_status: EvalStatus -class EvalCaseResult(BaseModel): +class EvalCaseResult(common.BaseModel): eval_set_file: str eval_id: str final_eval_status: EvalStatus @@ -60,7 +61,7 @@ class EvalCaseResult(BaseModel): user_id: Optional[str] = None -class EvalSetResult(BaseModel): +class EvalSetResult(common.BaseModel): eval_set_result_id: str eval_set_result_name: str eval_set_id: str diff --git a/src/google/adk/events/event.py b/src/google/adk/events/event.py index c36f6fc..c3b8b86 100644 --- a/src/google/adk/events/event.py +++ b/src/google/adk/events/event.py @@ -19,6 +19,7 @@ import string from typing import Optional from google.genai import types +from pydantic import alias_generators from pydantic import ConfigDict from pydantic import Field @@ -46,7 +47,11 @@ class Event(LlmResponse): """ model_config = ConfigDict( - extra='forbid', ser_json_bytes='base64', val_json_bytes='base64' + extra='forbid', + ser_json_bytes='base64', + val_json_bytes='base64', + alias_generator=alias_generators.to_camel, + populate_by_name=True, ) """The pydantic model config.""" diff --git a/src/google/adk/events/event_actions.py b/src/google/adk/events/event_actions.py index 6597edb..994a790 100644 --- a/src/google/adk/events/event_actions.py +++ b/src/google/adk/events/event_actions.py @@ -16,6 +16,7 @@ from __future__ import annotations from typing import Optional +from pydantic import alias_generators from pydantic import BaseModel from pydantic import ConfigDict from pydantic import Field @@ -26,7 +27,11 @@ from ..auth.auth_tool import AuthConfig class EventActions(BaseModel): """Represents the actions attached to an event.""" - model_config = ConfigDict(extra='forbid') + model_config = ConfigDict( + extra='forbid', + alias_generator=alias_generators.to_camel, + populate_by_name=True, + ) """The pydantic model config.""" skip_summarization: Optional[bool] = None diff --git a/src/google/adk/models/llm_response.py b/src/google/adk/models/llm_response.py index 353af5d..6fcb4e2 100644 --- a/src/google/adk/models/llm_response.py +++ b/src/google/adk/models/llm_response.py @@ -17,6 +17,7 @@ from __future__ import annotations from typing import Any, Optional from google.genai import types +from pydantic import alias_generators from pydantic import BaseModel from pydantic import ConfigDict @@ -40,7 +41,11 @@ class LlmResponse(BaseModel): custom_metadata: The custom metadata of the LlmResponse. """ - model_config = ConfigDict(extra='forbid') + model_config = ConfigDict( + extra='forbid', + alias_generator=alias_generators.to_camel, + populate_by_name=True, + ) """The pydantic model config.""" content: Optional[types.Content] = None