mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-18 21:09:00 +00:00
ai21[patch]: Upgrade @root_validators for pydantic 2 migration (#25454)
Upgrade @root_validators usage to match pydantic 2 semantics
This commit is contained in:
parent
d72a08a60d
commit
4cdaca67dc
@ -83,13 +83,11 @@ class ChatAI21(BaseChatModel, AI21Base):
|
||||
|
||||
_chat_adapter: ChatAdapter
|
||||
|
||||
@root_validator()
|
||||
@root_validator(pre=False, skip_on_failure=True)
|
||||
def validate_environment(cls, values: Dict) -> Dict:
|
||||
values = super().validate_environment(values)
|
||||
model = values.get("model")
|
||||
|
||||
values["_chat_adapter"] = create_chat_adapter(model) # type: ignore
|
||||
|
||||
"""Validate the environment."""
|
||||
model = values["model"]
|
||||
values["_chat_adapter"] = create_chat_adapter(model)
|
||||
return values
|
||||
|
||||
class Config:
|
||||
|
Loading…
Reference in New Issue
Block a user