mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-23 19:39:58 +00:00
multiple: pydantic 2 compatibility, v0.3 (#26443)
Signed-off-by: ChengZi <chen.zhang@zilliz.com> Co-authored-by: Eugene Yurtsev <eyurtsev@gmail.com> Co-authored-by: Bagatur <22008038+baskaryan@users.noreply.github.com> Co-authored-by: Dan O'Donovan <dan.odonovan@gmail.com> Co-authored-by: Tom Daniel Grande <tomdgrande@gmail.com> Co-authored-by: Grande <Tom.Daniel.Grande@statsbygg.no> Co-authored-by: Bagatur <baskaryan@gmail.com> Co-authored-by: ccurme <chester.curme@gmail.com> Co-authored-by: Harrison Chase <hw.chase.17@gmail.com> Co-authored-by: Tomaz Bratanic <bratanic.tomaz@gmail.com> Co-authored-by: ZhangShenao <15201440436@163.com> Co-authored-by: Friso H. Kingma <fhkingma@gmail.com> Co-authored-by: ChengZi <chen.zhang@zilliz.com> Co-authored-by: Nuno Campos <nuno@langchain.dev> Co-authored-by: Morgante Pell <morgantep@google.com>
This commit is contained in:
@@ -2,6 +2,7 @@ from typing import Any, Dict, List, Optional
|
||||
|
||||
from langchain.chains.base import Chain
|
||||
from langchain_core.callbacks.manager import CallbackManagerForChainRun
|
||||
from pydantic import model_validator
|
||||
|
||||
from langchain_experimental.comprehend_moderation.base_moderation import BaseModeration
|
||||
from langchain_experimental.comprehend_moderation.base_moderation_callbacks import (
|
||||
@@ -10,7 +11,6 @@ from langchain_experimental.comprehend_moderation.base_moderation_callbacks impo
|
||||
from langchain_experimental.comprehend_moderation.base_moderation_config import (
|
||||
BaseModerationConfig,
|
||||
)
|
||||
from langchain_experimental.pydantic_v1 import root_validator
|
||||
|
||||
|
||||
class AmazonComprehendModerationChain(Chain):
|
||||
@@ -54,8 +54,9 @@ class AmazonComprehendModerationChain(Chain):
|
||||
unique_id: Optional[str] = None
|
||||
"""A unique id that can be used to identify or group a user or session"""
|
||||
|
||||
@root_validator(pre=True)
|
||||
def create_client(cls, values: Dict[str, Any]) -> Dict[str, Any]:
|
||||
@model_validator(mode="before")
|
||||
@classmethod
|
||||
def create_client(cls, values: Dict[str, Any]) -> Any:
|
||||
"""
|
||||
Creates an Amazon Comprehend client.
|
||||
|
||||
|
Reference in New Issue
Block a user