experimental[major]: upgrade pydantic (#26228)

This commit is contained in:
ccurme
2024-09-09 14:27:24 -04:00
committed by GitHub
parent 109ba548bd
commit 6c8d626d70
45 changed files with 183 additions and 170 deletions

View File

@@ -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