mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-28 06:48:50 +00:00
experimental[major]: upgrade pydantic (#26228)
This commit is contained in:
@@ -18,8 +18,7 @@ from langchain_core.messages import (
|
||||
BaseMessage,
|
||||
SystemMessage,
|
||||
)
|
||||
|
||||
from langchain_experimental.pydantic_v1 import root_validator
|
||||
from pydantic import model_validator
|
||||
|
||||
prompt = """In addition to responding, you can use tools. \
|
||||
You have access to the following tools.
|
||||
@@ -134,8 +133,9 @@ class AnthropicFunctions(BaseChatModel):
|
||||
|
||||
llm: BaseChatModel
|
||||
|
||||
@root_validator(pre=True)
|
||||
def validate_environment(cls, values: Dict) -> Dict:
|
||||
@model_validator(mode="before")
|
||||
@classmethod
|
||||
def validate_environment(cls, values: Dict) -> Any:
|
||||
values["llm"] = values.get("llm") or ChatAnthropic(**values)
|
||||
return values
|
||||
|
||||
|
Reference in New Issue
Block a user