community[patch]: Update root_validators to use explicit pre=True or pre=False (#23736)

This commit is contained in:
Eugene Yurtsev 2024-07-01 17:13:23 -04:00 committed by GitHub
parent 5b1de2ae93
commit f24e38876a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 8 additions and 8 deletions

View File

@ -95,14 +95,14 @@ class SagemakerEndpointCrossEncoder(BaseModel, BaseCrossEncoder):
extra = Extra.forbid
arbitrary_types_allowed = True
@root_validator()
@root_validator(pre=True)
def validate_environment(cls, values: Dict) -> Dict:
"""Validate that AWS credentials to and python package exists in environment."""
try:
import boto3
try:
if values["credentials_profile_name"] is not None:
if values.get("credentials_profile_name"):
session = boto3.Session(
profile_name=values["credentials_profile_name"]
)

View File

@ -32,7 +32,7 @@ class DashScopeRerank(BaseDocumentCompressor):
arbitrary_types_allowed = True
allow_population_by_field_name = True
@root_validator()
@root_validator(pre=True)
def validate_environment(cls, values: Dict) -> Dict:
"""Validate that api key and python package exists in environment."""

View File

@ -39,7 +39,7 @@ class VolcengineRerank(BaseDocumentCompressor):
arbitrary_types_allowed = True
allow_population_by_field_name = True
@root_validator()
@root_validator(pre=True)
def validate_environment(cls, values: Dict) -> Dict:
"""Validate that api key and python package exists in environment."""

View File

@ -49,7 +49,7 @@ class ApifyDatasetLoader(BaseLoader, BaseModel):
dataset_id=dataset_id, dataset_mapping_function=dataset_mapping_function
)
@root_validator()
@root_validator(pre=True)
def validate_environment(cls, values: Dict) -> Dict:
"""Validate environment.

View File

@ -20,7 +20,7 @@ class ConneryService(BaseModel):
runner_url: Optional[str] = None
api_key: Optional[str] = None
@root_validator()
@root_validator(pre=True)
def validate_attributes(cls, values: Dict) -> Dict:
"""
Validate the attributes of the ConneryService class.

View File

@ -63,7 +63,7 @@ class ConneryAction(BaseTool):
return self.args_schema.schema_json(indent=2)
@root_validator()
@root_validator(pre=True)
def validate_attributes(cls, values: dict) -> dict:
"""
Validate the attributes of the ConneryAction class.

View File

@ -1559,7 +1559,7 @@ class AzureSearchVectorStoreRetriever(BaseRetriever):
arbitrary_types_allowed = True
@root_validator()
@root_validator(pre=True)
def validate_search_type(cls, values: Dict) -> Dict:
"""Validate search type."""
if "search_type" in values: