community: Fix for Pydantic model validator of GoogleApiClient (#29346)

- [ *] **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 <sardana.bhav@gmail.com>
This commit is contained in:
Bhav Sardana 2025-01-22 01:47:43 +05:30 committed by GitHub
parent 1c4ce7b42b
commit d6a7aaa97d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -52,14 +52,14 @@ class GoogleApiClient:
@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."""