The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
community[patch]: Update root_validators to use explicit pre=True or pre=False (#23736)
Eugene Yurtsevf24e38876abc
diff --git a/libs/community/langchain_community/cross_encoders/sagemaker_endpoint.py b/libs/community/langchain_community/cross_encoders/sagemaker_endpoint.pyindex 20d6b85c6a..62bf96bad9 100644--- a/libs/community/langchain_community/cross_encoders/sagemaker_endpoint.py+++ b/libs/community/langchain_community/cross_encoders/sagemaker_endpoint.py@@ -95,14 +95,14 @@ class SagemakerEndpointCrossEncoder(BaseModel, BaseCrossEncoder):extra = Extra.forbidarbitrary_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 boto3try:- if values["credentials_profile_name"] is not None:+ if values.get("credentials_profile_name"):session = boto3.Session(profile_name=values["credentials_profile_name"])diff --git a/libs/community/langchain_community/document_compressors/dashscope_rerank.py b/libs/community/langchain_community/document_compressors/dashscope_rerank.pyindex 4501086399..07903d549e 100644--- a/libs/community/langchain_community/document_compressors/dashscope_rerank.py+++ b/libs/community/langchain_community/document_compressors/dashscope_rerank.py@@ -32,7 +32,7 @@ class DashScopeRerank(BaseDocumentCompressor):arbitrary_types_allowed = Trueallow_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."""diff --git a/libs/community/langchain_community/document_compressors/volcengine_rerank.py b/libs/community/langchain_community/document_compressors/volcengine_rerank.pyindex f62ed88514..a7098584db 100644--- a/libs/community/langchain_community/document_compressors/volcengine_rerank.py+++ b/libs/community/langchain_community/document_compressors/volcengine_rerank.py@@ -39,7 +39,7 @@ class VolcengineRerank(BaseDocumentCompressor):arbitrary_types_allowed = Trueallow_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."""diff --git a/libs/community/langchain_community/document_loaders/apify_dataset.py b/libs/community/langchain_community/document_loaders/apify_dataset.pyindex 2805ff698c..339a25c1ed 100644--- a/libs/community/langchain_community/document_loaders/apify_dataset.py+++ b/libs/community/langchain_community/document_loaders/apify_dataset.py@@ -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.diff --git a/libs/community/langchain_community/tools/connery/service.py b/libs/community/langchain_community/tools/connery/service.pyindex b8606a9317..11c921c1bc 100644--- a/libs/community/langchain_community/tools/connery/service.py+++ b/libs/community/langchain_community/tools/connery/service.py@@ -20,7 +20,7 @@ class ConneryService(BaseModel):runner_url: Optional[str] = Noneapi_key: Optional[str] = None- @root_validator()+ @root_validator(pre=True)def validate_attributes(cls, values: Dict) -> Dict:"""Validate the attributes of the ConneryService class.diff --git a/libs/community/langchain_community/tools/connery/tool.py b/libs/community/langchain_community/tools/connery/tool.pyindex 51138714e2..ac725a3a4b 100644--- a/libs/community/langchain_community/tools/connery/tool.py+++ b/libs/community/langchain_community/tools/connery/tool.py@@ -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.diff --git a/libs/community/langchain_community/vectorstores/azuresearch.py b/libs/community/langchain_community/vectorstores/azuresearch.pyindex 109d52f655..9543120c3c 100644--- a/libs/community/langchain_community/vectorstores/azuresearch.py+++ b/libs/community/langchain_community/vectorstores/azuresearch.py@@ -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: