mirror of
https://github.com/hwchase17/langchain
synced 2024-11-10 01:10:59 +00:00
community[patch]: Remove more @allow_reuse=True validators (#25236)
Remove some additional allow_reuse=True usage in @root_validators.
This commit is contained in:
parent
6e57aa7c36
commit
bd6c31617e
@ -387,7 +387,7 @@ class MiniMaxChat(BaseChatModel):
|
|||||||
class Config:
|
class Config:
|
||||||
allow_population_by_field_name = True
|
allow_population_by_field_name = True
|
||||||
|
|
||||||
@root_validator(pre=True, allow_reuse=True)
|
@root_validator(pre=True)
|
||||||
def validate_environment(cls, values: Dict) -> Dict:
|
def validate_environment(cls, values: Dict) -> Dict:
|
||||||
"""Validate that api key and python package exists in environment."""
|
"""Validate that api key and python package exists in environment."""
|
||||||
values["minimax_api_key"] = convert_to_secret_str(
|
values["minimax_api_key"] = convert_to_secret_str(
|
||||||
|
@ -21,7 +21,7 @@ class BaseGitHubLoader(BaseLoader, BaseModel, ABC):
|
|||||||
github_api_url: str = "https://api.github.com"
|
github_api_url: str = "https://api.github.com"
|
||||||
"""URL of GitHub API"""
|
"""URL of GitHub API"""
|
||||||
|
|
||||||
@root_validator(pre=True, allow_reuse=True)
|
@root_validator(pre=True)
|
||||||
def validate_environment(cls, values: Dict) -> Dict:
|
def validate_environment(cls, values: Dict) -> Dict:
|
||||||
"""Validate that access token exists in environment."""
|
"""Validate that access token exists in environment."""
|
||||||
values["access_token"] = get_from_dict_or_env(
|
values["access_token"] = get_from_dict_or_env(
|
||||||
|
@ -56,7 +56,7 @@ class ClovaEmbeddings(BaseModel, Embeddings):
|
|||||||
class Config:
|
class Config:
|
||||||
extra = "forbid"
|
extra = "forbid"
|
||||||
|
|
||||||
@root_validator(pre=True, allow_reuse=True)
|
@root_validator(pre=True)
|
||||||
def validate_environment(cls, values: Dict) -> Dict:
|
def validate_environment(cls, values: Dict) -> Dict:
|
||||||
"""Validate api key exists in environment."""
|
"""Validate api key exists in environment."""
|
||||||
values["clova_emb_api_key"] = convert_to_secret_str(
|
values["clova_emb_api_key"] = convert_to_secret_str(
|
||||||
|
@ -31,7 +31,7 @@ class _MinimaxEndpointClient(BaseModel):
|
|||||||
api_key: SecretStr
|
api_key: SecretStr
|
||||||
api_url: str
|
api_url: str
|
||||||
|
|
||||||
@root_validator(pre=True, allow_reuse=True)
|
@root_validator(pre=True)
|
||||||
def set_api_url(cls, values: Dict[str, Any]) -> Dict[str, Any]:
|
def set_api_url(cls, values: Dict[str, Any]) -> Dict[str, Any]:
|
||||||
if "api_url" not in values:
|
if "api_url" not in values:
|
||||||
host = values["host"]
|
host = values["host"]
|
||||||
|
@ -48,7 +48,7 @@ class PowerBIDataset(BaseModel):
|
|||||||
"""Fix the table names."""
|
"""Fix the table names."""
|
||||||
return [fix_table_name(table) for table in table_names]
|
return [fix_table_name(table) for table in table_names]
|
||||||
|
|
||||||
@root_validator(pre=True, allow_reuse=True)
|
@root_validator(pre=True)
|
||||||
def token_or_credential_present(cls, values: Dict[str, Any]) -> Dict[str, Any]:
|
def token_or_credential_present(cls, values: Dict[str, Any]) -> Dict[str, Any]:
|
||||||
"""Validate that at least one of token and credentials is present."""
|
"""Validate that at least one of token and credentials is present."""
|
||||||
if "token" in values or "credential" in values:
|
if "token" in values or "credential" in values:
|
||||||
|
Loading…
Reference in New Issue
Block a user