mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-27 17:08:47 +00:00
community[patch]: Update root_validators to use explicit pre=True or pre=False (#23736)
This commit is contained in:
parent
5b1de2ae93
commit
f24e38876a
@ -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"]
|
||||
)
|
||||
|
@ -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."""
|
||||
|
||||
|
@ -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."""
|
||||
|
||||
|
@ -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.
|
||||
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user