mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-04 12:39:32 +00:00
community[patch]: Use get_fields adapter for pydantic (#25191)
Change all usages of __fields__ with get_fields adapter merged into langchain_core. Code mod generated using the following grit pattern: ``` engine marzano(0.1) language python `$X.__fields__` => `get_fields($X)` where { add_import(source="langchain_core.utils.pydantic", name="get_fields") } ```
This commit is contained in:
@@ -49,6 +49,7 @@ from langchain_core.runnables import Runnable, RunnableMap, RunnablePassthrough
|
||||
from langchain_core.tools import BaseTool
|
||||
from langchain_core.utils import convert_to_secret_str, get_from_dict_or_env
|
||||
from langchain_core.utils.function_calling import convert_to_openai_tool
|
||||
from langchain_core.utils.pydantic import get_fields
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -399,7 +400,7 @@ class MiniMaxChat(BaseChatModel):
|
||||
|
||||
default_values = {
|
||||
name: field.default
|
||||
for name, field in cls.__fields__.items()
|
||||
for name, field in get_fields(cls).items()
|
||||
if field.default is not None
|
||||
}
|
||||
default_values.update(values)
|
||||
|
Reference in New Issue
Block a user