Skip to content

Commit

Permalink
community: Fix for Pydantic model validator of GoogleApiClient (#29346)
Browse files Browse the repository at this point in the history
- [ *] **PR message**: ***Delete this entire checklist*** and replace
with
- **Description:** Fix for pedantic model validator for GoogleApiHandler
    - **Issue:** the issue #29165 

- [ *] **Lint and test**: Run `make format`, `make lint` and `make test`
from the root of the package(s) you've modified.

---------

Signed-off-by: Bhav Sardana <[email protected]>
  • Loading branch information
sardanabhav authored Jan 21, 2025
1 parent 1c4ce7b commit d6a7aaa
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ def __post_init__(self) -> None:

@model_validator(mode="before")
@classmethod
def validate_channel_or_videoIds_is_set(cls, values: Dict[str, Any]) -> Any:
def validate_channel_or_videoIds_is_set(cls, values: Any) -> Any:
"""Validate that either folder_id or document_ids is set, but not both."""

if not values.get("credentials_path") and not values.get(
if not values.kwargs.get("credentials_path") and not values.kwargs.get(
"service_account_path"
):
raise ValueError("Must specify either channel_name or video_ids")
return values
return values.kwargs

def _load_credentials(self) -> Any:
"""Load credentials."""
Expand Down

0 comments on commit d6a7aaa

Please sign in to comment.