From 23ade9a1dc5242c7e27bb263083db71348fb0b8e Mon Sep 17 00:00:00 2001 From: keenborder786 <21110290@lums.edu.pk> Date: Sun, 27 Apr 2025 04:49:17 +0500 Subject: [PATCH] [chore]: Added Tests --- libs/core/langchain_core/tools/base.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libs/core/langchain_core/tools/base.py b/libs/core/langchain_core/tools/base.py index 8c25f2ce051..8f2e9eb204f 100644 --- a/libs/core/langchain_core/tools/base.py +++ b/libs/core/langchain_core/tools/base.py @@ -1078,7 +1078,14 @@ def get_all_basemodel_annotations( # cls has no subscript: cls = FooBar if isinstance(cls, type): annotations: dict[str, type] = {} - for name, param in cls.model_fields.items(): + if hasattr(cls, "model_fields"): + for name, param in cls.model_fields.items(): + if param.alias and param.alias != name: + warnings.warn( + f"Field '{name}' has alias '{param.alias}'. The alias will be used instead of the field name.", + stacklevel=2 + ) + for name, param in inspect.signature(cls).parameters.items(): # Exclude hidden init args added by pydantic Config. For example if # BaseModel(extra="allow") then "extra_data" will part of init sig. if (